@medplum/react-hooks 5.1.24 → 5.1.27

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.
@@ -8,11 +8,18 @@ import type { ExtractResource } from '@medplum/fhirtypes';
8
8
  import type { Identifier } from '@medplum/fhirtypes';
9
9
  import type { JSX } from 'react';
10
10
  import type { Medication } from '@medplum/fhirtypes';
11
+ import type { MedicationCartClearRequest } from '@medplum/core';
12
+ import type { MedicationCartManageResponse } from '@medplum/core';
13
+ import type { MedicationCartRemoveRequest } from '@medplum/core';
14
+ import type { MedicationCheckoutRequest } from '@medplum/core';
15
+ import type { MedicationCheckoutResponse } from '@medplum/core';
11
16
  import type { MedicationOrderRequest } from '@medplum/core';
12
17
  import type { MedicationOrderResponse } from '@medplum/core';
18
+ import type { MedicationRequest } from '@medplum/fhirtypes';
13
19
  import type { MedicationSearchParams } from '@medplum/core';
14
20
  import type { MedplumClient } from '@medplum/core';
15
21
  import type { OperationOutcome } from '@medplum/fhirtypes';
22
+ import type { OrderSetSyncResponse } from '@medplum/core';
16
23
  import type { Organization } from '@medplum/fhirtypes';
17
24
  import type { Patient } from '@medplum/fhirtypes';
18
25
  import type { PharmacySearchParams } from '@medplum/core';
@@ -30,6 +37,7 @@ import type { ReactNode } from 'react';
30
37
  import type { Reference } from '@medplum/fhirtypes';
31
38
  import type { Resource } from '@medplum/fhirtypes';
32
39
  import type { ResourceArray } from '@medplum/core';
40
+ import type { ResourceModifiedEvent } from '@medplum/core';
33
41
  import type { ResourceType } from '@medplum/fhirtypes';
34
42
  import type { SearchRequest } from '@medplum/core';
35
43
  import type { Signature } from '@medplum/fhirtypes';
@@ -106,8 +114,22 @@ export declare function isChoiceQuestion(item: QuestionnaireItem): boolean;
106
114
  */
107
115
  export declare function isQuestionEnabled(item: QuestionnaireItem, questionnaireResponse: QuestionnaireResponse | undefined): boolean;
108
116
 
117
+ /**
118
+ * Returns true if an error thrown while expanding a ValueSet means the value set itself is
119
+ * unavailable — a permanent 400/404 (e.g. "ValueSet not found"). Transient failures (429 rate
120
+ * limit, 401, 5xx, network) return false so a blip never disables a field.
121
+ * @param err - The error thrown by `valueSetExpand`.
122
+ * @returns True for a permanent 400/404, false for a transient failure.
123
+ */
124
+ export declare function isValueSetUnavailableError(err: unknown): boolean;
125
+
126
+ /** Thrown by {@link UseMedicationCartReturn.checkout} when an {@link UseMedicationCartReturn.addToCart} call is still in flight. */
127
+ export declare const MEDICATION_CART_ADD_IN_PROGRESS = "Cannot checkout while a medication is still being added to the cart";
128
+
109
129
  export declare interface MedicationIFrameOptions {
110
130
  readonly patientId?: string;
131
+ /** Selected practice location for multi-practice deployments. */
132
+ readonly organization?: Reference<Organization>;
111
133
  readonly onPatientSyncSuccess?: () => void;
112
134
  readonly onIframeSuccess?: (url: string) => void;
113
135
  readonly onError?: (err: unknown) => void;
@@ -296,6 +318,53 @@ export declare function typedValueToResponseItem(item: QuestionnaireItem, value:
296
318
 
297
319
  export declare const useCachedBinaryUrl: (binaryUrl: string | undefined) => string | undefined;
298
320
 
321
+ /**
322
+ * Vendor-neutral hook for the full **medication cart** lifecycle: add a draft
323
+ * line (`createResource`), check out a set of drafts into the vendor's batch
324
+ * approval queue (`$checkout-medications`), and remove/clear cart lines
325
+ * (`$remove-cart-medication` / `$clear-cart`).
326
+ *
327
+ * Cart checkout / remove / clear hit project-scoped **FHIR custom operations**
328
+ * whose backing Bot is chosen at deploy time via an `OperationDefinition`
329
+ * carrying the `operationDefinition-implementation` extension — see
330
+ * [bot operations docs](https://www.medplum.com/docs/bots/custom-fhir-operations).
331
+ * The server's `tryCustomOperation` dispatch handles the OD → Bot lookup, so
332
+ * projects swap vendors by deploying a different bot under the same code.
333
+ *
334
+ * `addToCart` is plain FHIR `createResource` (no `$add-cart` operation): the
335
+ * Medplum-side cart is the set of draft `MedicationRequest`s. Vendor staging
336
+ * (e.g. ScriptSure MedCart) happens at checkout. Vendors without a batch
337
+ * approval queue (e.g. DoseSpot iframe-first) simply never call `checkout` /
338
+ * `removeFromCart` / `clearCart`.
339
+ *
340
+ * Requests for the custom operations are encoded as `Parameters` bodies and
341
+ * decoded by the matching `@medplum/core` helpers. Per-line outcomes arrive in
342
+ * `response.items`.
343
+ *
344
+ * @returns Cart add / checkout / remove / clear callbacks plus `adding` state.
345
+ */
346
+ export declare function useMedicationCart(): UseMedicationCartReturn;
347
+
348
+ export declare interface UseMedicationCartReturn {
349
+ /**
350
+ * Persist a draft `MedicationRequest` as a cart line via plain FHIR
351
+ * `createResource` (no custom operation). Vendor staging happens later at
352
+ * {@link UseMedicationCartReturn.checkout}.
353
+ */
354
+ addToCart: (medicationRequest: MedicationRequest) => Promise<MedicationRequest>;
355
+ /** True while one or more {@link UseMedicationCartReturn.addToCart} calls are in flight. */
356
+ adding: boolean;
357
+ /**
358
+ * Submit draft cart lines to the vendor's batch approval queue and return an
359
+ * embeddable approval-widget URL. Refuses while {@link UseMedicationCartReturn.adding} is true.
360
+ */
361
+ checkout: (input: MedicationCheckoutRequest) => Promise<MedicationCheckoutResponse>;
362
+ /** Remove a single draft `MedicationRequest` from the patient's vendor cart. */
363
+ removeFromCart: (input: MedicationCartRemoveRequest) => Promise<MedicationCartManageResponse>;
364
+ /** Remove every item from the patient's vendor cart. */
365
+ clearCart: (input: MedicationCartClearRequest) => Promise<MedicationCartManageResponse>;
366
+ }
367
+
299
368
  /**
300
369
  * Generic React hook that syncs a patient to a medication-order vendor and
301
370
  * returns the chart iframe URL.
@@ -379,6 +448,8 @@ export declare interface UseMedicationOrderSetOptions {
379
448
  /** Vendor-side order set id, when picked directly (escape hatch when no synced PD exists yet). */
380
449
  readonly vendorOrderSetId?: number | string;
381
450
  readonly appId?: string;
451
+ /** Selected practice location for multi-practice deployments. */
452
+ readonly organization?: Reference<Organization>;
382
453
  }
383
454
 
384
455
  export declare interface UseMedicationOrderSetReturn {
@@ -461,14 +532,18 @@ export declare function usePatientSummaryData(patient: Patient | Reference<Patie
461
532
  * Encapsulates calls to a search-pharmacy bot and an add-patient-pharmacy bot,
462
533
  * and can be composed with the generic `PharmacyDialog` component from `@medplum/react`.
463
534
  *
535
+ * The search param type is generic so vendor hooks can widen it with their own
536
+ * filters (e.g. ScriptSure `specialties`); the extra keys are passed through to
537
+ * the bot as-is at runtime.
538
+ *
464
539
  * @param searchBotIdentifier - Bot identifier for the pharmacy search bot.
465
540
  * @param addPharmacyBotIdentifier - Bot identifier for the add-patient-pharmacy bot.
466
541
  * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.
467
542
  */
468
- export declare function usePharmacySearch(searchBotIdentifier: Identifier, addPharmacyBotIdentifier: Identifier): UsePharmacySearchReturn;
543
+ export declare function usePharmacySearch<T extends PharmacySearchParams = PharmacySearchParams>(searchBotIdentifier: Identifier, addPharmacyBotIdentifier: Identifier): UsePharmacySearchReturn<T>;
469
544
 
470
- export declare interface UsePharmacySearchReturn {
471
- searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;
545
+ export declare interface UsePharmacySearchReturn<T extends PharmacySearchParams = PharmacySearchParams> {
546
+ searchPharmacies: (params: T) => Promise<Organization[]>;
472
547
  addToFavorites: (params: AddFavoriteParams) => Promise<AddPharmacyResponse>;
473
548
  }
474
549
 
@@ -538,6 +613,30 @@ export declare interface UseResourceBoardResult<T extends Resource = Resource> {
538
613
  readonly refresh: () => Promise<void>;
539
614
  }
540
615
 
616
+ /**
617
+ * React hook for observing FHIR resource modifications made through the Medplum client.
618
+ *
619
+ * The callback is invoked whenever this client instance creates, updates, patches, or deletes
620
+ * a resource of one of the given types, including modifications announced with
621
+ * `MedplumClient.notifyResourceModified`. Use it to keep local component state in sync with
622
+ * mutations made elsewhere in the application. Subscribing to a single resource type narrows
623
+ * the event so `event.resource` is typed to that resource, no type guard required:
624
+ *
625
+ * ```tsx
626
+ * useResourceModified('Slot', (event) => {
627
+ * // event.resource is `WithId<Slot> | undefined`
628
+ * });
629
+ * useResourceModified(['Slot', 'Appointment'], () => refreshSchedule());
630
+ * ```
631
+ *
632
+ * Modifications made by other clients (or other users) are not observed;
633
+ * use `useSubscription` for server-side change notifications.
634
+ *
635
+ * @param resourceType - The resource type or types to observe.
636
+ * @param callback - Invoked with the event payload for each matching modification.
637
+ */
638
+ export declare function useResourceModified<K extends ResourceType>(resourceType: K | K[], callback: (event: ResourceModifiedEvent<ExtractResource<K>>) => void): void;
639
+
541
640
  /**
542
641
  * React hook for searching FHIR resources.
543
642
  *
@@ -611,13 +710,18 @@ export declare type UseSubscriptionOptions = {
611
710
  * to the configured e-prescribing vendor via the `$sync-orderset` custom FHIR operation
612
711
  * (`POST /fhir/R4/PlanDefinition/$sync-orderset`).
613
712
  *
614
- * Silently no-ops when the operation is not deployed (i.e. no e-prescribing vendor
615
- * is configured for the project), so callers do not need to guard against missing
616
- * integrations.
713
+ * Resolves with the decoded `OrderSetSyncResponse` so callers can surface
714
+ * per-action failures (`results[i].status === 'failed'` / `failedCount > 0`) —
715
+ * without this, an order set that only partially synced would silently apply
716
+ * with fewer meds than the PlanDefinition requested.
617
717
  *
618
- * @returns A stable `syncOrderSet(planDefinitionId)` callback.
718
+ * Resolves with `undefined` when the operation is not deployed (i.e. no
719
+ * e-prescribing vendor is configured for the project), so callers do not need to
720
+ * guard against missing integrations.
721
+ *
722
+ * @returns A stable `syncOrderSet(planDefinitionId, organization?)` callback.
619
723
  */
620
- export declare function useSyncOrderSet(): (planDefinitionId: string) => Promise<void>;
724
+ export declare function useSyncOrderSet(): (planDefinitionId: string, organization?: Reference<Organization>) => Promise<OrderSetSyncResponse | undefined>;
621
725
 
622
726
  export declare function useThreadInbox({ query, threadId }: UseThreadInboxOptions): UseThreadInboxReturn;
623
727
 
@@ -637,6 +741,30 @@ export declare interface UseThreadInboxReturn {
637
741
  refreshThreadMessages: () => Promise<void>;
638
742
  }
639
743
 
744
+ /**
745
+ * Probes a set of ValueSet URLs for availability, each with a filter-free, count-limited expansion.
746
+ *
747
+ * A filter-free probe means a 400/404 unambiguously describes the value set itself (unlike a
748
+ * user-typed search, whose 400 can be filter-specific), so the verdict is safe to act on. Repeated
749
+ * probes of the same URL are deduplicated by the `MedplumClient` request cache, which caches
750
+ * rejections too, so many fields bound to the same missing value set cost one request. Recovery
751
+ * after a value set is imported happens on the next mount (i.e. a page refresh) — there is no live
752
+ * subscription. Transient failures (429/5xx/network) resolve as available so a blip never disables
753
+ * a field; only a permanent 400/404 marks a URL unavailable.
754
+ * @param urls - The ValueSet URLs to probe. Falsy entries are ignored, and duplicates collapse to a
755
+ * single probe.
756
+ * @returns The availability verdict, with `loading` true until every requested URL has settled.
757
+ */
758
+ export declare function useValueSetAvailabilities(urls: readonly (string | undefined)[]): ValueSetAvailability;
759
+
760
+ /**
761
+ * Probes a single ValueSet's availability once on mount. A thin wrapper around
762
+ * {@link useValueSetAvailabilities} for the common single-value-set case.
763
+ * @param url - The ValueSet URL, or undefined for unbound inputs (always available).
764
+ * @returns undefined while the probe is in flight, true if available, false if unavailable.
765
+ */
766
+ export declare function useValueSetAvailability(url: string | undefined): boolean | undefined;
767
+
640
768
  export declare function useWhisper({ language, model, onTranscript, idleTimeoutMs, }: UseWhisperOptions): UseWhisperResult;
641
769
 
642
770
  export declare type UseWhisperOptions = {
@@ -658,8 +786,22 @@ export declare type UseWhisperResult = {
658
786
  start: () => Promise<void>;
659
787
  stop: () => void;
660
788
  isListening: boolean;
789
+ muted: boolean;
790
+ setMuted: (value: boolean) => void;
661
791
  };
662
792
 
793
+ /**
794
+ * The result of probing one or more ValueSet URLs for availability.
795
+ */
796
+ export declare interface ValueSetAvailability {
797
+ /** True while at least one requested URL is still being probed. */
798
+ readonly loading: boolean;
799
+ /** The subset of requested URLs known to be available. */
800
+ readonly available: string[];
801
+ /** The subset of requested URLs known to be unavailable (a permanent 400/404). */
802
+ readonly unavailable: string[];
803
+ }
804
+
663
805
  export declare type WhisperStatus = 'idle' | 'requesting_microphone' | 'connecting' | 'connected' | 'listening' | 'speech_started' | 'speech_stopped' | 'disconnected' | 'error';
664
806
 
665
807
  export { }
@@ -8,11 +8,18 @@ import type { ExtractResource } from '@medplum/fhirtypes';
8
8
  import type { Identifier } from '@medplum/fhirtypes';
9
9
  import type { JSX } from 'react';
10
10
  import type { Medication } from '@medplum/fhirtypes';
11
+ import type { MedicationCartClearRequest } from '@medplum/core';
12
+ import type { MedicationCartManageResponse } from '@medplum/core';
13
+ import type { MedicationCartRemoveRequest } from '@medplum/core';
14
+ import type { MedicationCheckoutRequest } from '@medplum/core';
15
+ import type { MedicationCheckoutResponse } from '@medplum/core';
11
16
  import type { MedicationOrderRequest } from '@medplum/core';
12
17
  import type { MedicationOrderResponse } from '@medplum/core';
18
+ import type { MedicationRequest } from '@medplum/fhirtypes';
13
19
  import type { MedicationSearchParams } from '@medplum/core';
14
20
  import type { MedplumClient } from '@medplum/core';
15
21
  import type { OperationOutcome } from '@medplum/fhirtypes';
22
+ import type { OrderSetSyncResponse } from '@medplum/core';
16
23
  import type { Organization } from '@medplum/fhirtypes';
17
24
  import type { Patient } from '@medplum/fhirtypes';
18
25
  import type { PharmacySearchParams } from '@medplum/core';
@@ -30,6 +37,7 @@ import type { ReactNode } from 'react';
30
37
  import type { Reference } from '@medplum/fhirtypes';
31
38
  import type { Resource } from '@medplum/fhirtypes';
32
39
  import type { ResourceArray } from '@medplum/core';
40
+ import type { ResourceModifiedEvent } from '@medplum/core';
33
41
  import type { ResourceType } from '@medplum/fhirtypes';
34
42
  import type { SearchRequest } from '@medplum/core';
35
43
  import type { Signature } from '@medplum/fhirtypes';
@@ -106,8 +114,22 @@ export declare function isChoiceQuestion(item: QuestionnaireItem): boolean;
106
114
  */
107
115
  export declare function isQuestionEnabled(item: QuestionnaireItem, questionnaireResponse: QuestionnaireResponse | undefined): boolean;
108
116
 
117
+ /**
118
+ * Returns true if an error thrown while expanding a ValueSet means the value set itself is
119
+ * unavailable — a permanent 400/404 (e.g. "ValueSet not found"). Transient failures (429 rate
120
+ * limit, 401, 5xx, network) return false so a blip never disables a field.
121
+ * @param err - The error thrown by `valueSetExpand`.
122
+ * @returns True for a permanent 400/404, false for a transient failure.
123
+ */
124
+ export declare function isValueSetUnavailableError(err: unknown): boolean;
125
+
126
+ /** Thrown by {@link UseMedicationCartReturn.checkout} when an {@link UseMedicationCartReturn.addToCart} call is still in flight. */
127
+ export declare const MEDICATION_CART_ADD_IN_PROGRESS = "Cannot checkout while a medication is still being added to the cart";
128
+
109
129
  export declare interface MedicationIFrameOptions {
110
130
  readonly patientId?: string;
131
+ /** Selected practice location for multi-practice deployments. */
132
+ readonly organization?: Reference<Organization>;
111
133
  readonly onPatientSyncSuccess?: () => void;
112
134
  readonly onIframeSuccess?: (url: string) => void;
113
135
  readonly onError?: (err: unknown) => void;
@@ -296,6 +318,53 @@ export declare function typedValueToResponseItem(item: QuestionnaireItem, value:
296
318
 
297
319
  export declare const useCachedBinaryUrl: (binaryUrl: string | undefined) => string | undefined;
298
320
 
321
+ /**
322
+ * Vendor-neutral hook for the full **medication cart** lifecycle: add a draft
323
+ * line (`createResource`), check out a set of drafts into the vendor's batch
324
+ * approval queue (`$checkout-medications`), and remove/clear cart lines
325
+ * (`$remove-cart-medication` / `$clear-cart`).
326
+ *
327
+ * Cart checkout / remove / clear hit project-scoped **FHIR custom operations**
328
+ * whose backing Bot is chosen at deploy time via an `OperationDefinition`
329
+ * carrying the `operationDefinition-implementation` extension — see
330
+ * [bot operations docs](https://www.medplum.com/docs/bots/custom-fhir-operations).
331
+ * The server's `tryCustomOperation` dispatch handles the OD → Bot lookup, so
332
+ * projects swap vendors by deploying a different bot under the same code.
333
+ *
334
+ * `addToCart` is plain FHIR `createResource` (no `$add-cart` operation): the
335
+ * Medplum-side cart is the set of draft `MedicationRequest`s. Vendor staging
336
+ * (e.g. ScriptSure MedCart) happens at checkout. Vendors without a batch
337
+ * approval queue (e.g. DoseSpot iframe-first) simply never call `checkout` /
338
+ * `removeFromCart` / `clearCart`.
339
+ *
340
+ * Requests for the custom operations are encoded as `Parameters` bodies and
341
+ * decoded by the matching `@medplum/core` helpers. Per-line outcomes arrive in
342
+ * `response.items`.
343
+ *
344
+ * @returns Cart add / checkout / remove / clear callbacks plus `adding` state.
345
+ */
346
+ export declare function useMedicationCart(): UseMedicationCartReturn;
347
+
348
+ export declare interface UseMedicationCartReturn {
349
+ /**
350
+ * Persist a draft `MedicationRequest` as a cart line via plain FHIR
351
+ * `createResource` (no custom operation). Vendor staging happens later at
352
+ * {@link UseMedicationCartReturn.checkout}.
353
+ */
354
+ addToCart: (medicationRequest: MedicationRequest) => Promise<MedicationRequest>;
355
+ /** True while one or more {@link UseMedicationCartReturn.addToCart} calls are in flight. */
356
+ adding: boolean;
357
+ /**
358
+ * Submit draft cart lines to the vendor's batch approval queue and return an
359
+ * embeddable approval-widget URL. Refuses while {@link UseMedicationCartReturn.adding} is true.
360
+ */
361
+ checkout: (input: MedicationCheckoutRequest) => Promise<MedicationCheckoutResponse>;
362
+ /** Remove a single draft `MedicationRequest` from the patient's vendor cart. */
363
+ removeFromCart: (input: MedicationCartRemoveRequest) => Promise<MedicationCartManageResponse>;
364
+ /** Remove every item from the patient's vendor cart. */
365
+ clearCart: (input: MedicationCartClearRequest) => Promise<MedicationCartManageResponse>;
366
+ }
367
+
299
368
  /**
300
369
  * Generic React hook that syncs a patient to a medication-order vendor and
301
370
  * returns the chart iframe URL.
@@ -379,6 +448,8 @@ export declare interface UseMedicationOrderSetOptions {
379
448
  /** Vendor-side order set id, when picked directly (escape hatch when no synced PD exists yet). */
380
449
  readonly vendorOrderSetId?: number | string;
381
450
  readonly appId?: string;
451
+ /** Selected practice location for multi-practice deployments. */
452
+ readonly organization?: Reference<Organization>;
382
453
  }
383
454
 
384
455
  export declare interface UseMedicationOrderSetReturn {
@@ -461,14 +532,18 @@ export declare function usePatientSummaryData(patient: Patient | Reference<Patie
461
532
  * Encapsulates calls to a search-pharmacy bot and an add-patient-pharmacy bot,
462
533
  * and can be composed with the generic `PharmacyDialog` component from `@medplum/react`.
463
534
  *
535
+ * The search param type is generic so vendor hooks can widen it with their own
536
+ * filters (e.g. ScriptSure `specialties`); the extra keys are passed through to
537
+ * the bot as-is at runtime.
538
+ *
464
539
  * @param searchBotIdentifier - Bot identifier for the pharmacy search bot.
465
540
  * @param addPharmacyBotIdentifier - Bot identifier for the add-patient-pharmacy bot.
466
541
  * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.
467
542
  */
468
- export declare function usePharmacySearch(searchBotIdentifier: Identifier, addPharmacyBotIdentifier: Identifier): UsePharmacySearchReturn;
543
+ export declare function usePharmacySearch<T extends PharmacySearchParams = PharmacySearchParams>(searchBotIdentifier: Identifier, addPharmacyBotIdentifier: Identifier): UsePharmacySearchReturn<T>;
469
544
 
470
- export declare interface UsePharmacySearchReturn {
471
- searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;
545
+ export declare interface UsePharmacySearchReturn<T extends PharmacySearchParams = PharmacySearchParams> {
546
+ searchPharmacies: (params: T) => Promise<Organization[]>;
472
547
  addToFavorites: (params: AddFavoriteParams) => Promise<AddPharmacyResponse>;
473
548
  }
474
549
 
@@ -538,6 +613,30 @@ export declare interface UseResourceBoardResult<T extends Resource = Resource> {
538
613
  readonly refresh: () => Promise<void>;
539
614
  }
540
615
 
616
+ /**
617
+ * React hook for observing FHIR resource modifications made through the Medplum client.
618
+ *
619
+ * The callback is invoked whenever this client instance creates, updates, patches, or deletes
620
+ * a resource of one of the given types, including modifications announced with
621
+ * `MedplumClient.notifyResourceModified`. Use it to keep local component state in sync with
622
+ * mutations made elsewhere in the application. Subscribing to a single resource type narrows
623
+ * the event so `event.resource` is typed to that resource, no type guard required:
624
+ *
625
+ * ```tsx
626
+ * useResourceModified('Slot', (event) => {
627
+ * // event.resource is `WithId<Slot> | undefined`
628
+ * });
629
+ * useResourceModified(['Slot', 'Appointment'], () => refreshSchedule());
630
+ * ```
631
+ *
632
+ * Modifications made by other clients (or other users) are not observed;
633
+ * use `useSubscription` for server-side change notifications.
634
+ *
635
+ * @param resourceType - The resource type or types to observe.
636
+ * @param callback - Invoked with the event payload for each matching modification.
637
+ */
638
+ export declare function useResourceModified<K extends ResourceType>(resourceType: K | K[], callback: (event: ResourceModifiedEvent<ExtractResource<K>>) => void): void;
639
+
541
640
  /**
542
641
  * React hook for searching FHIR resources.
543
642
  *
@@ -611,13 +710,18 @@ export declare type UseSubscriptionOptions = {
611
710
  * to the configured e-prescribing vendor via the `$sync-orderset` custom FHIR operation
612
711
  * (`POST /fhir/R4/PlanDefinition/$sync-orderset`).
613
712
  *
614
- * Silently no-ops when the operation is not deployed (i.e. no e-prescribing vendor
615
- * is configured for the project), so callers do not need to guard against missing
616
- * integrations.
713
+ * Resolves with the decoded `OrderSetSyncResponse` so callers can surface
714
+ * per-action failures (`results[i].status === 'failed'` / `failedCount > 0`) —
715
+ * without this, an order set that only partially synced would silently apply
716
+ * with fewer meds than the PlanDefinition requested.
617
717
  *
618
- * @returns A stable `syncOrderSet(planDefinitionId)` callback.
718
+ * Resolves with `undefined` when the operation is not deployed (i.e. no
719
+ * e-prescribing vendor is configured for the project), so callers do not need to
720
+ * guard against missing integrations.
721
+ *
722
+ * @returns A stable `syncOrderSet(planDefinitionId, organization?)` callback.
619
723
  */
620
- export declare function useSyncOrderSet(): (planDefinitionId: string) => Promise<void>;
724
+ export declare function useSyncOrderSet(): (planDefinitionId: string, organization?: Reference<Organization>) => Promise<OrderSetSyncResponse | undefined>;
621
725
 
622
726
  export declare function useThreadInbox({ query, threadId }: UseThreadInboxOptions): UseThreadInboxReturn;
623
727
 
@@ -637,6 +741,30 @@ export declare interface UseThreadInboxReturn {
637
741
  refreshThreadMessages: () => Promise<void>;
638
742
  }
639
743
 
744
+ /**
745
+ * Probes a set of ValueSet URLs for availability, each with a filter-free, count-limited expansion.
746
+ *
747
+ * A filter-free probe means a 400/404 unambiguously describes the value set itself (unlike a
748
+ * user-typed search, whose 400 can be filter-specific), so the verdict is safe to act on. Repeated
749
+ * probes of the same URL are deduplicated by the `MedplumClient` request cache, which caches
750
+ * rejections too, so many fields bound to the same missing value set cost one request. Recovery
751
+ * after a value set is imported happens on the next mount (i.e. a page refresh) — there is no live
752
+ * subscription. Transient failures (429/5xx/network) resolve as available so a blip never disables
753
+ * a field; only a permanent 400/404 marks a URL unavailable.
754
+ * @param urls - The ValueSet URLs to probe. Falsy entries are ignored, and duplicates collapse to a
755
+ * single probe.
756
+ * @returns The availability verdict, with `loading` true until every requested URL has settled.
757
+ */
758
+ export declare function useValueSetAvailabilities(urls: readonly (string | undefined)[]): ValueSetAvailability;
759
+
760
+ /**
761
+ * Probes a single ValueSet's availability once on mount. A thin wrapper around
762
+ * {@link useValueSetAvailabilities} for the common single-value-set case.
763
+ * @param url - The ValueSet URL, or undefined for unbound inputs (always available).
764
+ * @returns undefined while the probe is in flight, true if available, false if unavailable.
765
+ */
766
+ export declare function useValueSetAvailability(url: string | undefined): boolean | undefined;
767
+
640
768
  export declare function useWhisper({ language, model, onTranscript, idleTimeoutMs, }: UseWhisperOptions): UseWhisperResult;
641
769
 
642
770
  export declare type UseWhisperOptions = {
@@ -658,8 +786,22 @@ export declare type UseWhisperResult = {
658
786
  start: () => Promise<void>;
659
787
  stop: () => void;
660
788
  isListening: boolean;
789
+ muted: boolean;
790
+ setMuted: (value: boolean) => void;
661
791
  };
662
792
 
793
+ /**
794
+ * The result of probing one or more ValueSet URLs for availability.
795
+ */
796
+ export declare interface ValueSetAvailability {
797
+ /** True while at least one requested URL is still being probed. */
798
+ readonly loading: boolean;
799
+ /** The subset of requested URLs known to be available. */
800
+ readonly available: string[];
801
+ /** The subset of requested URLs known to be unavailable (a permanent 400/404). */
802
+ readonly unavailable: string[];
803
+ }
804
+
663
805
  export declare type WhisperStatus = 'idle' | 'requesting_microphone' | 'connecting' | 'connected' | 'listening' | 'speech_started' | 'speech_stopped' | 'disconnected' | 'error';
664
806
 
665
807
  export { }