primary_care_admin_binder 0.1.202 → 0.1.204

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 +77 -33
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -2383,6 +2383,35 @@ var getBinderEnv = function getBinderEnv(key) {
2383
2383
  }
2384
2384
  return fallback;
2385
2385
  };
2386
+ function isAbsoluteUrl(value) {
2387
+ // Scheme-agnostic on purpose - covers http(s):// as well as ws(s):// and
2388
+ // anything else shaped like "scheme://...".
2389
+ return /^[a-z][a-z0-9+.-]*:\/\//i.test(value || "");
2390
+ }
2391
+
2392
+ // When REACT_APP_BASE_URL is configured, each service's own env var (e.g.
2393
+ // REACT_APP_BCFG_50) holds only that service's path instead of a full
2394
+ // origin, and the two are joined here. If the value is already an absolute
2395
+ // URL (today's per-service-domain setup, no shared base), it's used as-is -
2396
+ // the shared base is only applied to bare paths, so this is safe to call
2397
+ // unconditionally regardless of environment.
2398
+ function withSharedBase(rawValue) {
2399
+ if (!rawValue) return "";
2400
+ var base = getBinderEnv("REACT_APP_BASE_URL");
2401
+ if (!base || isAbsoluteUrl(rawValue)) return rawValue;
2402
+ var trimmedBase = base.replace(/\/+$/, "");
2403
+ var path = rawValue.startsWith("/") ? rawValue : "/".concat(rawValue);
2404
+ return "".concat(trimmedBase).concat(path);
2405
+ }
2406
+
2407
+ // Base-aware lookup for vars that ARE a full URL or a full path on their
2408
+ // own (e.g. REACT_APP_BCFG_50) - used for every per-service endpoint
2409
+ // base below. Not used for getBinderEnv's other callers (REACT_APP_BCFG_04,
2410
+ // REACT_APP_BCFG_106, REACT_APP_BCFG_09, etc.) since those aren't URLs
2411
+ // or paths and joining them with a shared base would corrupt them.
2412
+ function getBinderServiceUrl(key) {
2413
+ return withSharedBase(getBinderEnv(key));
2414
+ }
2386
2415
  var _dbName = "";
2387
2416
  var _dbNameNg = "";
2388
2417
  var _ruleDBName = "";
@@ -2394,23 +2423,23 @@ var _tenantId = "";
2394
2423
  * Builds all Binder URLs dynamically from runtime env
2395
2424
  */
2396
2425
  function getBinderUrls() {
2397
- var commonApi = getBinderEnv("REACT_APP_AIQOE_COMMON_API_URL");
2398
- var keyClockApi = getBinderEnv("REACT_APP_KEY_CLOCK_API");
2399
- var nifiApi = getBinderEnv("REACT_APP_NIFI_API");
2400
- var tokenApi = getBinderEnv("REACT_APP_TOKEN_URL");
2401
- var registrationApi = getBinderEnv("REACT_APP_REGISTRATION_API");
2402
- var appointmentApi = getBinderEnv("REACT_APP_APPOINTMENT_API");
2403
- getBinderEnv("REACT_APP_VHC_INTEGRATION_URL");
2404
- var getMohUserDetailUrl = getBinderEnv("REACT_APP_GET_MOH_USER_DETAIL_URL");
2426
+ var commonApi = getBinderServiceUrl("REACT_APP_BCFG_01");
2427
+ var keyClockApi = getBinderServiceUrl("REACT_APP_BCFG_50");
2428
+ var nifiApi = getBinderServiceUrl("REACT_APP_BCFG_60");
2429
+ var tokenApi = getBinderServiceUrl("REACT_APP_BCFG_107");
2430
+ var registrationApi = getBinderServiceUrl("REACT_APP_BCFG_92");
2431
+ var appointmentApi = getBinderServiceUrl("REACT_APP_BCFG_05");
2432
+ getBinderServiceUrl("REACT_APP_BCFG_113");
2433
+ var getMohUserDetailUrl = getBinderServiceUrl("REACT_APP_BCFG_31");
2405
2434
  return {
2406
2435
  // Database & Metadata
2407
- dbtype: getBinderEnv("REACT_APP_BASE_URL_HOST").split(".")[0],
2408
- dbName: getBinderEnv("REACT_APP_APPNAME"),
2436
+ dbtype: getBinderEnv("REACT_APP_BCFG_09").split(".")[0],
2437
+ dbName: getBinderEnv("REACT_APP_BCFG_04"),
2409
2438
  dbNameNg: getBinderEnv("REACT_APP_NG_DATABASE_NAME"),
2410
2439
  ruleDBName: getBinderEnv("REACT_APP_RULE_BUILDER_DB") || "RuleBuilder",
2411
- metaDatadbName: getBinderEnv("REACT_APP_META_APP_NAME"),
2412
- metaDataId: getBinderEnv("REACT_APP_METADATAID"),
2413
- tenantId: getBinderEnv("REACT_APP_TENANTID"),
2440
+ metaDatadbName: getBinderEnv("REACT_APP_BCFG_56"),
2441
+ metaDataId: getBinderEnv("REACT_APP_BCFG_57"),
2442
+ tenantId: getBinderEnv("REACT_APP_BCFG_106"),
2414
2443
  // Arango APIs
2415
2444
  baseUrl: function baseUrl() {
2416
2445
  return "".concat(commonApi, "/api/read_qdmqueries");
@@ -8693,9 +8722,7 @@ var PRACTITIONER_UPSERT = createAsyncThunk("practitionerSlice/practitionerAdd",
8693
8722
  _context4.n = 2;
8694
8723
  return fetchData({
8695
8724
  body: JSON.stringify(payload)
8696
- },
8697
- // process.env.REACT_APP_SAVE_PRACT
8698
- __savePract__);
8725
+ }, __savePract__);
8699
8726
  case 2:
8700
8727
  dataRes = _context4.v;
8701
8728
  return _context4.a(2, _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
@@ -12948,13 +12975,13 @@ var vitalsMasterSectionActions = {
12948
12975
  var vitalsMasterSectionSlice$1 = vitalsMasterSectionSlice.reducer;
12949
12976
 
12950
12977
  var getActiveDbName$1 = function getActiveDbName() {
12951
- return dbName || _dbName || getBinderEnv("REACT_APP_APPNAME");
12978
+ return dbName || _dbName || getBinderEnv("REACT_APP_BCFG_04");
12952
12979
  };
12953
12980
  var getActiveMetadataDbName$1 = function getActiveMetadataDbName() {
12954
- return metaDatadbName$1 || getBinderEnv("REACT_APP_META_APP_NAME");
12981
+ return metaDatadbName$1 || getBinderEnv("REACT_APP_BCFG_56");
12955
12982
  };
12956
12983
  var getActiveMetadataId$1 = function getActiveMetadataId() {
12957
- return metaDataId$1 || getBinderEnv("REACT_APP_METADATAID");
12984
+ return metaDataId$1 || getBinderEnv("REACT_APP_BCFG_57");
12958
12985
  };
12959
12986
  var getLocationSort = function getLocationSort(sort) {
12960
12987
  switch (sort) {
@@ -18916,10 +18943,12 @@ var queries$j = {
18916
18943
  }
18917
18944
  };
18918
18945
  },
18919
- holiday_master: {
18920
- holiday_type: "{\n \"appcode\": \"".concat(_dbName, "\",\n \"requestid\": \"49d3a86e-226d-4d76-9160-0e93e56c9dea\",\n \"filter\": {\n \"type\": \"HOLIDAYTYPE\"\n } \n }"),
18921
- entity_name: "{\n \"appcode\":\"".concat(_dbName, "\",\n \"requestid\": \"79a77938-7200-48db-8f69-462c46ffd447\" \n }"),
18922
- entity_type: "{\n \"appcode\":\"".concat(_dbName, "\",\n \"requestid\": \"09335a68-08b0-48b2-ad47-58ffbb5fef33\",\n \"filter\": {\n \"type\": \"ORGTYPE\"\n }\n }")
18946
+ holiday_master: function holiday_master() {
18947
+ return {
18948
+ holiday_type: "{\n \"appcode\": \"".concat(dbName, "\",\n \"requestid\": \"49d3a86e-226d-4d76-9160-0e93e56c9dea\",\n \"filter\": {\n \"type\": \"HOLIDAYTYPE\"\n } \n }"),
18949
+ entity_name: "{\n \"appcode\":\"".concat(dbName, "\",\n \"requestid\": \"79a77938-7200-48db-8f69-462c46ffd447\" \n }"),
18950
+ entity_type: "{\n \"appcode\":\"".concat(dbName, "\",\n \"requestid\": \"09335a68-08b0-48b2-ad47-58ffbb5fef33\",\n \"filter\": {\n \"type\": \"ORGTYPE\"\n }\n }")
18951
+ };
18923
18952
  },
18924
18953
  appointment_type_read: function appointment_type_read(page, perPage, search) {
18925
18954
  return "{\n \"appcode\": \"".concat(dbName, "\",\n \"filter\": {\n \"type\": \"APPTYPE\",\n \"search\": \"").concat(search || "", "\",\n \"status\": true,\n \"activestatus\": true\n },\n \"limit\": {\n \"offset\": ").concat(page, ",\n \"count\": ").concat(perPage, "\n }\n}");
@@ -19308,17 +19337,18 @@ var HOLIDAY_SINGLE_READ_SELECTED_QDM = createAsyncThunk("holidaySlice/holidaySin
19308
19337
  var loopMasters$8 = function loopMasters() {
19309
19338
  return new es6Promise.Promise(/*#__PURE__*/function () {
19310
19339
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(resolve, reject) {
19311
- var calls;
19340
+ var masters, calls;
19312
19341
  return _regenerator().w(function (_context6) {
19313
19342
  while (1) switch (_context6.n) {
19314
19343
  case 0:
19315
- calls = Object.keys(queries$j.holiday_master).map(/*#__PURE__*/function () {
19344
+ masters = queries$j.holiday_master();
19345
+ calls = Object.keys(masters).map(/*#__PURE__*/function () {
19316
19346
  var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(val) {
19317
19347
  return _regenerator().w(function (_context5) {
19318
19348
  while (1) switch (_context5.n) {
19319
19349
  case 0:
19320
19350
  _context5.n = 1;
19321
- return fetchMaster$8(val, queries$j.holiday_master[val]);
19351
+ return fetchMaster$8(val, masters[val]);
19322
19352
  case 1:
19323
19353
  return _context5.a(2, _context5.v);
19324
19354
  }
@@ -19332,22 +19362,36 @@ var loopMasters$8 = function loopMasters() {
19332
19362
  var json = {};
19333
19363
  data.map(function (val) {
19334
19364
  var arr = [];
19335
- val.data.map(function (value) {
19365
+ var responseData = val.data || [];
19366
+ if (Array.isArray(responseData) && responseData.length > 0) {
19367
+ var firstItem = responseData[0];
19368
+ if (firstItem && _typeof(firstItem) === "object" && !firstItem._id && !firstItem._key) {
19369
+ var _firstItem$keys$;
19370
+ var keys = Object.keys(firstItem);
19371
+ if (keys.length === 1 && (_firstItem$keys$ = firstItem[keys[0]]) !== null && _firstItem$keys$ !== void 0 && _firstItem$keys$.Value) {
19372
+ responseData = firstItem[keys[0]].Value;
19373
+ } else if (firstItem.result) {
19374
+ responseData = firstItem.result;
19375
+ }
19376
+ }
19377
+ }
19378
+ if (!Array.isArray(responseData)) responseData = [];
19379
+ responseData.map(function (value) {
19336
19380
  if (["entity_name"].indexOf(val.name) === 0) {
19337
19381
  arr.push(_objectSpread2({
19338
- label: value.name ? value.name : "",
19339
- value: value.OrgID ? value.OrgID : ""
19382
+ label: value.name ? value.name : value.display || "",
19383
+ value: value.OrgID ? value.OrgID : value._id || ""
19340
19384
  }, value));
19341
19385
  } else {
19342
19386
  arr.push(_objectSpread2({
19343
- label: value.coding ? value.coding[0] ? value.coding[0].display : "" : val,
19387
+ label: value.coding && value.coding[0] ? value.coding[0].display || "" : value.display || "",
19344
19388
  value: value._id
19345
19389
  }, value));
19346
19390
  }
19347
19391
  });
19348
19392
  json[val.name] = arr;
19349
- resolve(json);
19350
19393
  });
19394
+ resolve(json);
19351
19395
  })["catch"](function (err) {
19352
19396
  resolve([]);
19353
19397
  console.log(err);
@@ -42990,13 +43034,13 @@ var geoGraphicActions = {
42990
43034
  var geoGraphicSlice$1 = geoGraphicSlice.reducer;
42991
43035
 
42992
43036
  var getActiveDbName = function getActiveDbName() {
42993
- return dbName || _dbName || getBinderEnv("REACT_APP_DATABASE_NAME");
43037
+ return dbName || _dbName || getBinderEnv("REACT_APP_BCFG_19");
42994
43038
  };
42995
43039
  var getActiveMetadataDbName = function getActiveMetadataDbName() {
42996
43040
  return metaDatadbName$1 || getBinderEnv("REACT_APP_METADATA_DB_NAME");
42997
43041
  };
42998
43042
  var getActiveMetadataId = function getActiveMetadataId() {
42999
- return metaDataId$1 || getBinderEnv("REACT_APP_METADATAID");
43043
+ return metaDataId$1 || getBinderEnv("REACT_APP_BCFG_57");
43000
43044
  };
43001
43045
  var additionalcolumns = function additionalcolumns(list) {
43002
43046
  var datas = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primary_care_admin_binder",
3
- "version": "0.1.202",
3
+ "version": "0.1.204",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",