primary_care_admin_binder 0.1.198 → 0.1.200

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 +25 -46
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -8270,7 +8270,8 @@ var moment = createCommonjsModule(function (module, exports) {
8270
8270
  var fetchData = /*#__PURE__*/function () {
8271
8271
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
8272
8272
  var url,
8273
- jwtTokenFromStorage,
8273
+ jwtToken,
8274
+ token,
8274
8275
  __options,
8275
8276
  res,
8276
8277
  data,
@@ -8279,14 +8280,20 @@ var fetchData = /*#__PURE__*/function () {
8279
8280
  while (1) switch (_context.n) {
8280
8281
  case 0:
8281
8282
  url = _args.length > 1 && _args[1] !== undefined ? _args[1] : __baseUrl__;
8282
- jwtTokenFromStorage = localStorage.getItem("jwttoken");
8283
+ jwtToken = _args.length > 2 ? _args[2] : undefined;
8284
+ // Host app (primarycarebackoffice) sets window.binderAuthToken from its
8285
+ // in-memory AuthContext on login/refresh - this package can't import that
8286
+ // module directly, and the token is intentionally never persisted to
8287
+ // localStorage, so a plain window global is the bridge.
8288
+ token = jwtToken || (typeof window !== "undefined" ? window.token : undefined);
8283
8289
  __options = {
8284
8290
  method: "POST",
8285
8291
  credentials: "include",
8286
- headers: jwtTokenFromStorage ? {
8287
- "Content-Type": "application/json",
8288
- "jwtToken": jwtTokenFromStorage
8289
- } : {
8292
+ headers: token ? _objectSpread2({
8293
+ "Content-Type": "application/json"
8294
+ }, token && {
8295
+ "jwtToken": token
8296
+ }) : {
8290
8297
  "Content-Type": "application/json"
8291
8298
  },
8292
8299
  body: {}
@@ -8380,7 +8387,6 @@ var fetchDataApi = /*#__PURE__*/function () {
8380
8387
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
8381
8388
  var url,
8382
8389
  input,
8383
- jwtToken,
8384
8390
  __options,
8385
8391
  res,
8386
8392
  _args2 = arguments;
@@ -8389,16 +8395,13 @@ var fetchDataApi = /*#__PURE__*/function () {
8389
8395
  case 0:
8390
8396
  url = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : __baseUrl__;
8391
8397
  input = _args2.length > 1 ? _args2[1] : undefined;
8392
- jwtToken = localStorage.getItem("jwttoken"); // get jwt token from local storage
8393
8398
  __options = input || {};
8394
8399
  __options.credentials = "include";
8395
- if (__options.headers) {
8396
- __options.headers.jwttoken = jwtToken;
8397
- } else {
8400
+ if (__options.headers) ; else {
8398
8401
  __options.headers = {
8399
8402
  "Content-Type": "application/json",
8400
- Accept: "application/json",
8401
- jwttoken: jwtToken
8403
+ Accept: "application/json"
8404
+ // jwttoken: jwtToken,
8402
8405
  };
8403
8406
  }
8404
8407
  _context2.n = 1;
@@ -8796,7 +8799,6 @@ var GET_MOH_USER_DETAIL = createAsyncThunk("practitionerSlice/get_moh_user_detai
8796
8799
  payload = _ref11.payload, jwtToken = _ref11.jwtToken;
8797
8800
  rejectWithValue = _ref12.rejectWithValue;
8798
8801
  _context7.p = 1;
8799
- console.log(jwtToken, "jwtT");
8800
8802
  _context7.n = 2;
8801
8803
  return fetchData({
8802
8804
  body: JSON.stringify(payload)
@@ -25096,50 +25098,27 @@ var DRUG_MASTER_SAVE = createAsyncThunk("drugMasterSlice/drug_catalog_master_sav
25096
25098
  })));
25097
25099
  var RULE_GROUP_DROPDOWN = createAsyncThunk("drugMasterSlice/getGroup", /*#__PURE__*/function () {
25098
25100
  var _ref24 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(payload, action) {
25099
- var _rejectWithValue, body, options, _res, response, _t10;
25101
+ var response, _t10;
25100
25102
  return _regenerator().w(function (_context13) {
25101
25103
  while (1) switch (_context13.p = _context13.n) {
25102
25104
  case 0:
25103
25105
  _context13.p = 0;
25104
- _rejectWithValue = action.rejectWithValue;
25105
- body = {};
25106
- body = JSON.stringify(drugCatalogMasterQuery$1.ruleGroup());
25107
- options = {
25108
- method: "Post",
25109
- headers: {
25110
- "Content-Type": "application/json",
25111
- Accept: "application/json"
25112
- },
25113
- body: body
25114
- };
25106
+ action.rejectWithValue;
25115
25107
  _context13.n = 1;
25116
- return fetch(__readQdmQueries__, options);
25108
+ return fetchData({
25109
+ body: JSON.stringify(drugCatalogMasterQuery$1.ruleGroup())
25110
+ }, __readQdmQueries__);
25117
25111
  case 1:
25118
- _res = _context13.v;
25119
- if (_res.ok) {
25120
- _context13.n = 2;
25121
- break;
25122
- }
25123
- return _context13.a(2, _rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
25124
- message: _res === null || _res === void 0 ? void 0 : _res.statusText,
25125
- Code: _res.status
25126
- })));
25127
- case 2:
25128
- _context13.n = 3;
25129
- return _res.json();
25130
- case 3:
25131
25112
  response = _context13.v;
25132
- return _context13.a(2, _objectSpread2(_objectSpread2({}, response), {}, {
25133
- Code: _res.status
25134
- }));
25135
- case 4:
25136
- _context13.p = 4;
25113
+ return _context13.a(2, response);
25114
+ case 2:
25115
+ _context13.p = 2;
25137
25116
  _t10 = _context13.v;
25138
25117
  return _context13.a(2, rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
25139
25118
  message: _t10.message
25140
25119
  })));
25141
25120
  }
25142
- }, _callee13, null, [[0, 4]]);
25121
+ }, _callee13, null, [[0, 2]]);
25143
25122
  }));
25144
25123
  return function (_x6, _x7) {
25145
25124
  return _ref24.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primary_care_admin_binder",
3
- "version": "0.1.198",
3
+ "version": "0.1.200",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",