@ovok/core 0.4.31 → 0.4.33
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/client/ai-fhir/methods/AIFhirResources.d.ts +2 -1
- package/dist/client/ai-fhir/methods/AIFhirResources.js +2 -2
- package/dist/client/auth/errors.d.ts +6 -0
- package/dist/client/auth/errors.js +12 -1
- package/dist/client/auth/methods/appleLogin.d.ts +2 -1
- package/dist/client/auth/methods/appleLogin.js +2 -2
- package/dist/client/auth/methods/changePassword.d.ts +2 -1
- package/dist/client/auth/methods/changePassword.js +2 -2
- package/dist/client/auth/methods/getSessions.d.ts +2 -1
- package/dist/client/auth/methods/getSessions.js +2 -2
- package/dist/client/auth/methods/googleLogin.d.ts +2 -1
- package/dist/client/auth/methods/googleLogin.js +2 -2
- package/dist/client/auth/methods/index.d.ts +1 -0
- package/dist/client/auth/methods/index.js +1 -0
- package/dist/client/auth/methods/login.d.ts +6 -2
- package/dist/client/auth/methods/login.js +60 -44
- package/dist/client/auth/methods/logout.d.ts +2 -1
- package/dist/client/auth/methods/logout.js +2 -2
- package/dist/client/auth/methods/refetchProfile.d.ts +2 -1
- package/dist/client/auth/methods/refetchProfile.js +3 -4
- package/dist/client/auth/methods/register.d.ts +2 -1
- package/dist/client/auth/methods/register.js +2 -2
- package/dist/client/auth/methods/registerPractitioner.d.ts +2 -1
- package/dist/client/auth/methods/registerPractitioner.js +2 -2
- package/dist/client/auth/methods/reloadSession.d.ts +7 -0
- package/dist/client/auth/methods/reloadSession.js +23 -0
- package/dist/client/auth/methods/requestDeleteUser.d.ts +2 -1
- package/dist/client/auth/methods/requestDeleteUser.js +5 -5
- package/dist/client/auth/methods/resetPassword.d.ts +2 -1
- package/dist/client/auth/methods/resetPassword.js +2 -2
- package/dist/client/auth/methods/revokeSessions.d.ts +2 -1
- package/dist/client/auth/methods/revokeSessions.js +2 -2
- package/dist/client/auth/methods/setPasswordFromReset.d.ts +2 -1
- package/dist/client/auth/methods/setPasswordFromReset.js +2 -2
- package/dist/client/auth/types/LoginBody.d.ts +10 -20
- package/dist/client/auth/types/LoginError.d.ts +15 -0
- package/dist/client/auth/types/LoginError.js +15 -0
- package/dist/client/bot/methods/executeBot.d.ts +2 -1
- package/dist/client/bot/methods/executeBot.js +2 -2
- package/dist/client/change-history/methods.d.ts +2 -1
- package/dist/client/change-history/methods.js +2 -2
- package/dist/client/chat/ai/methods/createAiSession.d.ts +2 -1
- package/dist/client/chat/ai/methods/createAiSession.js +2 -2
- package/dist/client/cms/methods.d.ts +6 -5
- package/dist/client/cms/methods.js +10 -10
- package/dist/client/consent/methods.d.ts +5 -4
- package/dist/client/consent/methods.js +8 -8
- package/dist/client/email/methods.d.ts +2 -1
- package/dist/client/email/methods.js +2 -2
- package/dist/client/errors/ovok-error-utils.d.ts +7 -0
- package/dist/client/errors/ovok-error-utils.js +49 -5
- package/dist/client/errors/ovok-error.d.ts +4 -0
- package/dist/client/errors/ovok-error.js +17 -4
- package/dist/client/errors/rate-limit-error.js +5 -3
- package/dist/client/experience/methods.d.ts +32 -31
- package/dist/client/experience/methods.js +62 -62
- package/dist/client/invites/methods.d.ts +6 -5
- package/dist/client/invites/methods.js +17 -11
- package/dist/client/notifications/methods.d.ts +6 -5
- package/dist/client/notifications/methods.js +10 -10
- package/dist/client/notifications/types.d.ts +92 -11
- package/dist/client/observation/methods/getLatestObservationsByCodes.d.ts +2 -1
- package/dist/client/observation/methods/getLatestObservationsByCodes.js +4 -4
- package/dist/client/offline/offline-measurement-queue.d.ts +10 -3
- package/dist/client/offline/offline-measurement-queue.js +44 -29
- package/dist/client/ovok-client.d.ts +17 -7
- package/dist/client/ovok-client.js +235 -43
- package/dist/client/patient/methods.d.ts +24 -23
- package/dist/client/patient/methods.js +49 -49
- package/dist/client/patient-sharing/methods.d.ts +7 -6
- package/dist/client/patient-sharing/methods.js +16 -12
- package/dist/client/platform/methods.d.ts +24 -23
- package/dist/client/platform/methods.js +46 -46
- package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +2 -2
- package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.js +2 -2
- package/dist/client/questionnaire-response/methods/populateQuestionnaire.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/populateQuestionnaire.js +2 -2
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +2 -2
- package/dist/client/signals/methods.d.ts +22 -21
- package/dist/client/signals/methods.js +42 -42
- package/dist/client/slim/methods.d.ts +93 -57
- package/dist/client/slim/methods.js +295 -108
- package/dist/client/slim/paging.d.ts +18 -0
- package/dist/client/slim/paging.js +57 -0
- package/dist/client/slim/types.d.ts +370 -3
- package/dist/conformance/api-requirements.js +22 -0
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/hooks/account-hooks.js +7 -7
- package/dist/hooks/api-hooks.d.ts +5 -2
- package/dist/hooks/api-hooks.js +39 -16
- package/dist/hooks/cms-hooks.js +3 -3
- package/dist/hooks/email-hooks.js +1 -1
- package/dist/hooks/experience-hooks.js +5 -5
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +5 -3
- package/dist/hooks/invites-hooks.js +7 -1
- package/dist/hooks/notification-ack-hooks.d.ts +2 -1
- package/dist/hooks/notification-hooks.d.ts +4 -2
- package/dist/hooks/notification-hooks.js +11 -23
- package/dist/hooks/notification-invalidation.d.ts +5 -2
- package/dist/hooks/notification-invalidation.js +10 -1
- package/dist/hooks/notification-note-hooks.js +3 -3
- package/dist/hooks/observation-hooks.d.ts +5 -1
- package/dist/hooks/observation-hooks.js +6 -6
- package/dist/hooks/patient-hooks.js +18 -18
- package/dist/hooks/patient-sharing-hooks.js +19 -5
- package/dist/hooks/platform-hooks.js +3 -3
- package/dist/hooks/poll-hooks.d.ts +14 -0
- package/dist/hooks/poll-hooks.js +127 -0
- package/dist/hooks/signals-alert-hooks.d.ts +5 -20
- package/dist/hooks/signals-alert-hooks.js +38 -34
- package/dist/hooks/signals-alert-item-hooks.d.ts +19 -0
- package/dist/hooks/signals-alert-item-hooks.js +62 -0
- package/dist/hooks/signals-hooks.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -1
- package/dist/utils/auth/exchange-code.d.ts +2 -0
- package/dist/utils/auth/exchange-code.js +2 -2
- package/dist/utils/auth/handle-tenant-code.d.ts +1 -1
- package/dist/utils/auth/handle-tenant-code.js +13 -4
- package/dist/utils/auth/start-login.d.ts +3 -1
- package/dist/utils/auth/start-login.js +3 -3
- package/package.json +1 -1
|
@@ -43,28 +43,28 @@ exports.useConsentSignature = useConsentSignature;
|
|
|
43
43
|
const useDocuments = (params = {}) => {
|
|
44
44
|
const client = (0, index_1.useClient)();
|
|
45
45
|
const serialized = JSON.stringify(params);
|
|
46
|
-
const load = React.useCallback(() => client.listDocuments(params), [client, serialized]);
|
|
46
|
+
const load = React.useCallback((signal) => client.listDocuments(params, { signal }), [client, serialized]);
|
|
47
47
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
48
48
|
};
|
|
49
49
|
exports.useDocuments = useDocuments;
|
|
50
50
|
const useContent = (type, language, params = {}) => {
|
|
51
51
|
const client = (0, index_1.useClient)();
|
|
52
52
|
const serialized = JSON.stringify(params);
|
|
53
|
-
const load = React.useCallback(() => client.searchContent(type, language, params), [client, language, serialized, type]);
|
|
53
|
+
const load = React.useCallback((signal) => client.searchContent(type, language, params, { signal }), [client, language, serialized, type]);
|
|
54
54
|
return (0, api_hooks_1.useOvokRequest)(load, type.length > 0 && language.length > 0);
|
|
55
55
|
};
|
|
56
56
|
exports.useContent = useContent;
|
|
57
57
|
const useVideoCallAppointments = (params = {}) => {
|
|
58
58
|
const client = (0, index_1.useClient)();
|
|
59
59
|
const serialized = JSON.stringify(params);
|
|
60
|
-
const load = React.useCallback(() => client.listVideoCallAppointments(params), [client, serialized]);
|
|
60
|
+
const load = React.useCallback((signal) => client.listVideoCallAppointments(params, { signal }), [client, serialized]);
|
|
61
61
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
62
62
|
};
|
|
63
63
|
exports.useVideoCallAppointments = useVideoCallAppointments;
|
|
64
64
|
const useVideoCallAccess = (appointmentId) => {
|
|
65
65
|
const client = (0, index_1.useClient)();
|
|
66
|
-
const load = React.useCallback(() => appointmentId
|
|
67
|
-
? client.getVideoCallAccessPermission(appointmentId)
|
|
66
|
+
const load = React.useCallback((signal) => appointmentId
|
|
67
|
+
? client.getVideoCallAccessPermission(appointmentId, { signal })
|
|
68
68
|
: Promise.reject(new Error("appointmentId is required")), [appointmentId, client]);
|
|
69
69
|
return (0, api_hooks_1.useOvokRequest)(load, appointmentId !== undefined);
|
|
70
70
|
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare const OvokProvider: (props: React.PropsWithChildren<{
|
|
|
8
8
|
export { observationsToMeasurements, useEcgRecording, useObservations, useSaveMeasurement, useUrineTests, } from "./observation-hooks";
|
|
9
9
|
export { useAdministeredProjects, useSlimDeviceTelemetry, useSlimDevices, useSlimNotifications, useSlimPatients, useCapabilityStatement, useOvokMutation, useOvokRequest, useProjectFeatures, useProjectSettings, usePublicApiEndpoints, useRecentSlimNotifications, } from "./api-hooks";
|
|
10
10
|
export type { OvokMutationState, OvokRequestState } from "./api-hooks";
|
|
11
|
+
export { useOvokPoll } from "./poll-hooks";
|
|
12
|
+
export type { OvokPollOptions, OvokPollState } from "./poll-hooks";
|
|
11
13
|
export { useConsentSignature, useContent, useCreateVideoCallAppointment, useCreateVideoCallUserAccess, useDocuments, useVideoCallAccess, useVideoCallAppointments, } from "./experience-hooks";
|
|
12
14
|
export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, useUpdateProjectTextSetting, } from "./platform-hooks";
|
|
13
15
|
export { useEmailTemplates } from "./email-hooks";
|
package/dist/hooks/index.js
CHANGED
|
@@ -34,9 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useEnableSignalsForPatient = exports.useAcknowledgeSignalsAlert = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = exports.usePatientSharingSettings = void 0;
|
|
37
|
+
exports.useSetLegalConsent = exports.useRepushUnconfirmedLimits = exports.useMedicalConsent = exports.useLegalConsent = exports.useChangeHistory = exports.useEmailTemplates = exports.useUpdateProjectTextSetting = 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.useOvokPoll = exports.useRecentSlimNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useSlimPatients = exports.useSlimNotifications = exports.useSlimDevices = exports.useSlimDeviceTelemetry = 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.useCreatePatientSharingInvite = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientQuestionnaires = exports.usePatientQuestionnaireResponses = exports.usePatientNotifications = exports.usePatientLatestObservations = exports.usePatientDashboard = exports.usePatientMeasurementHistory = exports.usePatientMeasurement = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientDevices = exports.usePatientCarePlans = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useInvitePractitioner = exports.useInvitePatient = exports.useAcceptInvite = exports.useTranslations = exports.useReleaseNotes = exports.useLegalPage = exports.useCmsDocuments = exports.useCmsDocument = exports.useAcknowledgeSlimMedicalNotification = exports.useAcknowledgeSlimAlarm = exports.useUpdateSignalsNote = exports.useUpdateNotificationNote = exports.useSignalsRawAlertNotes = exports.useSignalsAlertNotes = exports.useNotificationNotes = exports.useDeleteSignalsNote = exports.useDeleteNotificationNote = exports.useCreateSignalsRawAlertNote = exports.useCreateSignalsAlertNote = exports.useCreateNotificationNote = exports.useSlimOutOfBedNotifications = exports.useSlimMedicalNotifications = exports.useSlimAlarms = exports.useRecentOutOfBed = exports.useRecentAlarms = exports.useUpdateSlimThresholdV2 = exports.useUpdateSlimPatientThresholdV2 = exports.useUnconfirmedLimits = exports.useSlimThresholdV2 = exports.useSlimPatientThresholdV2 = exports.useSetMedicalConsent = void 0;
|
|
39
|
+
exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useEnableSignalsForPatient = exports.useAcknowledgeSignalsAlert = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = exports.usePatientSharingSettings = exports.usePatientSharing = void 0;
|
|
40
40
|
/*
|
|
41
41
|
* The only React-dependent module in the package.
|
|
42
42
|
*
|
|
@@ -91,6 +91,8 @@ Object.defineProperty(exports, "useProjectFeatures", { enumerable: true, get: fu
|
|
|
91
91
|
Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return api_hooks_1.useProjectSettings; } });
|
|
92
92
|
Object.defineProperty(exports, "usePublicApiEndpoints", { enumerable: true, get: function () { return api_hooks_1.usePublicApiEndpoints; } });
|
|
93
93
|
Object.defineProperty(exports, "useRecentSlimNotifications", { enumerable: true, get: function () { return api_hooks_1.useRecentSlimNotifications; } });
|
|
94
|
+
var poll_hooks_1 = require("./poll-hooks");
|
|
95
|
+
Object.defineProperty(exports, "useOvokPoll", { enumerable: true, get: function () { return poll_hooks_1.useOvokPoll; } });
|
|
94
96
|
var experience_hooks_1 = require("./experience-hooks");
|
|
95
97
|
Object.defineProperty(exports, "useConsentSignature", { enumerable: true, get: function () { return experience_hooks_1.useConsentSignature; } });
|
|
96
98
|
Object.defineProperty(exports, "useContent", { enumerable: true, get: function () { return experience_hooks_1.useContent; } });
|
|
@@ -3,9 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.useAcceptInvite = exports.useInvitePatient = exports.useInvitePractitioner = void 0;
|
|
5
5
|
const api_hooks_1 = require("./api-hooks");
|
|
6
|
+
const notification_invalidation_1 = require("./notification-invalidation");
|
|
6
7
|
const useInvitePractitioner = () => (0, api_hooks_1.useOvokMutation)((client, body) => client.invitePractitioner(body));
|
|
7
8
|
exports.useInvitePractitioner = useInvitePractitioner;
|
|
8
9
|
const useInvitePatient = () => (0, api_hooks_1.useOvokMutation)((client, body) => client.invitePatient(body));
|
|
9
10
|
exports.useInvitePatient = useInvitePatient;
|
|
10
|
-
const useAcceptInvite = () => (0, api_hooks_1.useOvokMutation)((client, body) =>
|
|
11
|
+
const useAcceptInvite = () => (0, api_hooks_1.useOvokMutation)(async (client, body) => {
|
|
12
|
+
const result = await client.acceptInvite(body);
|
|
13
|
+
client.invalidateUrl("/v1/patient-sharing/shares");
|
|
14
|
+
(0, notification_invalidation_1.notifyNotificationChanges)(client, { type: "patient-sharing" });
|
|
15
|
+
return result;
|
|
16
|
+
});
|
|
11
17
|
exports.useAcceptInvite = useAcceptInvite;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { SlimMedicalNotificationRow } from "../client/notifications/types";
|
|
1
2
|
import { SlimNotification } from "../client/slim/types";
|
|
2
3
|
import { OvokMutationState } from "./api-hooks";
|
|
3
4
|
/** Acknowledges one Slim alarm and updates matching mounted rows using the same client. */
|
|
4
5
|
export declare const useAcknowledgeSlimAlarm: () => OvokMutationState<string, SlimNotification>;
|
|
5
6
|
/** Acknowledges one medical notification and updates matching mounted rows using the same client. */
|
|
6
|
-
export declare const useAcknowledgeSlimMedicalNotification: () => OvokMutationState<string,
|
|
7
|
+
export declare const useAcknowledgeSlimMedicalNotification: () => OvokMutationState<string, SlimMedicalNotificationRow>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SlimAlarmQuery, SlimAlarmsPage, SlimMedicalNotificationsQuery,
|
|
1
|
+
import { SlimAlarmQuery, SlimAlarmsPage, SlimMedicalNotificationsQuery, SlimMedicalNotificationsCollection, SlimRecentAlarms, SlimRecentOutOfBed } from "../client/notifications";
|
|
2
2
|
import { SlimNotificationsQuery, SlimNotificationsResponse } from "../client/slim/types";
|
|
3
3
|
import { OvokRequestState } from "./api-hooks";
|
|
4
4
|
export declare const useSlimAlarms: (params?: SlimAlarmQuery) => OvokRequestState<SlimAlarmsPage>;
|
|
@@ -6,4 +6,6 @@ export declare const useRecentAlarms: (count?: number) => OvokRequestState<SlimR
|
|
|
6
6
|
export declare const useRecentOutOfBed: (count?: number) => OvokRequestState<SlimRecentOutOfBed>;
|
|
7
7
|
export declare const useSlimOutOfBedNotifications: (params?: Omit<SlimNotificationsQuery, "type">) => OvokRequestState<SlimNotificationsResponse>;
|
|
8
8
|
/** Fetches every cursor page; a short page is not treated as the end of the feed. */
|
|
9
|
-
export declare const useSlimMedicalNotifications: (params?: Omit<SlimMedicalNotificationsQuery, "cursor"
|
|
9
|
+
export declare const useSlimMedicalNotifications: (params?: Omit<SlimMedicalNotificationsQuery, "cursor">, options?: {
|
|
10
|
+
maxPages?: number;
|
|
11
|
+
}) => OvokRequestState<SlimMedicalNotificationsCollection>;
|
|
@@ -36,6 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.useSlimMedicalNotifications = exports.useSlimOutOfBedNotifications = exports.useRecentOutOfBed = exports.useRecentAlarms = exports.useSlimAlarms = void 0;
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
|
+
const paging_1 = require("../client/slim/paging");
|
|
39
40
|
const api_hooks_1 = require("./api-hooks");
|
|
40
41
|
const notification_invalidation_1 = require("./notification-invalidation");
|
|
41
42
|
const index_1 = require("./index");
|
|
@@ -43,7 +44,7 @@ const useSlimAlarms = (params = {}) => {
|
|
|
43
44
|
const client = (0, index_1.useClient)();
|
|
44
45
|
const serialized = JSON.stringify(params);
|
|
45
46
|
const [revision, setRevision] = React.useState(0);
|
|
46
|
-
const load = React.useCallback(() => client.listSlimAlarms(params), [client, serialized, revision]);
|
|
47
|
+
const load = React.useCallback((signal) => client.listSlimAlarms(params, { signal }), [client, serialized, revision]);
|
|
47
48
|
const { updateData, ...state } = (0, api_hooks_1.useOvokRequestWithUpdater)(load);
|
|
48
49
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
49
50
|
if (!change) {
|
|
@@ -61,7 +62,7 @@ const useSlimAlarms = (params = {}) => {
|
|
|
61
62
|
exports.useSlimAlarms = useSlimAlarms;
|
|
62
63
|
const useRecentAlarms = (count) => {
|
|
63
64
|
const client = (0, index_1.useClient)();
|
|
64
|
-
const load = React.useCallback(() => client.getRecentAlarms(count), [client, count]);
|
|
65
|
+
const load = React.useCallback((signal) => client.getRecentAlarms(count, { signal }), [client, count]);
|
|
65
66
|
const { updateData, ...state } = (0, api_hooks_1.useOvokRequestWithUpdater)(load);
|
|
66
67
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
67
68
|
if (!change) {
|
|
@@ -79,7 +80,7 @@ const useRecentAlarms = (count) => {
|
|
|
79
80
|
exports.useRecentAlarms = useRecentAlarms;
|
|
80
81
|
const useRecentOutOfBed = (count) => {
|
|
81
82
|
const client = (0, index_1.useClient)();
|
|
82
|
-
const load = React.useCallback(() => client.getRecentOutOfBed(count), [client, count]);
|
|
83
|
+
const load = React.useCallback((signal) => client.getRecentOutOfBed(count, { signal }), [client, count]);
|
|
83
84
|
const { updateData, ...state } = (0, api_hooks_1.useOvokRequestWithUpdater)(load);
|
|
84
85
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
85
86
|
if (!change) {
|
|
@@ -98,7 +99,7 @@ exports.useRecentOutOfBed = useRecentOutOfBed;
|
|
|
98
99
|
const useSlimOutOfBedNotifications = (params = {}) => {
|
|
99
100
|
const client = (0, index_1.useClient)();
|
|
100
101
|
const serialized = JSON.stringify(params);
|
|
101
|
-
const { updateData, ...state } = (0, api_hooks_1.useOvokRequestWithUpdater)(React.useCallback(() => client.listSlimOutOfBedNotifications(params), [client, serialized]));
|
|
102
|
+
const { updateData, ...state } = (0, api_hooks_1.useOvokRequestWithUpdater)(React.useCallback((signal) => client.listSlimOutOfBedNotifications(params, { signal }), [client, serialized]));
|
|
102
103
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
103
104
|
if (!change) {
|
|
104
105
|
state.reload();
|
|
@@ -114,27 +115,14 @@ const useSlimOutOfBedNotifications = (params = {}) => {
|
|
|
114
115
|
};
|
|
115
116
|
exports.useSlimOutOfBedNotifications = useSlimOutOfBedNotifications;
|
|
116
117
|
/** Fetches every cursor page; a short page is not treated as the end of the feed. */
|
|
117
|
-
const useSlimMedicalNotifications = (params = {}) => {
|
|
118
|
+
const useSlimMedicalNotifications = (params = {}, options = {}) => {
|
|
118
119
|
const client = (0, index_1.useClient)();
|
|
119
120
|
const serialized = JSON.stringify(params);
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
do {
|
|
126
|
-
const page = await client.listSlimMedicalNotifications({ ...params, cursor });
|
|
127
|
-
items.push(...page.items);
|
|
128
|
-
cursor = (_a = page.nextCursor) !== null && _a !== void 0 ? _a : undefined;
|
|
129
|
-
if (cursor && seen.has(cursor)) {
|
|
130
|
-
throw new Error("Medical notification paging returned a repeated cursor.");
|
|
131
|
-
}
|
|
132
|
-
if (cursor) {
|
|
133
|
-
seen.add(cursor);
|
|
134
|
-
}
|
|
135
|
-
} while (cursor !== undefined);
|
|
136
|
-
return { items, nextCursor: null };
|
|
137
|
-
}, [client, serialized]);
|
|
121
|
+
const serializedOptions = JSON.stringify(options);
|
|
122
|
+
const load = React.useCallback(async (signal) => {
|
|
123
|
+
const result = await (0, paging_1.iterateCursor)((cursor) => client.listSlimMedicalNotifications({ ...params, cursor }, { signal }), options);
|
|
124
|
+
return { items: result.rows, nextCursor: null, total: result.total, truncated: result.truncated };
|
|
125
|
+
}, [client, serialized, serializedOptions]);
|
|
138
126
|
const { updateData, ...state } = (0, api_hooks_1.useOvokRequestWithUpdater)(load);
|
|
139
127
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
140
128
|
if (!change) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { SlimMedicalNotificationRow } from "../client/notifications/types";
|
|
1
2
|
import { OvokClient } from "../client/ovok-client";
|
|
2
3
|
import { SignalsAlert, SignalsRawAlert } from "../client/signals/types";
|
|
3
4
|
import { SlimNotification } from "../client/slim/types";
|
|
4
5
|
export type NotificationChange = {
|
|
6
|
+
type: "patient-sharing";
|
|
7
|
+
} | {
|
|
5
8
|
type: "slim";
|
|
6
|
-
notification: SlimNotification;
|
|
9
|
+
notification: SlimNotification | SlimMedicalNotificationRow;
|
|
7
10
|
} | {
|
|
8
11
|
type: "signals-alert";
|
|
9
12
|
alert: SignalsAlert;
|
|
@@ -14,5 +17,5 @@ export type NotificationChange = {
|
|
|
14
17
|
type NotificationChangeListener = (change?: NotificationChange) => void;
|
|
15
18
|
export declare function subscribeToNotificationChanges(client: OvokClient, listener: NotificationChangeListener): () => void;
|
|
16
19
|
export declare function notifyNotificationChanges(client: OvokClient, change?: NotificationChange): void;
|
|
17
|
-
export declare function mergeSlimNotification<T extends object>(item: T, notification: SlimNotification): T;
|
|
20
|
+
export declare function mergeSlimNotification<T extends object>(item: T, notification: SlimNotification | SlimMedicalNotificationRow): T;
|
|
18
21
|
export {};
|
|
@@ -23,6 +23,15 @@ function notifyNotificationChanges(client, change) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
function mergeSlimNotification(item, notification) {
|
|
26
|
+
const medicalEpisode = notification.episode;
|
|
27
|
+
if (medicalEpisode && typeof medicalEpisode.id === "string") {
|
|
28
|
+
const episode = item.episode;
|
|
29
|
+
return (episode === null || episode === void 0 ? void 0 : episode.id) === medicalEpisode.id
|
|
30
|
+
? { ...item, ...notification }
|
|
31
|
+
: item;
|
|
32
|
+
}
|
|
26
33
|
const commId = item.commId;
|
|
27
|
-
return commId === notification.commId
|
|
34
|
+
return commId === notification.commId
|
|
35
|
+
? { ...item, ...notification }
|
|
36
|
+
: item;
|
|
28
37
|
}
|
|
@@ -42,7 +42,7 @@ const index_1 = require("./index");
|
|
|
42
42
|
const useNotificationNotes = (kind, id) => {
|
|
43
43
|
const client = (0, index_1.useClient)();
|
|
44
44
|
const [revision, setRevision] = React.useState(0);
|
|
45
|
-
const load = React.useCallback(() => (id ? client.listNotificationNotes(kind, id) : Promise.reject(new Error("id is required"))), [client, kind, id, revision]);
|
|
45
|
+
const load = React.useCallback((signal) => (id ? client.listNotificationNotes(kind, id, { signal }) : Promise.reject(new Error("id is required"))), [client, kind, id, revision]);
|
|
46
46
|
const state = (0, api_hooks_1.useOvokRequest)(load, id !== undefined);
|
|
47
47
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
48
48
|
if (!change) {
|
|
@@ -68,7 +68,7 @@ exports.useDeleteNotificationNote = useDeleteNotificationNote;
|
|
|
68
68
|
const useSignalsAlertNotes = (episodeId) => {
|
|
69
69
|
const client = (0, index_1.useClient)();
|
|
70
70
|
const [revision, setRevision] = React.useState(0);
|
|
71
|
-
const load = React.useCallback(() => (episodeId ? client.listSignalsAlertNotes(episodeId) : Promise.reject(new Error("episodeId is required"))), [client, episodeId, revision]);
|
|
71
|
+
const load = React.useCallback((signal) => (episodeId ? client.listSignalsAlertNotes(episodeId, { signal }) : Promise.reject(new Error("episodeId is required"))), [client, episodeId, revision]);
|
|
72
72
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
73
73
|
if (!change) {
|
|
74
74
|
setRevision((value) => value + 1);
|
|
@@ -80,7 +80,7 @@ exports.useSignalsAlertNotes = useSignalsAlertNotes;
|
|
|
80
80
|
const useSignalsRawAlertNotes = (alertId) => {
|
|
81
81
|
const client = (0, index_1.useClient)();
|
|
82
82
|
const [revision, setRevision] = React.useState(0);
|
|
83
|
-
const load = React.useCallback(() => (alertId ? client.listSignalsRawAlertNotes(alertId) : Promise.reject(new Error("alertId is required"))), [client, alertId, revision]);
|
|
83
|
+
const load = React.useCallback((signal) => (alertId ? client.listSignalsRawAlertNotes(alertId, { signal }) : Promise.reject(new Error("alertId is required"))), [client, alertId, revision]);
|
|
84
84
|
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
85
85
|
if (!change) {
|
|
86
86
|
setRevision((value) => value + 1);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Observation } from "@medplum/fhirtypes";
|
|
2
2
|
import type { ObservationsToMeasurementsOptions } from "../client/observation/methods/observationsToMeasurements";
|
|
3
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
3
4
|
import { observationsToMeasurements, SupportedMeasurement } from "../client/observation/methods/observationsToMeasurements";
|
|
4
5
|
import { GenerateObservationBodyParams } from "../client/observation/types/generate-observation-body/GenerateObservationBodyParams";
|
|
5
6
|
import { OvokClient } from "../client/ovok-client";
|
|
@@ -31,11 +32,14 @@ export declare const useObservations: <T extends readonly SupportedType[]>({ typ
|
|
|
31
32
|
observations: readonly Observation[];
|
|
32
33
|
refetch: () => void;
|
|
33
34
|
};
|
|
34
|
-
export declare const useSaveMeasurement: () => ((params: GenerateObservationBodyParams) => Promise<Awaited<ReturnType<OvokClient["saveMeasurement"]>>>);
|
|
35
|
+
export declare const useSaveMeasurement: () => ((params: GenerateObservationBodyParams, requestOptions?: MedplumRequestOptions) => Promise<Awaited<ReturnType<OvokClient["saveMeasurement"]>>>);
|
|
35
36
|
export declare const useEcgRecording: (id?: string) => {
|
|
36
37
|
recording: import("../types").EcgMeasurement;
|
|
37
38
|
measurements: import("@medplum/core").WithId<Observation>[];
|
|
39
|
+
dataUpdatedAt: number | undefined;
|
|
38
40
|
loading: boolean;
|
|
41
|
+
isRefreshing: boolean;
|
|
42
|
+
isStale: boolean;
|
|
39
43
|
error: Error | undefined;
|
|
40
44
|
reload: () => void;
|
|
41
45
|
};
|
|
@@ -58,7 +58,7 @@ const useObservations = ({ types, period, patientId, id, groupBy, timeToleranceM
|
|
|
58
58
|
: []),
|
|
59
59
|
], [codes, count, elements, id, patientId, period === null || period === void 0 ? void 0 : period.end, period === null || period === void 0 ? void 0 : period.start, sort]);
|
|
60
60
|
const client = (0, index_1.useClient)();
|
|
61
|
-
const load = React.useCallback(() => client.searchResources("Observation", query), [client, query]);
|
|
61
|
+
const load = React.useCallback((signal) => client.searchResources("Observation", query, { signal }), [client, query]);
|
|
62
62
|
const { data: observations = [], reload: refetch, loading, error } = (0, api_hooks_1.useOvokRequest)(load);
|
|
63
63
|
const measurements = React.useMemo(() => (0, observationsToMeasurements_1.observationsToMeasurements)(observations, types, { groupBy, timeToleranceMs }), [groupBy, observations, timeToleranceMs, types]);
|
|
64
64
|
return {
|
|
@@ -72,22 +72,22 @@ const useObservations = ({ types, period, patientId, id, groupBy, timeToleranceM
|
|
|
72
72
|
exports.useObservations = useObservations;
|
|
73
73
|
const useSaveMeasurement = () => {
|
|
74
74
|
const client = (0, index_1.useClient)();
|
|
75
|
-
return React.useCallback((params) => client.saveMeasurement(params), [client]);
|
|
75
|
+
return React.useCallback((params, requestOptions) => client.saveMeasurement(params, requestOptions), [client]);
|
|
76
76
|
};
|
|
77
77
|
exports.useSaveMeasurement = useSaveMeasurement;
|
|
78
78
|
const useEcgRecording = (id) => {
|
|
79
79
|
const client = (0, index_1.useClient)();
|
|
80
|
-
const load = React.useCallback(async () => {
|
|
80
|
+
const load = React.useCallback(async (signal) => {
|
|
81
81
|
const query = {
|
|
82
82
|
code: (0, observationsToMeasurements_1.observationCodesForTypes)([types_1.MeasurementTypeKey.ecg]),
|
|
83
83
|
_elements: "id,effectivePeriod,code,device,component,interpretation,valueSampledData,hasMember",
|
|
84
84
|
};
|
|
85
85
|
if (!id) {
|
|
86
|
-
return client.searchResources("Observation", query);
|
|
86
|
+
return client.searchResources("Observation", query, { signal });
|
|
87
87
|
}
|
|
88
88
|
const [root, members] = await Promise.all([
|
|
89
|
-
client.searchResources("Observation", { ...query, _id: id }),
|
|
90
|
-
client.searchResources("Observation", { ...query, "has-member": `Observation/${id}` }),
|
|
89
|
+
client.searchResources("Observation", { ...query, _id: id }, { signal }),
|
|
90
|
+
client.searchResources("Observation", { ...query, "has-member": `Observation/${id}` }, { signal }),
|
|
91
91
|
]);
|
|
92
92
|
return [...root, ...members];
|
|
93
93
|
}, [client, id]);
|
|
@@ -40,28 +40,28 @@ const api_hooks_1 = require("./api-hooks");
|
|
|
40
40
|
const index_1 = require("./index");
|
|
41
41
|
const useCurrentPatientProfile = () => {
|
|
42
42
|
const client = (0, index_1.useClient)();
|
|
43
|
-
const load = React.useCallback(() => client.getCurrentPatientProfile(), [client]);
|
|
43
|
+
const load = React.useCallback((signal) => client.getCurrentPatientProfile({ signal }), [client]);
|
|
44
44
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
45
45
|
};
|
|
46
46
|
exports.useCurrentPatientProfile = useCurrentPatientProfile;
|
|
47
47
|
const usePatientDashboard = (params = {}) => {
|
|
48
48
|
const client = (0, index_1.useClient)();
|
|
49
49
|
const serialized = JSON.stringify(params);
|
|
50
|
-
const load = React.useCallback(() => client.getPatientDashboard(params), [client, serialized]);
|
|
50
|
+
const load = React.useCallback((signal) => client.getPatientDashboard(params, { signal }), [client, serialized]);
|
|
51
51
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
52
52
|
};
|
|
53
53
|
exports.usePatientDashboard = usePatientDashboard;
|
|
54
54
|
const usePatientLatestObservations = (params = {}) => {
|
|
55
55
|
const client = (0, index_1.useClient)();
|
|
56
56
|
const serialized = JSON.stringify(params);
|
|
57
|
-
const load = React.useCallback(() => client.getPatientLatestObservations(params), [client, serialized]);
|
|
57
|
+
const load = React.useCallback((signal) => client.getPatientLatestObservations(params, { signal }), [client, serialized]);
|
|
58
58
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
59
59
|
};
|
|
60
60
|
exports.usePatientLatestObservations = usePatientLatestObservations;
|
|
61
61
|
const usePatientDeviceTelemetry = (deviceId) => {
|
|
62
62
|
const client = (0, index_1.useClient)();
|
|
63
|
-
const load = React.useCallback(() => deviceId
|
|
64
|
-
? client.getPatientDeviceTelemetry(deviceId)
|
|
63
|
+
const load = React.useCallback((signal) => deviceId
|
|
64
|
+
? client.getPatientDeviceTelemetry(deviceId, { signal })
|
|
65
65
|
: Promise.reject(new Error("deviceId is required")), [client, deviceId]);
|
|
66
66
|
return (0, api_hooks_1.useOvokRequest)(load, deviceId !== undefined);
|
|
67
67
|
};
|
|
@@ -69,8 +69,8 @@ exports.usePatientDeviceTelemetry = usePatientDeviceTelemetry;
|
|
|
69
69
|
const usePatientDeviceTelemetryHistory = (deviceId, params = {}) => {
|
|
70
70
|
const client = (0, index_1.useClient)();
|
|
71
71
|
const serialized = JSON.stringify(params);
|
|
72
|
-
const load = React.useCallback(() => deviceId
|
|
73
|
-
? client.getPatientDeviceTelemetryHistory(deviceId, params)
|
|
72
|
+
const load = React.useCallback((signal) => deviceId
|
|
73
|
+
? client.getPatientDeviceTelemetryHistory(deviceId, params, { signal })
|
|
74
74
|
: Promise.reject(new Error("deviceId is required")), [client, deviceId, serialized]);
|
|
75
75
|
return (0, api_hooks_1.useOvokRequest)(load, deviceId !== undefined);
|
|
76
76
|
};
|
|
@@ -78,35 +78,35 @@ exports.usePatientDeviceTelemetryHistory = usePatientDeviceTelemetryHistory;
|
|
|
78
78
|
const usePatientAppointments = (params = {}) => {
|
|
79
79
|
const client = (0, index_1.useClient)();
|
|
80
80
|
const serialized = JSON.stringify(params);
|
|
81
|
-
const load = React.useCallback(() => client.listPatientAppointments(params), [client, serialized]);
|
|
81
|
+
const load = React.useCallback((signal) => client.listPatientAppointments(params, { signal }), [client, serialized]);
|
|
82
82
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
83
83
|
};
|
|
84
84
|
exports.usePatientAppointments = usePatientAppointments;
|
|
85
85
|
const usePatientSchedules = (params = {}) => {
|
|
86
86
|
const client = (0, index_1.useClient)();
|
|
87
87
|
const serialized = JSON.stringify(params);
|
|
88
|
-
const load = React.useCallback(() => client.listPatientSchedules(params), [client, serialized]);
|
|
88
|
+
const load = React.useCallback((signal) => client.listPatientSchedules(params, { signal }), [client, serialized]);
|
|
89
89
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
90
90
|
};
|
|
91
91
|
exports.usePatientSchedules = usePatientSchedules;
|
|
92
92
|
const usePatientSlots = (params = {}) => {
|
|
93
93
|
const client = (0, index_1.useClient)();
|
|
94
94
|
const serialized = JSON.stringify(params);
|
|
95
|
-
const load = React.useCallback(() => client.listPatientSlots(params), [client, serialized]);
|
|
95
|
+
const load = React.useCallback((signal) => client.listPatientSlots(params, { signal }), [client, serialized]);
|
|
96
96
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
97
97
|
};
|
|
98
98
|
exports.usePatientSlots = usePatientSlots;
|
|
99
99
|
const usePatientMeasurementHistory = (params = {}) => {
|
|
100
100
|
const client = (0, index_1.useClient)();
|
|
101
101
|
const serialized = JSON.stringify(params);
|
|
102
|
-
const load = React.useCallback(() => client.listPatientMeasurementHistory(params), [client, serialized]);
|
|
102
|
+
const load = React.useCallback((signal) => client.listPatientMeasurementHistory(params, { signal }), [client, serialized]);
|
|
103
103
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
104
104
|
};
|
|
105
105
|
exports.usePatientMeasurementHistory = usePatientMeasurementHistory;
|
|
106
106
|
const usePatientMeasurement = (measurementId) => {
|
|
107
107
|
const client = (0, index_1.useClient)();
|
|
108
|
-
const load = React.useCallback(() => measurementId
|
|
109
|
-
? client.getPatientMeasurement(measurementId)
|
|
108
|
+
const load = React.useCallback((signal) => measurementId
|
|
109
|
+
? client.getPatientMeasurement(measurementId, { signal })
|
|
110
110
|
: Promise.reject(new Error("measurementId is required")), [client, measurementId]);
|
|
111
111
|
return (0, api_hooks_1.useOvokRequest)(load, measurementId !== undefined);
|
|
112
112
|
};
|
|
@@ -114,35 +114,35 @@ exports.usePatientMeasurement = usePatientMeasurement;
|
|
|
114
114
|
const usePatientCarePlans = (params = {}) => {
|
|
115
115
|
const client = (0, index_1.useClient)();
|
|
116
116
|
const serialized = JSON.stringify(params);
|
|
117
|
-
const load = React.useCallback(() => client.listPatientCarePlans(params), [client, serialized]);
|
|
117
|
+
const load = React.useCallback((signal) => client.listPatientCarePlans(params, { signal }), [client, serialized]);
|
|
118
118
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
119
119
|
};
|
|
120
120
|
exports.usePatientCarePlans = usePatientCarePlans;
|
|
121
121
|
const usePatientQuestionnaires = (params = {}) => {
|
|
122
122
|
const client = (0, index_1.useClient)();
|
|
123
123
|
const serialized = JSON.stringify(params);
|
|
124
|
-
const load = React.useCallback(() => client.listPatientQuestionnaires(params), [client, serialized]);
|
|
124
|
+
const load = React.useCallback((signal) => client.listPatientQuestionnaires(params, { signal }), [client, serialized]);
|
|
125
125
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
126
126
|
};
|
|
127
127
|
exports.usePatientQuestionnaires = usePatientQuestionnaires;
|
|
128
128
|
const usePatientQuestionnaireResponses = (params = {}) => {
|
|
129
129
|
const client = (0, index_1.useClient)();
|
|
130
130
|
const serialized = JSON.stringify(params);
|
|
131
|
-
const load = React.useCallback(() => client.listPatientQuestionnaireResponses(params), [client, serialized]);
|
|
131
|
+
const load = React.useCallback((signal) => client.listPatientQuestionnaireResponses(params, { signal }), [client, serialized]);
|
|
132
132
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
133
133
|
};
|
|
134
134
|
exports.usePatientQuestionnaireResponses = usePatientQuestionnaireResponses;
|
|
135
135
|
const usePatientDevices = (params = {}) => {
|
|
136
136
|
const client = (0, index_1.useClient)();
|
|
137
137
|
const serialized = JSON.stringify(params);
|
|
138
|
-
const load = React.useCallback(() => client.listPatientDevices(params), [client, serialized]);
|
|
138
|
+
const load = React.useCallback((signal) => client.listPatientDevices(params, { signal }), [client, serialized]);
|
|
139
139
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
140
140
|
};
|
|
141
141
|
exports.usePatientDevices = usePatientDevices;
|
|
142
142
|
const usePatientNotifications = (params = {}) => {
|
|
143
143
|
const client = (0, index_1.useClient)();
|
|
144
144
|
const serialized = JSON.stringify(params);
|
|
145
|
-
const load = React.useCallback(() => client.listPatientNotifications(params), [client, serialized]);
|
|
145
|
+
const load = React.useCallback((signal) => client.listPatientNotifications(params, { signal }), [client, serialized]);
|
|
146
146
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
147
147
|
};
|
|
148
148
|
exports.usePatientNotifications = usePatientNotifications;
|
|
@@ -37,22 +37,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.useUpdatePatientSharingSettings = exports.usePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = exports.useCreatePatientSharingInvite = exports.usePatientSharing = void 0;
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
39
|
const api_hooks_1 = require("./api-hooks");
|
|
40
|
+
const notification_invalidation_1 = require("./notification-invalidation");
|
|
40
41
|
const index_1 = require("./index");
|
|
41
42
|
const usePatientSharing = () => {
|
|
42
43
|
const client = (0, index_1.useClient)();
|
|
43
|
-
const load = React.useCallback(() => client.listPatientSharing(), [client]);
|
|
44
|
-
|
|
44
|
+
const load = React.useCallback((signal) => client.listPatientSharing({ signal }), [client]);
|
|
45
|
+
const state = (0, api_hooks_1.useOvokRequestWithUpdater)(load);
|
|
46
|
+
React.useEffect(() => (0, notification_invalidation_1.subscribeToNotificationChanges)(client, (change) => {
|
|
47
|
+
if ((change === null || change === void 0 ? void 0 : change.type) === "patient-sharing") {
|
|
48
|
+
state.reload();
|
|
49
|
+
}
|
|
50
|
+
}), [client, state.reload]);
|
|
51
|
+
return state;
|
|
45
52
|
};
|
|
46
53
|
exports.usePatientSharing = usePatientSharing;
|
|
47
54
|
const useCreatePatientSharingInvite = () => (0, api_hooks_1.useOvokMutation)((client, params) => client.createPatientSharingInvite(params));
|
|
48
55
|
exports.useCreatePatientSharingInvite = useCreatePatientSharingInvite;
|
|
49
|
-
const useRedeemPatientSharingInvite = () => (0, api_hooks_1.useOvokMutation)((client, params) =>
|
|
56
|
+
const useRedeemPatientSharingInvite = () => (0, api_hooks_1.useOvokMutation)(async (client, params) => {
|
|
57
|
+
const share = await client.redeemPatientSharingInvite(params);
|
|
58
|
+
(0, notification_invalidation_1.notifyNotificationChanges)(client, { type: "patient-sharing" });
|
|
59
|
+
return share;
|
|
60
|
+
});
|
|
50
61
|
exports.useRedeemPatientSharingInvite = useRedeemPatientSharingInvite;
|
|
51
|
-
const useRevokePatientSharing = () => (0, api_hooks_1.useOvokMutation)((client, consentId) =>
|
|
62
|
+
const useRevokePatientSharing = () => (0, api_hooks_1.useOvokMutation)(async (client, consentId) => {
|
|
63
|
+
await client.revokePatientSharing(consentId);
|
|
64
|
+
(0, notification_invalidation_1.notifyNotificationChanges)(client, { type: "patient-sharing" });
|
|
65
|
+
});
|
|
52
66
|
exports.useRevokePatientSharing = useRevokePatientSharing;
|
|
53
67
|
const usePatientSharingSettings = () => {
|
|
54
68
|
const client = (0, index_1.useClient)();
|
|
55
|
-
const load = React.useCallback(() => client.getPatientSharingSettings(), [client]);
|
|
69
|
+
const load = React.useCallback((signal) => client.getPatientSharingSettings({ signal }), [client]);
|
|
56
70
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
57
71
|
};
|
|
58
72
|
exports.usePatientSharingSettings = usePatientSharingSettings;
|
|
@@ -40,20 +40,20 @@ const api_hooks_1 = require("./api-hooks");
|
|
|
40
40
|
const index_1 = require("./index");
|
|
41
41
|
const useLocales = () => {
|
|
42
42
|
const client = (0, index_1.useClient)();
|
|
43
|
-
const load = React.useCallback(() => client.getLocales(), [client]);
|
|
43
|
+
const load = React.useCallback((signal) => client.getLocales({ signal }), [client]);
|
|
44
44
|
return (0, api_hooks_1.useOvokRequest)(load);
|
|
45
45
|
};
|
|
46
46
|
exports.useLocales = useLocales;
|
|
47
47
|
const useLocalizations = (language, params = {}) => {
|
|
48
48
|
const client = (0, index_1.useClient)();
|
|
49
49
|
const serialized = JSON.stringify(params);
|
|
50
|
-
const load = React.useCallback(() => client.listLocalizations(language, params), [client, language, serialized]);
|
|
50
|
+
const load = React.useCallback((signal) => client.listLocalizations(language, params, { signal }), [client, language, serialized]);
|
|
51
51
|
return (0, api_hooks_1.useOvokRequest)(load, language.length > 0);
|
|
52
52
|
};
|
|
53
53
|
exports.useLocalizations = useLocalizations;
|
|
54
54
|
const useI18nextDocument = (language) => {
|
|
55
55
|
const client = (0, index_1.useClient)();
|
|
56
|
-
const load = React.useCallback(() => client.getI18nextDocument(language), [client, language]);
|
|
56
|
+
const load = React.useCallback((signal) => client.getI18nextDocument(language, { signal }), [client, language]);
|
|
57
57
|
return (0, api_hooks_1.useOvokRequest)(load, language.length > 0);
|
|
58
58
|
};
|
|
59
59
|
exports.useI18nextDocument = useI18nextDocument;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type OvokPollOptions = {
|
|
2
|
+
intervalMs: number;
|
|
3
|
+
whenHidden?: boolean;
|
|
4
|
+
backoff?: boolean;
|
|
5
|
+
honorRetryAfter?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type OvokPollState<T> = {
|
|
8
|
+
data: T | undefined;
|
|
9
|
+
error: Error | undefined;
|
|
10
|
+
lastSuccessAt: number | undefined;
|
|
11
|
+
reload: () => void;
|
|
12
|
+
};
|
|
13
|
+
/** Polls after each completed request, pausing hidden tabs and aborting replaced work. */
|
|
14
|
+
export declare function useOvokPoll<T>(load: (signal: AbortSignal) => Promise<T>, options: OvokPollOptions): OvokPollState<T>;
|