@ovok/core 0.3.14 → 0.3.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/README.md CHANGED
@@ -83,6 +83,11 @@ CommunicationRequest-backed notifications.
83
83
 
84
84
  ```typescript
85
85
  const me = await client.getCurrentPatientProfile();
86
+ const dashboard = await client.getPatientDashboard({
87
+ latestObservations: { code: ["8867-4", "9279-1"], max: 5 },
88
+ measurementHistory: { _sort: "-date", _count: 50 },
89
+ carePlans: { status: "active" },
90
+ });
86
91
  const latest = await client.getPatientLatestObservations({
87
92
  patient: `Patient/${me.profile.id}`,
88
93
  code: ["8867-4", "9279-1"],
@@ -185,9 +190,9 @@ download elements; the backend remains responsible for authorization and signed
185
190
  ## React hooks
186
191
 
187
192
  The package exports additive hooks for capability discovery, project configuration, patient profile
188
- and health data, questionnaires, scheduling resources, CareHub lists, telemetry, and notifications.
189
- Every request hook returns `data`, `loading`, `error`, and `reload`; questionnaire mutations expose
190
- `data`, `loading`, `error`, `mutate`, and `reset`.
193
+ and health data, questionnaires, scheduling resources, CareHub lists, telemetry, notifications,
194
+ documents, content, video consultations, and localization. Every request hook returns `data`,
195
+ `loading`, `error`, and `reload`; mutations expose `data`, `loading`, `error`, `mutate`, and `reset`.
191
196
 
192
197
  ```tsx
193
198
  const { data: patients, loading, error } = useCarehubPatients({
@@ -201,6 +206,9 @@ const saveSettings = useOvokMutation((client, settings: OvokProjectSettings) =>
201
206
  const { data: me } = useCurrentPatientProfile();
202
207
  const { data: appointments } = usePatientAppointments({ status: "booked" });
203
208
  const populateQuestionnaire = usePopulateQuestionnaire();
209
+ const { data: articles } = useContent("blog", "en-US", { _count: 10 });
210
+ const { data: calls } = useVideoCallAppointments();
211
+ const { data: translations } = useLocalizations("en-US");
204
212
  ```
205
213
 
206
214
  Hooks are additive to the existing `OvokProvider`, observation hooks, auth methods, and offline
@@ -1,5 +1,5 @@
1
1
  import { OvokClient } from "../ovok-client";
2
- import { OvokCurrentPatientProfile, OvokPatientLatestObservationsQuery, OvokPatientObservationBundle, OvokPatientAppointment, OvokPatientCarePlan, OvokPatientDevice, OvokPatientMeasurement, OvokPatientNotification, OvokPatientQuestionnaire, OvokPatientQuestionnaireResponse, OvokPatientResourceQuery, OvokPatientSchedule, OvokPatientSchedulingQuery, OvokPatientSlot, OvokPatientTelemetryHistory, OvokPatientTelemetryHistoryQuery } from "./types";
2
+ import { OvokCurrentPatientProfile, OvokPatientLatestObservationsQuery, OvokPatientObservationBundle, OvokPatientAppointment, OvokPatientCarePlan, OvokPatientDashboard, OvokPatientDashboardQuery, OvokPatientDevice, OvokPatientMeasurement, OvokPatientNotification, OvokPatientQuestionnaire, OvokPatientQuestionnaireResponse, OvokPatientResourceQuery, OvokPatientSchedule, OvokPatientSchedulingQuery, OvokPatientSlot, OvokPatientTelemetryHistory, OvokPatientTelemetryHistoryQuery } from "./types";
3
3
  export declare function getCurrentPatientProfile(this: OvokClient): Promise<OvokCurrentPatientProfile>;
4
4
  export declare function getPatientLatestObservations(this: OvokClient, params?: OvokPatientLatestObservationsQuery): Promise<OvokPatientObservationBundle>;
5
5
  export declare function getPatientDeviceTelemetry(this: OvokClient, deviceId: string): Promise<OvokPatientObservationBundle>;
@@ -22,3 +22,4 @@ export declare function listPatientDevices(this: OvokClient, params?: OvokPatien
22
22
  export declare function getPatientDevice(this: OvokClient, deviceId: string): Promise<OvokPatientDevice>;
23
23
  export declare function listPatientNotifications(this: OvokClient, params?: OvokPatientResourceQuery): Promise<OvokPatientNotification[]>;
24
24
  export declare function getPatientNotification(this: OvokClient, notificationId: string): Promise<OvokPatientNotification>;
25
+ export declare function getPatientDashboard(this: OvokClient, params?: OvokPatientDashboardQuery): Promise<OvokPatientDashboard>;
@@ -22,6 +22,7 @@ exports.listPatientDevices = listPatientDevices;
22
22
  exports.getPatientDevice = getPatientDevice;
23
23
  exports.listPatientNotifications = listPatientNotifications;
24
24
  exports.getPatientNotification = getPatientNotification;
25
+ exports.getPatientDashboard = getPatientDashboard;
25
26
  const segment = (value) => encodeURIComponent(value);
26
27
  const query = (params) => {
27
28
  const values = new URLSearchParams();
@@ -104,3 +105,23 @@ async function listPatientNotifications(params = {}) {
104
105
  async function getPatientNotification(notificationId) {
105
106
  return this.readResource("CommunicationRequest", notificationId);
106
107
  }
108
+ async function getPatientDashboard(params = {}) {
109
+ var _a, _b, _c, _d, _e, _f;
110
+ const profile = await this.getCurrentPatientProfile();
111
+ const patient = `Patient/${profile.profile.id}`;
112
+ const latestObservations = await this.getPatientLatestObservations({
113
+ ...params.latestObservations,
114
+ patient: (_b = (_a = params.latestObservations) === null || _a === void 0 ? void 0 : _a.patient) !== null && _b !== void 0 ? _b : patient,
115
+ });
116
+ const [measurementHistory, carePlans] = await Promise.all([
117
+ this.listPatientMeasurementHistory({
118
+ ...params.measurementHistory,
119
+ patient: (_d = (_c = params.measurementHistory) === null || _c === void 0 ? void 0 : _c.patient) !== null && _d !== void 0 ? _d : patient,
120
+ }),
121
+ this.listPatientCarePlans({
122
+ ...params.carePlans,
123
+ patient: (_f = (_e = params.carePlans) === null || _e === void 0 ? void 0 : _e.patient) !== null && _f !== void 0 ? _f : patient,
124
+ }),
125
+ ]);
126
+ return { carePlans, latestObservations, measurementHistory, profile };
127
+ }
@@ -70,6 +70,11 @@ export type OvokPatientTelemetryHistoryQuery = {
70
70
  };
71
71
  export type OvokPatientSchedulingQuery = Record<string, string | number | boolean | undefined>;
72
72
  export type OvokPatientResourceQuery = OvokPatientSchedulingQuery;
73
+ export type OvokPatientDashboardQuery = {
74
+ latestObservations?: OvokPatientLatestObservationsQuery;
75
+ measurementHistory?: OvokPatientResourceQuery;
76
+ carePlans?: OvokPatientResourceQuery;
77
+ };
73
78
  export type OvokPatientAppointment = Appointment;
74
79
  export type OvokPatientSchedule = Schedule;
75
80
  export type OvokPatientSlot = Slot;
@@ -79,6 +84,12 @@ export type OvokPatientDevice = Device;
79
84
  export type OvokPatientNotification = CommunicationRequest;
80
85
  export type OvokPatientQuestionnaire = Questionnaire;
81
86
  export type OvokPatientQuestionnaireResponse = QuestionnaireResponse;
87
+ export type OvokPatientDashboard = {
88
+ profile: OvokCurrentPatientProfile;
89
+ latestObservations: OvokPatientObservationBundle;
90
+ measurementHistory: OvokPatientMeasurement[];
91
+ carePlans: OvokPatientCarePlan[];
92
+ };
82
93
  export type OvokPatientObservationBundle = Bundle<Observation>;
83
94
  export type OvokPatientTelemetryHistory = {
84
95
  deviceId: string;
@@ -48,7 +48,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
48
48
  description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
49
49
  software: {
50
50
  name: "@ovok/core",
51
- version: "0.3.14",
51
+ version: "0.3.16",
52
52
  },
53
53
  fhirVersion: "4.0.1",
54
54
  format: ["json"],
@@ -0,0 +1,13 @@
1
+ import { OvokConsentSignatureResponse, OvokContentQuery, OvokContentSearchResponse, OvokDocumentSearchQuery, OvokDocumentSearchResponse, OvokVideoCallAccess, OvokVideoCallAppointment, OvokVideoCallAppointmentInput, OvokVideoCallAppointmentQuery } from "../client/experience/types";
2
+ import { OvokMutationState, OvokRequestState } from "./api-hooks";
3
+ export declare const useConsentSignature: () => OvokMutationState<{
4
+ consentId: string;
5
+ }, OvokConsentSignatureResponse>;
6
+ export declare const useDocuments: (params?: OvokDocumentSearchQuery) => OvokRequestState<OvokDocumentSearchResponse>;
7
+ export declare const useContent: (type: string, language: string, params?: OvokContentQuery) => OvokRequestState<OvokContentSearchResponse>;
8
+ export declare const useVideoCallAppointments: (params?: OvokVideoCallAppointmentQuery) => OvokRequestState<OvokVideoCallAppointment[]>;
9
+ export declare const useVideoCallAccess: (appointmentId?: string) => OvokRequestState<Record<string, unknown>>;
10
+ export declare const useCreateVideoCallAppointment: () => OvokMutationState<OvokVideoCallAppointmentInput, OvokVideoCallAppointment>;
11
+ export declare const useCreateVideoCallUserAccess: () => OvokMutationState<{
12
+ appointmentId: string;
13
+ }, OvokVideoCallAccess>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.useCreateVideoCallUserAccess = exports.useCreateVideoCallAppointment = exports.useVideoCallAccess = exports.useVideoCallAppointments = exports.useContent = exports.useDocuments = exports.useConsentSignature = void 0;
38
+ const React = __importStar(require("react"));
39
+ const api_hooks_1 = require("./api-hooks");
40
+ const index_1 = require("./index");
41
+ const useConsentSignature = () => (0, api_hooks_1.useOvokMutation)((client, params) => client.requestConsentSignature(params.consentId));
42
+ exports.useConsentSignature = useConsentSignature;
43
+ const useDocuments = (params = {}) => {
44
+ const client = (0, index_1.useClient)();
45
+ const serialized = JSON.stringify(params);
46
+ const load = React.useCallback(() => client.listDocuments(params), [client, serialized]);
47
+ return (0, api_hooks_1.useOvokRequest)(load);
48
+ };
49
+ exports.useDocuments = useDocuments;
50
+ const useContent = (type, language, params = {}) => {
51
+ const client = (0, index_1.useClient)();
52
+ const serialized = JSON.stringify(params);
53
+ const load = React.useCallback(() => client.searchContent(type, language, params), [client, language, serialized, type]);
54
+ return (0, api_hooks_1.useOvokRequest)(load, type.length > 0 && language.length > 0);
55
+ };
56
+ exports.useContent = useContent;
57
+ const useVideoCallAppointments = (params = {}) => {
58
+ const client = (0, index_1.useClient)();
59
+ const serialized = JSON.stringify(params);
60
+ const load = React.useCallback(() => client.listVideoCallAppointments(params), [client, serialized]);
61
+ return (0, api_hooks_1.useOvokRequest)(load);
62
+ };
63
+ exports.useVideoCallAppointments = useVideoCallAppointments;
64
+ const useVideoCallAccess = (appointmentId) => {
65
+ const client = (0, index_1.useClient)();
66
+ const load = React.useCallback(() => appointmentId
67
+ ? client.getVideoCallAccessPermission(appointmentId)
68
+ : Promise.reject(new Error("appointmentId is required")), [appointmentId, client]);
69
+ return (0, api_hooks_1.useOvokRequest)(load, appointmentId !== undefined);
70
+ };
71
+ exports.useVideoCallAccess = useVideoCallAccess;
72
+ const useCreateVideoCallAppointment = () => (0, api_hooks_1.useOvokMutation)((client, params) => client.createVideoCallAppointment(params));
73
+ exports.useCreateVideoCallAppointment = useCreateVideoCallAppointment;
74
+ const useCreateVideoCallUserAccess = () => (0, api_hooks_1.useOvokMutation)((client, params) => client.createVideoCallUserAccess(params.appointmentId));
75
+ exports.useCreateVideoCallUserAccess = useCreateVideoCallUserAccess;
@@ -7,4 +7,6 @@ export declare const OvokProvider: (props: React.PropsWithChildren<{
7
7
  }>) => React.JSX.Element;
8
8
  export { observationsToMeasurements, useEcgRecording, useObservations, useSaveMeasurement, useUrineTests, } from "./observation-hooks";
9
9
  export { useAdministeredProjects, useCarehubDeviceTelemetry, useCarehubDevices, useCarehubNotifications, useCarehubPatients, useCapabilityStatement, useOvokMutation, useOvokRequest, useProjectFeatures, useProjectSettings, usePublicApiEndpoints, useRecentCarehubNotifications, } from "./api-hooks";
10
- export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientCarePlans, usePatientDevices, usePatientDeviceTelemetry, usePatientDeviceTelemetryHistory, usePatientMeasurement, usePatientMeasurementHistory, usePatientLatestObservations, usePatientNotifications, usePatientQuestionnaireResponses, usePatientQuestionnaires, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-hooks";
10
+ export { useConsentSignature, useContent, useCreateVideoCallAppointment, useCreateVideoCallUserAccess, useDocuments, useVideoCallAccess, useVideoCallAppointments, } from "./experience-hooks";
11
+ export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, } from "./platform-hooks";
12
+ export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientCarePlans, usePatientDevices, usePatientDeviceTelemetry, usePatientDeviceTelemetryHistory, usePatientMeasurement, usePatientMeasurementHistory, usePatientDashboard, usePatientLatestObservations, usePatientNotifications, usePatientQuestionnaireResponses, usePatientQuestionnaires, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-hooks";
@@ -34,7 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientQuestionnaires = exports.usePatientQuestionnaireResponses = exports.usePatientNotifications = exports.usePatientLatestObservations = exports.usePatientMeasurementHistory = exports.usePatientMeasurement = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientDevices = exports.usePatientCarePlans = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useRecentCarehubNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useCarehubPatients = exports.useCarehubNotifications = exports.useCarehubDevices = exports.useCarehubDeviceTelemetry = exports.useAdministeredProjects = exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
37
+ exports.usePatientMeasurement = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientDevices = exports.usePatientCarePlans = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useUpdateLocalization = exports.useUpdateI18nextDocument = exports.useLocalizations = exports.useLocales = exports.useI18nextDocument = exports.useVideoCallAppointments = exports.useVideoCallAccess = exports.useDocuments = exports.useCreateVideoCallUserAccess = exports.useCreateVideoCallAppointment = exports.useContent = exports.useConsentSignature = exports.useRecentCarehubNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useCarehubPatients = exports.useCarehubNotifications = exports.useCarehubDevices = exports.useCarehubDeviceTelemetry = exports.useAdministeredProjects = exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
38
+ exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientQuestionnaires = exports.usePatientQuestionnaireResponses = exports.usePatientNotifications = exports.usePatientLatestObservations = exports.usePatientDashboard = exports.usePatientMeasurementHistory = void 0;
38
39
  /*
39
40
  * The only React-dependent module in the package.
40
41
  *
@@ -89,6 +90,20 @@ Object.defineProperty(exports, "useProjectFeatures", { enumerable: true, get: fu
89
90
  Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return api_hooks_1.useProjectSettings; } });
90
91
  Object.defineProperty(exports, "usePublicApiEndpoints", { enumerable: true, get: function () { return api_hooks_1.usePublicApiEndpoints; } });
91
92
  Object.defineProperty(exports, "useRecentCarehubNotifications", { enumerable: true, get: function () { return api_hooks_1.useRecentCarehubNotifications; } });
93
+ var experience_hooks_1 = require("./experience-hooks");
94
+ Object.defineProperty(exports, "useConsentSignature", { enumerable: true, get: function () { return experience_hooks_1.useConsentSignature; } });
95
+ Object.defineProperty(exports, "useContent", { enumerable: true, get: function () { return experience_hooks_1.useContent; } });
96
+ Object.defineProperty(exports, "useCreateVideoCallAppointment", { enumerable: true, get: function () { return experience_hooks_1.useCreateVideoCallAppointment; } });
97
+ Object.defineProperty(exports, "useCreateVideoCallUserAccess", { enumerable: true, get: function () { return experience_hooks_1.useCreateVideoCallUserAccess; } });
98
+ Object.defineProperty(exports, "useDocuments", { enumerable: true, get: function () { return experience_hooks_1.useDocuments; } });
99
+ Object.defineProperty(exports, "useVideoCallAccess", { enumerable: true, get: function () { return experience_hooks_1.useVideoCallAccess; } });
100
+ Object.defineProperty(exports, "useVideoCallAppointments", { enumerable: true, get: function () { return experience_hooks_1.useVideoCallAppointments; } });
101
+ var platform_hooks_1 = require("./platform-hooks");
102
+ Object.defineProperty(exports, "useI18nextDocument", { enumerable: true, get: function () { return platform_hooks_1.useI18nextDocument; } });
103
+ Object.defineProperty(exports, "useLocales", { enumerable: true, get: function () { return platform_hooks_1.useLocales; } });
104
+ Object.defineProperty(exports, "useLocalizations", { enumerable: true, get: function () { return platform_hooks_1.useLocalizations; } });
105
+ Object.defineProperty(exports, "useUpdateI18nextDocument", { enumerable: true, get: function () { return platform_hooks_1.useUpdateI18nextDocument; } });
106
+ Object.defineProperty(exports, "useUpdateLocalization", { enumerable: true, get: function () { return platform_hooks_1.useUpdateLocalization; } });
92
107
  var patient_hooks_1 = require("./patient-hooks");
93
108
  Object.defineProperty(exports, "useCurrentPatientProfile", { enumerable: true, get: function () { return patient_hooks_1.useCurrentPatientProfile; } });
94
109
  Object.defineProperty(exports, "useExtractQuestionnaireObservations", { enumerable: true, get: function () { return patient_hooks_1.useExtractQuestionnaireObservations; } });
@@ -99,6 +114,7 @@ Object.defineProperty(exports, "usePatientDeviceTelemetry", { enumerable: true,
99
114
  Object.defineProperty(exports, "usePatientDeviceTelemetryHistory", { enumerable: true, get: function () { return patient_hooks_1.usePatientDeviceTelemetryHistory; } });
100
115
  Object.defineProperty(exports, "usePatientMeasurement", { enumerable: true, get: function () { return patient_hooks_1.usePatientMeasurement; } });
101
116
  Object.defineProperty(exports, "usePatientMeasurementHistory", { enumerable: true, get: function () { return patient_hooks_1.usePatientMeasurementHistory; } });
117
+ Object.defineProperty(exports, "usePatientDashboard", { enumerable: true, get: function () { return patient_hooks_1.usePatientDashboard; } });
102
118
  Object.defineProperty(exports, "usePatientLatestObservations", { enumerable: true, get: function () { return patient_hooks_1.usePatientLatestObservations; } });
103
119
  Object.defineProperty(exports, "usePatientNotifications", { enumerable: true, get: function () { return patient_hooks_1.usePatientNotifications; } });
104
120
  Object.defineProperty(exports, "usePatientQuestionnaireResponses", { enumerable: true, get: function () { return patient_hooks_1.usePatientQuestionnaireResponses; } });
@@ -1,8 +1,9 @@
1
1
  import { Bundle, Observation, Parameters, QuestionnaireResponse } from "@medplum/fhirtypes";
2
- import { OvokCurrentPatientProfile, OvokPatientAppointment, OvokPatientCarePlan, OvokPatientDevice, OvokPatientLatestObservationsQuery, OvokPatientMeasurement, OvokPatientNotification, OvokPatientObservationBundle, OvokPatientQuestionnaire, OvokPatientQuestionnaireResponse, OvokPatientResourceQuery, OvokPatientSchedule, OvokPatientSchedulingQuery, OvokPatientSlot, OvokPatientTelemetryHistory, OvokPatientTelemetryHistoryQuery } from "../client/patient/types";
2
+ import { OvokCurrentPatientProfile, OvokPatientAppointment, OvokPatientCarePlan, OvokPatientDashboard, OvokPatientDashboardQuery, OvokPatientDevice, OvokPatientLatestObservationsQuery, OvokPatientMeasurement, OvokPatientNotification, OvokPatientObservationBundle, OvokPatientQuestionnaire, OvokPatientQuestionnaireResponse, OvokPatientResourceQuery, OvokPatientSchedule, OvokPatientSchedulingQuery, OvokPatientSlot, OvokPatientTelemetryHistory, OvokPatientTelemetryHistoryQuery } from "../client/patient/types";
3
3
  import { OvokQuestionnaireOperationResponse } from "../client/questionnaire-response/types";
4
4
  import { OvokMutationState, OvokRequestState } from "./api-hooks";
5
5
  export declare const useCurrentPatientProfile: () => OvokRequestState<OvokCurrentPatientProfile>;
6
+ export declare const usePatientDashboard: (params?: OvokPatientDashboardQuery) => OvokRequestState<OvokPatientDashboard>;
6
7
  export declare const usePatientLatestObservations: (params?: OvokPatientLatestObservationsQuery) => OvokRequestState<OvokPatientObservationBundle>;
7
8
  export declare const usePatientDeviceTelemetry: (deviceId?: string) => OvokRequestState<OvokPatientObservationBundle>;
8
9
  export declare const usePatientDeviceTelemetryHistory: (deviceId: string | undefined, params?: OvokPatientTelemetryHistoryQuery) => OvokRequestState<OvokPatientTelemetryHistory>;
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useExtractQuestionnaireObservations = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientNotifications = exports.usePatientDevices = exports.usePatientQuestionnaireResponses = exports.usePatientQuestionnaires = exports.usePatientCarePlans = exports.usePatientMeasurement = exports.usePatientMeasurementHistory = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientAppointments = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientLatestObservations = exports.useCurrentPatientProfile = void 0;
37
+ exports.useExtractQuestionnaireObservations = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientNotifications = exports.usePatientDevices = exports.usePatientQuestionnaireResponses = exports.usePatientQuestionnaires = exports.usePatientCarePlans = exports.usePatientMeasurement = exports.usePatientMeasurementHistory = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientAppointments = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientLatestObservations = exports.usePatientDashboard = exports.useCurrentPatientProfile = void 0;
38
38
  const React = __importStar(require("react"));
39
39
  const api_hooks_1 = require("./api-hooks");
40
40
  const index_1 = require("./index");
@@ -44,6 +44,13 @@ const useCurrentPatientProfile = () => {
44
44
  return (0, api_hooks_1.useOvokRequest)(load);
45
45
  };
46
46
  exports.useCurrentPatientProfile = useCurrentPatientProfile;
47
+ const usePatientDashboard = (params = {}) => {
48
+ const client = (0, index_1.useClient)();
49
+ const serialized = JSON.stringify(params);
50
+ const load = React.useCallback(() => client.getPatientDashboard(params), [client, serialized]);
51
+ return (0, api_hooks_1.useOvokRequest)(load);
52
+ };
53
+ exports.usePatientDashboard = usePatientDashboard;
47
54
  const usePatientLatestObservations = (params = {}) => {
48
55
  const client = (0, index_1.useClient)();
49
56
  const serialized = JSON.stringify(params);
@@ -0,0 +1,17 @@
1
+ import { OvokI18nDocument, OvokLocalization, OvokLocalizationQuery, OvokLocalizationUpdate, OvokI18nValue, OvokLocales } from "../client/platform/types";
2
+ import { OvokMutationState, OvokRequestState } from "./api-hooks";
3
+ export declare const useLocales: () => OvokRequestState<OvokLocales>;
4
+ export declare const useLocalizations: (language: string, params?: OvokLocalizationQuery) => OvokRequestState<{
5
+ total: number;
6
+ resources: OvokLocalization[];
7
+ }>;
8
+ export declare const useI18nextDocument: (language: string) => OvokRequestState<OvokI18nDocument>;
9
+ export declare const useUpdateLocalization: () => OvokMutationState<{
10
+ language: string;
11
+ key: string;
12
+ body: OvokLocalizationUpdate;
13
+ }, OvokLocalization>;
14
+ export declare const useUpdateI18nextDocument: () => OvokMutationState<{
15
+ language: string;
16
+ document: Record<string, OvokI18nValue>;
17
+ }, void>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.useUpdateI18nextDocument = exports.useUpdateLocalization = exports.useI18nextDocument = exports.useLocalizations = exports.useLocales = void 0;
38
+ const React = __importStar(require("react"));
39
+ const api_hooks_1 = require("./api-hooks");
40
+ const index_1 = require("./index");
41
+ const useLocales = () => {
42
+ const client = (0, index_1.useClient)();
43
+ const load = React.useCallback(() => client.getLocales(), [client]);
44
+ return (0, api_hooks_1.useOvokRequest)(load);
45
+ };
46
+ exports.useLocales = useLocales;
47
+ const useLocalizations = (language, params = {}) => {
48
+ const client = (0, index_1.useClient)();
49
+ const serialized = JSON.stringify(params);
50
+ const load = React.useCallback(() => client.listLocalizations(language, params), [client, language, serialized]);
51
+ return (0, api_hooks_1.useOvokRequest)(load, language.length > 0);
52
+ };
53
+ exports.useLocalizations = useLocalizations;
54
+ const useI18nextDocument = (language) => {
55
+ const client = (0, index_1.useClient)();
56
+ const load = React.useCallback(() => client.getI18nextDocument(language), [client, language]);
57
+ return (0, api_hooks_1.useOvokRequest)(load, language.length > 0);
58
+ };
59
+ exports.useI18nextDocument = useI18nextDocument;
60
+ const useUpdateLocalization = () => (0, api_hooks_1.useOvokMutation)((client, params) => client.updateLocalization(params.language, params.key, params.body));
61
+ exports.useUpdateLocalization = useUpdateLocalization;
62
+ const useUpdateI18nextDocument = () => (0, api_hooks_1.useOvokMutation)((client, params) => client.updateI18nextDocument(params.language, params.document));
63
+ exports.useUpdateI18nextDocument = useUpdateI18nextDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",