@ovok/core 0.3.14 → 0.3.15
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 +6 -3
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/hooks/experience-hooks.d.ts +13 -0
- package/dist/hooks/experience-hooks.js +75 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +16 -1
- package/dist/hooks/platform-hooks.d.ts +17 -0
- package/dist/hooks/platform-hooks.js +63 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -185,9 +185,9 @@ download elements; the backend remains responsible for authorization and signed
|
|
|
185
185
|
## React hooks
|
|
186
186
|
|
|
187
187
|
The package exports additive hooks for capability discovery, project configuration, patient profile
|
|
188
|
-
and health data, questionnaires, scheduling resources, CareHub lists, telemetry,
|
|
189
|
-
Every request hook returns `data`,
|
|
190
|
-
`data`, `loading`, `error`, `mutate`, and `reset`.
|
|
188
|
+
and health data, questionnaires, scheduling resources, CareHub lists, telemetry, notifications,
|
|
189
|
+
documents, content, video consultations, and localization. Every request hook returns `data`,
|
|
190
|
+
`loading`, `error`, and `reload`; mutations expose `data`, `loading`, `error`, `mutate`, and `reset`.
|
|
191
191
|
|
|
192
192
|
```tsx
|
|
193
193
|
const { data: patients, loading, error } = useCarehubPatients({
|
|
@@ -201,6 +201,9 @@ const saveSettings = useOvokMutation((client, settings: OvokProjectSettings) =>
|
|
|
201
201
|
const { data: me } = useCurrentPatientProfile();
|
|
202
202
|
const { data: appointments } = usePatientAppointments({ status: "booked" });
|
|
203
203
|
const populateQuestionnaire = usePopulateQuestionnaire();
|
|
204
|
+
const { data: articles } = useContent("blog", "en-US", { _count: 10 });
|
|
205
|
+
const { data: calls } = useVideoCallAppointments();
|
|
206
|
+
const { data: translations } = useLocalizations("en-US");
|
|
204
207
|
```
|
|
205
208
|
|
|
206
209
|
Hooks are additive to the existing `OvokProvider`, observation hooks, auth methods, and offline
|
|
@@ -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.
|
|
51
|
+
version: "0.3.15",
|
|
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;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -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 { useConsentSignature, useContent, useCreateVideoCallAppointment, useCreateVideoCallUserAccess, useDocuments, useVideoCallAccess, useVideoCallAppointments, } from "./experience-hooks";
|
|
11
|
+
export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, } from "./platform-hooks";
|
|
10
12
|
export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientCarePlans, usePatientDevices, usePatientDeviceTelemetry, usePatientDeviceTelemetryHistory, usePatientMeasurement, usePatientMeasurementHistory, usePatientLatestObservations, usePatientNotifications, usePatientQuestionnaireResponses, usePatientQuestionnaires, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-hooks";
|
package/dist/hooks/index.js
CHANGED
|
@@ -34,7 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.
|
|
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.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; } });
|
|
@@ -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;
|