@eka-care/medical-records-ui 1.0.12 → 1.0.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.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, MouseEvent } from 'react';
3
- import { SDKEnvironment, SDKLog, EditRecordRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
3
+ import { SDKEnvironment, SDKLog, EditDocumentRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
4
4
  export { SDKLog } from '@eka-care/medical-records-ts-sdk';
5
5
  import * as zustand from 'zustand';
6
6
 
@@ -263,7 +263,7 @@ interface RecordsConnectionActions {
263
263
  refresh: () => Promise<void>;
264
264
  /** Unix epoch ms of the last successful server refresh, or null before first call. */
265
265
  sourceRefreshedAt: number | null;
266
- editRecord: (documentId: string, data: EditRecordRequest) => Promise<void>;
266
+ editRecord: (documentId: string, data: EditDocumentRequest) => Promise<void>;
267
267
  deleteRecord: (documentId: string) => Promise<void>;
268
268
  }
269
269
  declare function useRecordsConnection(): RecordsConnectionActions;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, MouseEvent } from 'react';
3
- import { SDKEnvironment, SDKLog, EditRecordRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
3
+ import { SDKEnvironment, SDKLog, EditDocumentRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
4
4
  export { SDKLog } from '@eka-care/medical-records-ts-sdk';
5
5
  import * as zustand from 'zustand';
6
6
 
@@ -263,7 +263,7 @@ interface RecordsConnectionActions {
263
263
  refresh: () => Promise<void>;
264
264
  /** Unix epoch ms of the last successful server refresh, or null before first call. */
265
265
  sourceRefreshedAt: number | null;
266
- editRecord: (documentId: string, data: EditRecordRequest) => Promise<void>;
266
+ editRecord: (documentId: string, data: EditDocumentRequest) => Promise<void>;
267
267
  deleteRecord: (documentId: string) => Promise<void>;
268
268
  }
269
269
  declare function useRecordsConnection(): RecordsConnectionActions;
package/dist/index.js CHANGED
@@ -1155,8 +1155,9 @@ function fileToQueueItem(localId, file) {
1155
1155
  var LIMIT = 100;
1156
1156
  function useRecordsConnection() {
1157
1157
  const { bid, patientId, store, labelOf } = useSdk();
1158
+ const toMs2 = (s) => s != null ? s * 1e3 : null;
1158
1159
  const [sourceRefreshedAt, setSourceRefreshedAt] = _react.useState.call(void 0,
1159
- () => getCore().sourceRefreshedAt
1160
+ () => toMs2(getCore().sourceRefreshedAt)
1160
1161
  );
1161
1162
  const loadedKeyRef = _react.useRef.call(void 0, null);
1162
1163
  const applyItems = _react.useCallback.call(void 0,
@@ -1196,14 +1197,14 @@ function useRecordsConnection() {
1196
1197
  void getCore().listLocalDocuments({ bid, patientId, limit: LIMIT }).then(applyItems);
1197
1198
  }, [bid, patientId, labelOf, applyItems]);
1198
1199
  _react.useEffect.call(void 0, () => {
1199
- const unsubscribe = getCore().subscribe("records:changed", () => {
1200
+ const unsubscribe = getCore().subscribe("documents:changed", () => {
1200
1201
  void getCore().listLocalDocuments({ bid, patientId, limit: LIMIT }).then(applyItems);
1201
1202
  });
1202
1203
  return unsubscribe;
1203
1204
  }, [bid, patientId, applyItems]);
1204
1205
  const editRecord = _react.useCallback.call(void 0,
1205
1206
  async (documentId, data) => {
1206
- await getCore().editRecord({ documentId, data, bid, patientId });
1207
+ await getCore().editDocument({ documentId, data, bid, patientId });
1207
1208
  },
1208
1209
  [bid, patientId]
1209
1210
  );
@@ -1212,7 +1213,7 @@ function useRecordsConnection() {
1212
1213
  const records = store.getState().records;
1213
1214
  records.markPending(documentId);
1214
1215
  try {
1215
- await getCore().deleteRecord({ documentId, bid, patientId });
1216
+ await getCore().deleteDocument({ documentId, bid, patientId });
1216
1217
  records.remove(documentId);
1217
1218
  } catch (e) {
1218
1219
  records.unmarkPending(documentId);
@@ -1226,7 +1227,7 @@ function useRecordsConnection() {
1226
1227
  try {
1227
1228
  const fresh = await getCore().refreshDocumentSource({ bid, patientId, preferenceType: "HTML" });
1228
1229
  if (fresh.length > 0) applyItems(fresh);
1229
- setSourceRefreshedAt(getCore().sourceRefreshedAt);
1230
+ setSourceRefreshedAt(toMs2(getCore().sourceRefreshedAt));
1230
1231
  store.getState().records.setStatus("fresh");
1231
1232
  } catch (e) {
1232
1233
  store.getState().records.setError(e instanceof Error ? e.message : "Failed to refresh");
@@ -1480,7 +1481,7 @@ function useUploadConnection() {
1480
1481
  }));
1481
1482
  localIds.forEach((id) => store.getState().uploadQueue.updateProgress(id, 0));
1482
1483
  try {
1483
- const res = await getCore().addRecord({
1484
+ const res = await getCore().addDocument({
1484
1485
  batchRequests,
1485
1486
  files: items.map((it) => [it.file]),
1486
1487
  filenames: items.map((it) => [it.file.name]),