@medplum/dosespot-react 5.0.13 → 5.0.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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/cjs/index.d.ts +204 -19
- package/dist/esm/index.d.ts +204 -19
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +4 -4
- package/package.json +16 -14
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var index_exports={};__export(index_exports,{DOSESPOT_ADD_FAVORITE_MEDICATION_BOT:()=>DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM:()=>DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM,DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM:()=>DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM,DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT:()=>DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT,DOSESPOT_IFRAME_BOT:()=>DOSESPOT_IFRAME_BOT,DOSESPOT_MEDICATION_HISTORY_BOT:()=>DOSESPOT_MEDICATION_HISTORY_BOT,DOSESPOT_NOTIFICATION_COUNTS_BOT:()=>DOSESPOT_NOTIFICATION_COUNTS_BOT,DOSESPOT_PATIENT_ID_SYSTEM:()=>DOSESPOT_PATIENT_ID_SYSTEM,DOSESPOT_PATIENT_SYNC_BOT:()=>DOSESPOT_PATIENT_SYNC_BOT,DOSESPOT_PRESCRIPTIONS_SYNC_BOT:()=>DOSESPOT_PRESCRIPTIONS_SYNC_BOT,DOSESPOT_SEARCH_MEDICATIONS_BOT:()=>DOSESPOT_SEARCH_MEDICATIONS_BOT,MEDPLUM_BOT_SYSTEM:()=>MEDPLUM_BOT_SYSTEM,getMedicationName:()=>getMedicationName,useDoseSpotClinicFormulary:()=>useDoseSpotClinicFormulary,useDoseSpotIFrame:()=>useDoseSpotIFrame,useDoseSpotNotifications:()=>useDoseSpotNotifications});module.exports=__toCommonJS(index_exports);var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",DOSESPOT_PATIENT_ID_SYSTEM="https://dosespot.com/patient-id",DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM="https://dosespot.com/clinic-favorite-medication-id",DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM="https://dosespot.com/dispensable-drug-id",DOSESPOT_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-patient-sync-bot"},DOSESPOT_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-iframe-bot"},DOSESPOT_ADD_FAVORITE_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-add-favorite-medication-bot"},DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-get-favorite-medications-bot"},DOSESPOT_SEARCH_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-search-medication-bot"},DOSESPOT_MEDICATION_HISTORY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-medication-history-bot"},DOSESPOT_PRESCRIPTIONS_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-prescriptions-sync-bot"},DOSESPOT_NOTIFICATION_COUNTS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-notification-counts-bot"};var import_core=require("@medplum/core"),import_react_hooks=require("@medplum/react-hooks"),import_react=require("react");function useDoseSpotClinicFormulary(){let[directions,privateSetDirections]=(0,import_react.useState)(void 0),[selectedMedication,privateSetSelectedMedication]=(0,import_react.useState)(void 0),medplum=(0,import_react_hooks.useMedplum)(),state={selectedMedication,directions},saveFavoriteMedication=(0,import_react.useCallback)(async()=>{if(!selectedMedication)throw new Error("Must select a medication before adding a favorite medication");let medicationKnowledgeWithDirections={resourceType:"MedicationKnowledge",code:{...selectedMedication},administrationGuidelines:[{dosage:[{dosage:[{patientInstruction:directions||""}],type:{coding:[{system:"https://dosespot.com/patient-instructions"}]}}]}]};return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,medicationKnowledgeWithDirections)},[selectedMedication,directions,medplum]),searchMedications=(0,import_react.useCallback)(async searchTerm=>await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT,{name:searchTerm}),[medplum]);return{state,searchMedications,setSelectedMedication:medication=>{let medicationToSet;(0,import_core.isCodeableConcept)(medication)?medicationToSet={...medication}:(0,import_core.isCoding)(medication)&&(medicationToSet={text:medication.display||"",coding:[medication]}),privateSetSelectedMedication(medicationToSet)},setSelectedMedicationDirections:directions2=>{privateSetDirections(directions2)},saveFavoriteMedication,clear:()=>{privateSetSelectedMedication(void 0),privateSetDirections(void 0)}}}var import_react_hooks2=require("@medplum/react-hooks"),import_react2=require("react");function useDoseSpotIFrame(options){let medplum=(0,import_react_hooks2.useMedplum)(),{patientId,onPatientSyncSuccess,onIframeSuccess,onError}=options,initializingRef=(0,import_react2.useRef)(!1),[iframeUrl,setIframeUrl]=(0,import_react2.useState)(void 0),onPatientSyncSuccessRef=(0,import_react2.useRef)(onPatientSyncSuccess);onPatientSyncSuccessRef.current=onPatientSyncSuccess;let onIframeSuccessRef=(0,import_react2.useRef)(onIframeSuccess);onIframeSuccessRef.current=onIframeSuccess;let onErrorRef=(0,import_react2.useRef)(onError);onErrorRef.current=onError;let initPage=(0,import_react2.useCallback)(async()=>{if(!initializingRef.current){initializingRef.current=!0;try{patientId&&(await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT,{patientId}),onPatientSyncSuccessRef.current?.());let result=await medplum.executeBot(DOSESPOT_IFRAME_BOT,{patientId});result.url&&(setIframeUrl(result.url),onIframeSuccessRef.current?.(result.url))}catch(err){onErrorRef.current?.(err)}}},[medplum,patientId]);return(0,import_react2.useEffect)(()=>{initPage().catch(console.error)},[initPage]),iframeUrl}var import_react_hooks3=require("@medplum/react-hooks"),import_react3=require("react");var DEFAULT_REFRESH_INTERVAL_MILLISECONDS=1e4;function useDoseSpotNotifications(options){let medplum=(0,import_react_hooks3.useMedplum)(),{onChange,onError}=options??{},hasDoseSpot=medplum.getProjectMembership()?.identifier?.some(i=>i.system?.includes("dosespot")),refreshInterval=options?.refreshIntervalMilliseconds??DEFAULT_REFRESH_INTERVAL_MILLISECONDS,timerRef=(0,import_react3.useRef)(void 0),[unreadCount,setUnreadCount]=(0,import_react3.useState)(void 0),stopTimer=(0,import_react3.useCallback)(()=>{let timerId=timerRef.current;timerId&&clearInterval(timerId)},[]),updateCount=(0,import_react3.useCallback)(async()=>{try{let result=await medplum.executeBot(DOSESPOT_NOTIFICATION_COUNTS_BOT,{}),newCount=0;result.PendingPrescriptionsCount&&(newCount+=result.PendingPrescriptionsCount),result.PendingRxChangeCount&&(newCount+=result.PendingRxChangeCount),result.RefillRequestsCount&&(newCount+=result.RefillRequestsCount),result.TransactionErrorsCount&&(newCount+=result.TransactionErrorsCount),newCount!==unreadCount&&(setUnreadCount(newCount),onChange?.(newCount))}catch(err){onError?.(err),stopTimer()}},[medplum,unreadCount,onChange,onError,stopTimer]),startTimer=(0,import_react3.useCallback)(()=>{timerRef.current=setInterval(()=>{updateCount().catch(console.error)},refreshInterval)},[updateCount,refreshInterval]);return(0,import_react3.useEffect)(()=>(hasDoseSpot&&startTimer(),stopTimer),[hasDoseSpot,startTimer,stopTimer]),unreadCount}var getMedicationName=medication=>medication?.code?.text||"";
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var index_exports={};__export(index_exports,{DOSESPOT_ADD_FAVORITE_MEDICATION_BOT:()=>DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,DOSESPOT_ADD_PATIENT_PHARMACY_BOT:()=>DOSESPOT_ADD_PATIENT_PHARMACY_BOT,DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM:()=>DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM,DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM:()=>DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM,DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT:()=>DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT,DOSESPOT_IFRAME_BOT:()=>DOSESPOT_IFRAME_BOT,DOSESPOT_MEDICATION_HISTORY_BOT:()=>DOSESPOT_MEDICATION_HISTORY_BOT,DOSESPOT_NOTIFICATION_COUNTS_BOT:()=>DOSESPOT_NOTIFICATION_COUNTS_BOT,DOSESPOT_PATIENT_ID_SYSTEM:()=>DOSESPOT_PATIENT_ID_SYSTEM,DOSESPOT_PATIENT_SYNC_BOT:()=>DOSESPOT_PATIENT_SYNC_BOT,DOSESPOT_PHARMACY_ID_SYSTEM:()=>DOSESPOT_PHARMACY_ID_SYSTEM,DOSESPOT_PRESCRIPTIONS_SYNC_BOT:()=>DOSESPOT_PRESCRIPTIONS_SYNC_BOT,DOSESPOT_SEARCH_MEDICATIONS_BOT:()=>DOSESPOT_SEARCH_MEDICATIONS_BOT,DOSESPOT_SEARCH_PHARMACY_BOT:()=>DOSESPOT_SEARCH_PHARMACY_BOT,MEDPLUM_BOT_SYSTEM:()=>MEDPLUM_BOT_SYSTEM,PATIENT_PREFERRED_PHARMACY_URL:()=>import_core3.PATIENT_PREFERRED_PHARMACY_URL,PHARMACY_PREFERENCE_TYPE_SYSTEM:()=>import_core3.PHARMACY_PREFERENCE_TYPE_SYSTEM,PHARMACY_TYPE_PREFERRED:()=>import_core3.PHARMACY_TYPE_PREFERRED,PHARMACY_TYPE_PRIMARY:()=>import_core3.PHARMACY_TYPE_PRIMARY,addPreferredPharmacyToPatient:()=>import_core3.addPreferredPharmacyToPatient,createPreferredPharmacyExtension:()=>import_core3.createPreferredPharmacyExtension,getMedicationName:()=>getMedicationName,getPharmacyIdFromOrganization:()=>getPharmacyIdFromOrganization,getPreferredPharmaciesFromPatient:()=>import_core3.getPreferredPharmaciesFromPatient,isAddPharmacyResponse:()=>import_core3.isAddPharmacyResponse,isOrganizationArray:()=>import_core3.isOrganizationArray,removePreferredPharmacyFromPatient:()=>import_core3.removePreferredPharmacyFromPatient,useDoseSpotClinicFormulary:()=>useDoseSpotClinicFormulary,useDoseSpotIFrame:()=>useDoseSpotIFrame,useDoseSpotNotifications:()=>useDoseSpotNotifications,useDoseSpotPatientPharmacy:()=>useDoseSpotPatientPharmacy,useDoseSpotPharmacySearch:()=>useDoseSpotPharmacySearch});module.exports=__toCommonJS(index_exports);var import_core=require("@medplum/core");var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",DOSESPOT_PATIENT_ID_SYSTEM="https://dosespot.com/patient-id",DOSESPOT_PHARMACY_ID_SYSTEM="https://dosespot.com/pharmacy-id",DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM="https://dosespot.com/clinic-favorite-medication-id",DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM="https://dosespot.com/dispensable-drug-id",DOSESPOT_SEARCH_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-search-pharmacy-bot"},DOSESPOT_ADD_PATIENT_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-add-patient-pharmacy-bot"},DOSESPOT_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-patient-sync-bot"},DOSESPOT_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-iframe-bot"},DOSESPOT_ADD_FAVORITE_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-add-favorite-medication-bot"},DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-get-favorite-medications-bot"},DOSESPOT_SEARCH_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-search-medication-bot"},DOSESPOT_MEDICATION_HISTORY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-medication-history-bot"},DOSESPOT_PRESCRIPTIONS_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-prescriptions-sync-bot"},DOSESPOT_NOTIFICATION_COUNTS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-notification-counts-bot"};var import_core2=require("@medplum/core"),import_react_hooks=require("@medplum/react-hooks"),import_react=require("react");function useDoseSpotClinicFormulary(){let[directions,privateSetDirections]=(0,import_react.useState)(void 0),[selectedMedication,privateSetSelectedMedication]=(0,import_react.useState)(void 0),medplum=(0,import_react_hooks.useMedplum)(),state={selectedMedication,directions},saveFavoriteMedication=(0,import_react.useCallback)(async()=>{if(!selectedMedication)throw new Error("Must select a medication before adding a favorite medication");let medicationKnowledgeWithDirections={resourceType:"MedicationKnowledge",code:{...selectedMedication},administrationGuidelines:[{dosage:[{dosage:[{patientInstruction:directions||""}],type:{coding:[{system:"https://dosespot.com/patient-instructions"}]}}]}]};return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,medicationKnowledgeWithDirections)},[selectedMedication,directions,medplum]),searchMedications=(0,import_react.useCallback)(async searchTerm=>await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT,{name:searchTerm}),[medplum]);return{state,searchMedications,setSelectedMedication:medication=>{let medicationToSet;(0,import_core2.isCodeableConcept)(medication)?medicationToSet={...medication}:(0,import_core2.isCoding)(medication)&&(medicationToSet={text:medication.display||"",coding:[medication]}),privateSetSelectedMedication(medicationToSet)},setSelectedMedicationDirections:directions2=>{privateSetDirections(directions2)},saveFavoriteMedication,clear:()=>{privateSetSelectedMedication(void 0),privateSetDirections(void 0)}}}var import_react_hooks2=require("@medplum/react-hooks"),import_react2=require("react");function useDoseSpotIFrame(options){let medplum=(0,import_react_hooks2.useMedplum)(),{patientId,onPatientSyncSuccess,onIframeSuccess,onError}=options,initializingRef=(0,import_react2.useRef)(!1),[iframeUrl,setIframeUrl]=(0,import_react2.useState)(void 0),onPatientSyncSuccessRef=(0,import_react2.useRef)(onPatientSyncSuccess);onPatientSyncSuccessRef.current=onPatientSyncSuccess;let onIframeSuccessRef=(0,import_react2.useRef)(onIframeSuccess);onIframeSuccessRef.current=onIframeSuccess;let onErrorRef=(0,import_react2.useRef)(onError);onErrorRef.current=onError,(0,import_react2.useEffect)(()=>{initializingRef.current=!1},[patientId]);let initPage=(0,import_react2.useCallback)(async()=>{if(!initializingRef.current){initializingRef.current=!0;try{patientId&&(await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT,{patientId}),onPatientSyncSuccessRef.current?.());let result=await medplum.executeBot(DOSESPOT_IFRAME_BOT,{patientId});result.url&&(setIframeUrl(result.url),onIframeSuccessRef.current?.(result.url))}catch(err){onErrorRef.current?.(err)}}},[medplum,patientId]);return(0,import_react2.useEffect)(()=>{initPage().catch(console.error)},[initPage]),iframeUrl}var import_react_hooks3=require("@medplum/react-hooks"),import_react3=require("react");var DEFAULT_REFRESH_INTERVAL_MILLISECONDS=1e4;function useDoseSpotNotifications(options){let medplum=(0,import_react_hooks3.useMedplum)(),{onChange,onError}=options??{},hasDoseSpot=medplum.getProjectMembership()?.identifier?.some(i=>i.system?.includes("dosespot")),refreshInterval=options?.refreshIntervalMilliseconds??DEFAULT_REFRESH_INTERVAL_MILLISECONDS,timerRef=(0,import_react3.useRef)(void 0),[unreadCount,setUnreadCount]=(0,import_react3.useState)(void 0),stopTimer=(0,import_react3.useCallback)(()=>{let timerId=timerRef.current;timerId&&clearInterval(timerId)},[]),updateCount=(0,import_react3.useCallback)(async()=>{try{let result=await medplum.executeBot(DOSESPOT_NOTIFICATION_COUNTS_BOT,{}),newCount=0;result.PendingPrescriptionsCount&&(newCount+=result.PendingPrescriptionsCount),result.PendingRxChangeCount&&(newCount+=result.PendingRxChangeCount),result.RefillRequestsCount&&(newCount+=result.RefillRequestsCount),result.TransactionErrorsCount&&(newCount+=result.TransactionErrorsCount),newCount!==unreadCount&&(setUnreadCount(newCount),onChange?.(newCount))}catch(err){onError?.(err),stopTimer()}},[medplum,unreadCount,onChange,onError,stopTimer]),startTimer=(0,import_react3.useCallback)(()=>{timerRef.current=setInterval(()=>{updateCount().catch(console.error)},refreshInterval)},[updateCount,refreshInterval]);return(0,import_react3.useEffect)(()=>(hasDoseSpot&&startTimer(),stopTimer),[hasDoseSpot,startTimer,stopTimer]),unreadCount}var import_react_hooks4=require("@medplum/react-hooks"),import_react4=require("react");var import_core3=require("@medplum/core"),getMedicationName=medication=>medication?.code?.text||"";function getPharmacyIdFromOrganization(organization){let id=organization.identifier?.find(i=>i.system===DOSESPOT_PHARMACY_ID_SYSTEM)?.value;return id?Number.parseInt(id,10):void 0}function useDoseSpotPatientPharmacy(){let[selectedPharmacy,privateSetSelectedPharmacy]=(0,import_react4.useState)(void 0),[setAsPrimaryState,privateSetAsPrimary]=(0,import_react4.useState)(!1),medplum=(0,import_react_hooks4.useMedplum)(),state={selectedPharmacy,setAsPrimary:setAsPrimaryState},searchPharmacies=(0,import_react4.useCallback)(async params=>await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT,params),[medplum]),setSelectedPharmacy=pharmacy=>{privateSetSelectedPharmacy(pharmacy)},setAsPrimary=primary=>{privateSetAsPrimary(primary)},addFavoritePharmacy=(0,import_react4.useCallback)(async patientId=>{if(!selectedPharmacy)throw new Error("Must select a pharmacy before adding it as a favorite");if(!getPharmacyIdFromOrganization(selectedPharmacy))throw new Error("Selected pharmacy does not have a valid DoseSpot pharmacy ID");return medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT,{patientId,pharmacy:selectedPharmacy,setAsPrimary:setAsPrimaryState})},[selectedPharmacy,setAsPrimaryState,medplum]);return{state,searchPharmacies,setSelectedPharmacy,setAsPrimary,addFavoritePharmacy,clear:()=>{privateSetSelectedPharmacy(void 0),privateSetAsPrimary(!1)}}}var import_core4=require("@medplum/core"),import_react_hooks5=require("@medplum/react-hooks"),import_react5=require("react");function useDoseSpotPharmacySearch(){let medplum=(0,import_react_hooks5.useMedplum)(),searchPharmacies=(0,import_react5.useCallback)(async params=>{let response=await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT,params);if(!(0,import_core4.isOrganizationArray)(response))throw new Error("Invalid response from pharmacy search");return response},[medplum]),addToFavorites=(0,import_react5.useCallback)(async params=>{let response=await medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT,{patientId:params.patientId,pharmacy:params.pharmacy,setAsPrimary:params.setAsPrimary});if(!(0,import_core4.isAddPharmacyResponse)(response))throw new Error("Invalid response from add pharmacy bot");return response},[medplum]);return{searchPharmacies,addToFavorites}}
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts", "
|
|
4
|
-
"sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nexport * from './common';\nexport * from './useDoseSpotClinicFormulary';\nexport * from './useDoseSpotIFrame';\nexport * from './useDoseSpotNotifications';\nexport * from './utils';\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { Identifier } from '@medplum/fhirtypes';\n\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\nexport const DOSESPOT_PATIENT_ID_SYSTEM = 'https://dosespot.com/patient-id';\n\nexport const DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM = 'https://dosespot.com/clinic-favorite-medication-id';\n\nexport const DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM = 'https://dosespot.com/dispensable-drug-id';\n\nexport const DOSESPOT_PATIENT_SYNC_BOT: Identifier = { system: MEDPLUM_BOT_SYSTEM, value: 'dosespot-patient-sync-bot' };\n\nexport const DOSESPOT_IFRAME_BOT: Identifier = { system: MEDPLUM_BOT_SYSTEM, value: 'dosespot-iframe-bot' };\n\nexport const DOSESPOT_ADD_FAVORITE_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-add-favorite-medication-bot',\n};\n\nexport const DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-get-favorite-medications-bot',\n};\n\nexport const DOSESPOT_SEARCH_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-search-medication-bot',\n};\n\nexport const DOSESPOT_MEDICATION_HISTORY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-medication-history-bot',\n};\n\nexport const DOSESPOT_PRESCRIPTIONS_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-prescriptions-sync-bot',\n};\n\nexport const DOSESPOT_NOTIFICATION_COUNTS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-notification-counts-bot',\n};\n\nexport interface DoseSpotNotificationCountsResponse {\n PendingPrescriptionsCount: number;\n PendingRxChangeCount: number;\n RefillRequestsCount: number;\n TransactionErrorsCount: number;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { isCodeableConcept, isCoding } from '@medplum/core';\nimport type { CodeableConcept, Coding, MedicationKnowledge } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useState } from 'react';\nimport { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, DOSESPOT_SEARCH_MEDICATIONS_BOT } from './common';\n\nexport interface DoseSpotClinicFormularyReturn {\n state: DoseSpotClinicFormularyState;\n /**\n * Search for DoseSpot Medications and returns array of temporary MedicationKnowledge objects that are not yet saved to the FHIR server\n */\n readonly searchMedications: (searchTerm: string) => Promise<CodeableConcept[]>;\n /**\n * Set the currently selected medication. Can be set as a CodeableConcept or a Coding, but state is always stored as a CodeableConcept\n */\n readonly setSelectedMedication: (medication: CodeableConcept | Coding | undefined) => void;\n /**\n * Set the directions for the currently selected medication\n */\n readonly setSelectedMedicationDirections: (directions: string | undefined) => void;\n /**\n * Save a DoseSpot Medication to the Clinic's favorites and returns the MedicationKnowledge object that was saved\n */\n readonly saveFavoriteMedication: () => Promise<MedicationKnowledge>;\n /**\n * Clear the state\n */\n readonly clear: () => void;\n}\n\nexport interface DoseSpotClinicFormularyState {\n selectedMedication: CodeableConcept | undefined;\n directions: string | undefined;\n}\n\nexport function useDoseSpotClinicFormulary(): DoseSpotClinicFormularyReturn {\n const [directions, privateSetDirections] = useState<string | undefined>(undefined);\n const [selectedMedication, privateSetSelectedMedication] = useState<CodeableConcept | undefined>(undefined);\n const medplum = useMedplum();\n\n const state: DoseSpotClinicFormularyState = { selectedMedication, directions };\n\n const saveFavoriteMedication = useCallback(async (): Promise<MedicationKnowledge> => {\n if (!selectedMedication) {\n throw new Error('Must select a medication before adding a favorite medication');\n }\n\n //Add the directions to the medicationKnowledge object\n const medicationKnowledgeWithDirections = {\n resourceType: 'MedicationKnowledge',\n code: { ...selectedMedication },\n administrationGuidelines: [\n {\n dosage: [\n {\n dosage: [\n {\n patientInstruction: directions || '',\n },\n ],\n type: {\n coding: [\n {\n system: 'https://dosespot.com/patient-instructions',\n },\n ],\n },\n },\n ],\n },\n ],\n };\n\n return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, medicationKnowledgeWithDirections);\n }, [selectedMedication, directions, medplum]);\n\n const searchMedications = useCallback(\n async (searchTerm: string): Promise<CodeableConcept[]> => {\n return (await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT, { name: searchTerm })) as CodeableConcept[];\n },\n [medplum]\n );\n\n const setSelectedMedicationDirections = (directions: string | undefined): void => {\n privateSetDirections(directions);\n };\n\n const setSelectedMedication = (medication: CodeableConcept | Coding | undefined): void => {\n let medicationToSet: CodeableConcept | undefined;\n if (isCodeableConcept(medication)) {\n medicationToSet = { ...medication };\n } else if (isCoding(medication)) {\n medicationToSet = {\n text: medication.display || '',\n coding: [medication],\n };\n }\n privateSetSelectedMedication(medicationToSet);\n };\n\n const clear = (): void => {\n privateSetSelectedMedication(undefined);\n privateSetDirections(undefined);\n };\n\n return {\n state,\n searchMedications,\n setSelectedMedication,\n setSelectedMedicationDirections,\n saveFavoriteMedication,\n clear,\n };\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { DOSESPOT_IFRAME_BOT, DOSESPOT_PATIENT_SYNC_BOT } from './common';\n\nexport interface DoseSpotIFrameOptions {\n readonly patientId?: string;\n readonly onPatientSyncSuccess?: () => void;\n readonly onIframeSuccess?: (url: string) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nexport function useDoseSpotIFrame(options: DoseSpotIFrameOptions): string | undefined {\n const medplum = useMedplum();\n const { patientId, onPatientSyncSuccess, onIframeSuccess, onError } = options;\n const initializingRef = useRef<boolean>(false);\n const [iframeUrl, setIframeUrl] = useState<string | undefined>(undefined);\n\n const onPatientSyncSuccessRef = useRef(onPatientSyncSuccess);\n onPatientSyncSuccessRef.current = onPatientSyncSuccess;\n\n const onIframeSuccessRef = useRef(onIframeSuccess);\n onIframeSuccessRef.current = onIframeSuccess;\n\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n\n const initPage = useCallback(async () => {\n if (initializingRef.current) {\n return;\n }\n\n initializingRef.current = true;\n try {\n if (patientId) {\n await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT, { patientId });\n onPatientSyncSuccessRef.current?.();\n }\n const result = await medplum.executeBot(DOSESPOT_IFRAME_BOT, { patientId });\n if (result.url) {\n setIframeUrl(result.url);\n onIframeSuccessRef.current?.(result.url);\n }\n } catch (err: unknown) {\n onErrorRef.current?.(err);\n }\n }, [medplum, patientId]);\n\n useEffect(() => {\n initPage().catch(console.error);\n }, [initPage]);\n\n return iframeUrl;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { DoseSpotNotificationCountsResponse } from './common';\nimport { DOSESPOT_NOTIFICATION_COUNTS_BOT } from './common';\n\nexport interface DoseSpotNotificationsOptions {\n readonly refreshIntervalMilliseconds?: number;\n readonly onChange?: (count: number) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nconst DEFAULT_REFRESH_INTERVAL_MILLISECONDS = 10000;\n\nexport function useDoseSpotNotifications(options?: DoseSpotNotificationsOptions): number | undefined {\n const medplum = useMedplum();\n const { onChange, onError } = options ?? {};\n const hasDoseSpot = medplum.getProjectMembership()?.identifier?.some((i) => i.system?.includes('dosespot'));\n const refreshInterval = options?.refreshIntervalMilliseconds ?? DEFAULT_REFRESH_INTERVAL_MILLISECONDS;\n const timerRef = useRef<NodeJS.Timeout | undefined>(undefined);\n const [unreadCount, setUnreadCount] = useState<number | undefined>(undefined);\n\n const stopTimer = useCallback(() => {\n const timerId = timerRef.current;\n if (timerId) {\n clearInterval(timerId);\n }\n }, []);\n\n const updateCount = useCallback(async () => {\n try {\n const result = (await medplum.executeBot(\n DOSESPOT_NOTIFICATION_COUNTS_BOT,\n {}\n )) as DoseSpotNotificationCountsResponse;\n\n let newCount = 0;\n if (result.PendingPrescriptionsCount) {\n newCount += result.PendingPrescriptionsCount;\n }\n if (result.PendingRxChangeCount) {\n newCount += result.PendingRxChangeCount;\n }\n if (result.RefillRequestsCount) {\n newCount += result.RefillRequestsCount;\n }\n if (result.TransactionErrorsCount) {\n newCount += result.TransactionErrorsCount;\n }\n if (newCount !== unreadCount) {\n setUnreadCount(newCount);\n onChange?.(newCount);\n }\n } catch (err: unknown) {\n onError?.(err);\n stopTimer();\n }\n }, [medplum, unreadCount, onChange, onError, stopTimer]);\n\n const startTimer = useCallback(() => {\n timerRef.current = setInterval(() => {\n updateCount().catch(console.error);\n }, refreshInterval);\n }, [updateCount, refreshInterval]);\n\n useEffect(() => {\n // Start an interval timer to update the count every 5 seconds\n if (hasDoseSpot) {\n startTimer();\n }\n\n // Clear the interval timer when the component is unmounted\n return stopTimer;\n }, [hasDoseSpot, startTimer, stopTimer]);\n\n return unreadCount;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationKnowledge } from '@medplum/fhirtypes';\n\nexport const getMedicationName = (medication: MedicationKnowledge | undefined): string => {\n return medication?.code?.text || '';\n};\n"],
|
|
5
|
-
"mappings": "wpBAAA,
|
|
6
|
-
"names": ["directions", "import_react_hooks", "import_react", "import_react_hooks", "import_react"]
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../dosespot-core/src/pharmacy-utils.ts", "../../src/useDoseSpotClinicFormulary.ts", "../../src/useDoseSpotIFrame.ts", "../../src/useDoseSpotNotifications.ts", "../../src/useDoseSpotPatientPharmacy.ts", "../../src/utils.ts", "../../src/useDoseSpotPharmacySearch.ts"],
|
|
4
|
+
"sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nexport * from './common';\nexport * from './useDoseSpotClinicFormulary';\nexport * from './useDoseSpotIFrame';\nexport * from './useDoseSpotNotifications';\nexport * from './useDoseSpotPatientPharmacy';\nexport * from './useDoseSpotPharmacySearch';\nexport * from './utils';\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Identifier } from '@medplum/fhirtypes';\n\n// DoseSpot-specific pharmacy preference type system\nexport const DOSESPOT_PHARMACY_PREFERENCE_TYPE_SYSTEM = 'https://dosespot.com/pharmacy-preference-type';\n\n// Re-export generic pharmacy utilities from @medplum/core\nexport {\n addPreferredPharmacyToPatient,\n createPreferredPharmacyExtension,\n getPreferredPharmaciesFromPatient,\n isAddPharmacyResponse,\n isOrganizationArray,\n PATIENT_PREFERRED_PHARMACY_URL,\n PHARMACY_PREFERENCE_TYPE_SYSTEM,\n PHARMACY_TYPE_PREFERRED,\n PHARMACY_TYPE_PRIMARY,\n removePreferredPharmacyFromPatient,\n} from '@medplum/core';\nexport type { AddFavoriteParams, AddPharmacyResponse, PharmacySearchParams, PreferredPharmacy } from '@medplum/core';\n\n// Bot system\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\n// DoseSpot identifier systems\nexport const DOSESPOT_PATIENT_ID_SYSTEM = 'https://dosespot.com/patient-id';\nexport const DOSESPOT_PHARMACY_ID_SYSTEM = 'https://dosespot.com/pharmacy-id';\nexport const DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM = 'https://dosespot.com/clinic-favorite-medication-id';\nexport const DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM = 'https://dosespot.com/dispensable-drug-id';\n\n// Bot identifiers - Pharmacy\nexport const DOSESPOT_SEARCH_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-search-pharmacy-bot',\n};\n\nexport const DOSESPOT_ADD_PATIENT_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-add-patient-pharmacy-bot',\n};\n\n// Bot identifiers - Patient and Medications\nexport const DOSESPOT_PATIENT_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-patient-sync-bot',\n};\n\nexport const DOSESPOT_IFRAME_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-iframe-bot',\n};\n\nexport const DOSESPOT_ADD_FAVORITE_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-add-favorite-medication-bot',\n};\n\nexport const DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-get-favorite-medications-bot',\n};\n\nexport const DOSESPOT_SEARCH_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-search-medication-bot',\n};\n\nexport const DOSESPOT_MEDICATION_HISTORY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-medication-history-bot',\n};\n\nexport const DOSESPOT_PRESCRIPTIONS_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-prescriptions-sync-bot',\n};\n\nexport const DOSESPOT_NOTIFICATION_COUNTS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-notification-counts-bot',\n};\n\n// DoseSpot notification response type\nexport interface DoseSpotNotificationCountsResponse {\n PendingPrescriptionsCount: number;\n PendingRxChangeCount: number;\n RefillRequestsCount: number;\n TransactionErrorsCount: number;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { isCodeableConcept, isCoding } from '@medplum/core';\nimport type { CodeableConcept, Coding, MedicationKnowledge } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useState } from 'react';\nimport { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, DOSESPOT_SEARCH_MEDICATIONS_BOT } from './common';\n\nexport interface DoseSpotClinicFormularyReturn {\n state: DoseSpotClinicFormularyState;\n /**\n * Search for DoseSpot Medications and returns array of temporary MedicationKnowledge objects that are not yet saved to the FHIR server\n */\n readonly searchMedications: (searchTerm: string) => Promise<CodeableConcept[]>;\n /**\n * Set the currently selected medication. Can be set as a CodeableConcept or a Coding, but state is always stored as a CodeableConcept\n */\n readonly setSelectedMedication: (medication: CodeableConcept | Coding | undefined) => void;\n /**\n * Set the directions for the currently selected medication\n */\n readonly setSelectedMedicationDirections: (directions: string | undefined) => void;\n /**\n * Save a DoseSpot Medication to the Clinic's favorites and returns the MedicationKnowledge object that was saved\n */\n readonly saveFavoriteMedication: () => Promise<MedicationKnowledge>;\n /**\n * Clear the state\n */\n readonly clear: () => void;\n}\n\nexport interface DoseSpotClinicFormularyState {\n selectedMedication: CodeableConcept | undefined;\n directions: string | undefined;\n}\n\nexport function useDoseSpotClinicFormulary(): DoseSpotClinicFormularyReturn {\n const [directions, privateSetDirections] = useState<string | undefined>(undefined);\n const [selectedMedication, privateSetSelectedMedication] = useState<CodeableConcept | undefined>(undefined);\n const medplum = useMedplum();\n\n const state: DoseSpotClinicFormularyState = { selectedMedication, directions };\n\n const saveFavoriteMedication = useCallback(async (): Promise<MedicationKnowledge> => {\n if (!selectedMedication) {\n throw new Error('Must select a medication before adding a favorite medication');\n }\n\n //Add the directions to the medicationKnowledge object\n const medicationKnowledgeWithDirections = {\n resourceType: 'MedicationKnowledge',\n code: { ...selectedMedication },\n administrationGuidelines: [\n {\n dosage: [\n {\n dosage: [\n {\n patientInstruction: directions || '',\n },\n ],\n type: {\n coding: [\n {\n system: 'https://dosespot.com/patient-instructions',\n },\n ],\n },\n },\n ],\n },\n ],\n };\n\n return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, medicationKnowledgeWithDirections);\n }, [selectedMedication, directions, medplum]);\n\n const searchMedications = useCallback(\n async (searchTerm: string): Promise<CodeableConcept[]> => {\n return (await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT, { name: searchTerm })) as CodeableConcept[];\n },\n [medplum]\n );\n\n const setSelectedMedicationDirections = (directions: string | undefined): void => {\n privateSetDirections(directions);\n };\n\n const setSelectedMedication = (medication: CodeableConcept | Coding | undefined): void => {\n let medicationToSet: CodeableConcept | undefined;\n if (isCodeableConcept(medication)) {\n medicationToSet = { ...medication };\n } else if (isCoding(medication)) {\n medicationToSet = {\n text: medication.display || '',\n coding: [medication],\n };\n }\n privateSetSelectedMedication(medicationToSet);\n };\n\n const clear = (): void => {\n privateSetSelectedMedication(undefined);\n privateSetDirections(undefined);\n };\n\n return {\n state,\n searchMedications,\n setSelectedMedication,\n setSelectedMedicationDirections,\n saveFavoriteMedication,\n clear,\n };\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { DOSESPOT_IFRAME_BOT, DOSESPOT_PATIENT_SYNC_BOT } from './common';\n\nexport interface DoseSpotIFrameOptions {\n readonly patientId?: string;\n readonly onPatientSyncSuccess?: () => void;\n readonly onIframeSuccess?: (url: string) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nexport function useDoseSpotIFrame(options: DoseSpotIFrameOptions): string | undefined {\n const medplum = useMedplum();\n const { patientId, onPatientSyncSuccess, onIframeSuccess, onError } = options;\n const initializingRef = useRef<boolean>(false);\n const [iframeUrl, setIframeUrl] = useState<string | undefined>(undefined);\n\n const onPatientSyncSuccessRef = useRef(onPatientSyncSuccess);\n onPatientSyncSuccessRef.current = onPatientSyncSuccess;\n\n const onIframeSuccessRef = useRef(onIframeSuccess);\n onIframeSuccessRef.current = onIframeSuccess;\n\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n\n // Reset when inputs change so we re-fetch the iframe URL\n useEffect(() => {\n initializingRef.current = false;\n }, [patientId]);\n\n const initPage = useCallback(async () => {\n if (initializingRef.current) {\n return;\n }\n\n initializingRef.current = true;\n try {\n if (patientId) {\n await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT, { patientId });\n onPatientSyncSuccessRef.current?.();\n }\n const result = await medplum.executeBot(DOSESPOT_IFRAME_BOT, { patientId });\n if (result.url) {\n setIframeUrl(result.url);\n onIframeSuccessRef.current?.(result.url);\n }\n } catch (err: unknown) {\n onErrorRef.current?.(err);\n }\n }, [medplum, patientId]);\n\n useEffect(() => {\n initPage().catch(console.error);\n }, [initPage]);\n\n return iframeUrl;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { DoseSpotNotificationCountsResponse } from './common';\nimport { DOSESPOT_NOTIFICATION_COUNTS_BOT } from './common';\n\nexport interface DoseSpotNotificationsOptions {\n readonly refreshIntervalMilliseconds?: number;\n readonly onChange?: (count: number) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nconst DEFAULT_REFRESH_INTERVAL_MILLISECONDS = 10000;\n\nexport function useDoseSpotNotifications(options?: DoseSpotNotificationsOptions): number | undefined {\n const medplum = useMedplum();\n const { onChange, onError } = options ?? {};\n const hasDoseSpot = medplum.getProjectMembership()?.identifier?.some((i) => i.system?.includes('dosespot'));\n const refreshInterval = options?.refreshIntervalMilliseconds ?? DEFAULT_REFRESH_INTERVAL_MILLISECONDS;\n const timerRef = useRef<NodeJS.Timeout | undefined>(undefined);\n const [unreadCount, setUnreadCount] = useState<number | undefined>(undefined);\n\n const stopTimer = useCallback(() => {\n const timerId = timerRef.current;\n if (timerId) {\n clearInterval(timerId);\n }\n }, []);\n\n const updateCount = useCallback(async () => {\n try {\n const result = (await medplum.executeBot(\n DOSESPOT_NOTIFICATION_COUNTS_BOT,\n {}\n )) as DoseSpotNotificationCountsResponse;\n\n let newCount = 0;\n if (result.PendingPrescriptionsCount) {\n newCount += result.PendingPrescriptionsCount;\n }\n if (result.PendingRxChangeCount) {\n newCount += result.PendingRxChangeCount;\n }\n if (result.RefillRequestsCount) {\n newCount += result.RefillRequestsCount;\n }\n if (result.TransactionErrorsCount) {\n newCount += result.TransactionErrorsCount;\n }\n if (newCount !== unreadCount) {\n setUnreadCount(newCount);\n onChange?.(newCount);\n }\n } catch (err: unknown) {\n onError?.(err);\n stopTimer();\n }\n }, [medplum, unreadCount, onChange, onError, stopTimer]);\n\n const startTimer = useCallback(() => {\n timerRef.current = setInterval(() => {\n updateCount().catch(console.error);\n }, refreshInterval);\n }, [updateCount, refreshInterval]);\n\n useEffect(() => {\n // Start an interval timer to update the count every 5 seconds\n if (hasDoseSpot) {\n startTimer();\n }\n\n // Clear the interval timer when the component is unmounted\n return stopTimer;\n }, [hasDoseSpot, startTimer, stopTimer]);\n\n return unreadCount;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { Organization } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useState } from 'react';\nimport { DOSESPOT_ADD_PATIENT_PHARMACY_BOT, DOSESPOT_SEARCH_PHARMACY_BOT } from './common';\nimport { getPharmacyIdFromOrganization } from './utils';\n\n/**\n * Search parameters for pharmacy search.\n * See DoseSpot API section 3.13.2.\n */\nexport interface PharmacySearchParams {\n /** Pharmacy's store name (min 3 chars) */\n name?: string;\n /** City (min 3 chars) */\n city?: string;\n /** State (min 3 chars) */\n state?: string;\n /** Zip code (min 3 chars) */\n zip?: string;\n /** Address (min 3 chars) */\n address?: string;\n /** Phone or fax number */\n phoneOrFax?: string;\n /** Collection of pharmacy specialties (numeric values) */\n specialty?: number[];\n /** National Council for Prescription Drug Programs Identifier */\n ncpdpID?: string;\n /** Page number of results (defaults to 1) */\n pageNumber?: number;\n}\n\n/**\n * Response from adding a pharmacy to a patient's favorites.\n */\nexport interface AddPatientPharmacyResponse {\n /** Whether the operation was successful */\n success: boolean;\n /** A message describing the result */\n message: string;\n /** The persisted Organization resource with ID */\n organization?: Organization;\n}\n\n/**\n * State managed by the useDoseSpotPatientPharmacy hook.\n */\nexport interface DoseSpotPatientPharmacyState {\n /** The currently selected pharmacy Organization */\n selectedPharmacy: Organization | undefined;\n /** Whether to set the selected pharmacy as the patient's primary pharmacy */\n setAsPrimary: boolean;\n}\n\n/**\n * Return type for the useDoseSpotPatientPharmacy hook.\n */\nexport interface DoseSpotPatientPharmacyReturn {\n /** Current state of the hook */\n state: DoseSpotPatientPharmacyState;\n /**\n * Search for pharmacies in DoseSpot.\n * Returns synthetic Organization resources (not persisted to DB).\n */\n readonly searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;\n /**\n * Set the currently selected pharmacy.\n */\n readonly setSelectedPharmacy: (pharmacy: Organization | undefined) => void;\n /**\n * Set whether to add the pharmacy as the patient's primary pharmacy.\n */\n readonly setAsPrimary: (primary: boolean) => void;\n /**\n * Add the selected pharmacy to the patient's favorites in DoseSpot.\n * @param patientId - The Medplum Patient ID\n */\n readonly addFavoritePharmacy: (patientId: string) => Promise<AddPatientPharmacyResponse>;\n /**\n * Clear the state (selected pharmacy and setAsPrimary flag).\n */\n readonly clear: () => void;\n}\n\n/**\n * React hook for searching DoseSpot pharmacies and adding them to patient favorites.\n *\n * @returns The hook return object with state and methods.\n *\n * @example\n * ```tsx\n * function PharmacySearch({ patientId }: { patientId: string }) {\n * const {\n * state,\n * searchPharmacies,\n * setSelectedPharmacy,\n * setAsPrimary,\n * addFavoritePharmacy,\n * clear\n * } = useDoseSpotPatientPharmacy();\n *\n * const handleSearch = async () => {\n * const results = await searchPharmacies({ zip: '94118' });\n * // Display results to user\n * };\n *\n * const handleAddFavorite = async () => {\n * const result = await addFavoritePharmacy(patientId);\n * if (result.success) {\n * clear();\n * }\n * };\n * }\n * ```\n */\nexport function useDoseSpotPatientPharmacy(): DoseSpotPatientPharmacyReturn {\n const [selectedPharmacy, privateSetSelectedPharmacy] = useState<Organization | undefined>(undefined);\n const [setAsPrimaryState, privateSetAsPrimary] = useState<boolean>(false);\n const medplum = useMedplum();\n\n const state: DoseSpotPatientPharmacyState = {\n selectedPharmacy,\n setAsPrimary: setAsPrimaryState,\n };\n\n const searchPharmacies = useCallback(\n async (params: PharmacySearchParams): Promise<Organization[]> => {\n return (await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT, params)) as Organization[];\n },\n [medplum]\n );\n\n const setSelectedPharmacy = (pharmacy: Organization | undefined): void => {\n privateSetSelectedPharmacy(pharmacy);\n };\n\n const setAsPrimary = (primary: boolean): void => {\n privateSetAsPrimary(primary);\n };\n\n const addFavoritePharmacy = useCallback(\n async (patientId: string): Promise<AddPatientPharmacyResponse> => {\n if (!selectedPharmacy) {\n throw new Error('Must select a pharmacy before adding it as a favorite');\n }\n\n const pharmacyId = getPharmacyIdFromOrganization(selectedPharmacy);\n if (!pharmacyId) {\n throw new Error('Selected pharmacy does not have a valid DoseSpot pharmacy ID');\n }\n\n return medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT, {\n patientId,\n pharmacy: selectedPharmacy,\n setAsPrimary: setAsPrimaryState,\n }) as Promise<AddPatientPharmacyResponse>;\n },\n [selectedPharmacy, setAsPrimaryState, medplum]\n );\n\n const clear = (): void => {\n privateSetSelectedPharmacy(undefined);\n privateSetAsPrimary(false);\n };\n\n return {\n state,\n searchPharmacies,\n setSelectedPharmacy,\n setAsPrimary,\n addFavoritePharmacy,\n clear,\n };\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationKnowledge, Organization } from '@medplum/fhirtypes';\nimport { DOSESPOT_PHARMACY_ID_SYSTEM } from './common';\n\nexport const getMedicationName = (medication: MedicationKnowledge | undefined): string => {\n return medication?.code?.text || '';\n};\n\n/**\n * Extracts the DoseSpot pharmacy ID from an Organization resource.\n * @param organization - The FHIR Organization resource representing a pharmacy.\n * @returns The DoseSpot pharmacy ID, or undefined if not found.\n */\nexport function getPharmacyIdFromOrganization(organization: Organization): number | undefined {\n const id = organization.identifier?.find((i) => i.system === DOSESPOT_PHARMACY_ID_SYSTEM)?.value;\n return id ? Number.parseInt(id, 10) : undefined;\n}\n\nexport {\n addPreferredPharmacyToPatient,\n createPreferredPharmacyExtension,\n getPreferredPharmaciesFromPatient,\n isAddPharmacyResponse,\n isOrganizationArray,\n PATIENT_PREFERRED_PHARMACY_URL,\n PHARMACY_PREFERENCE_TYPE_SYSTEM,\n PHARMACY_TYPE_PREFERRED,\n PHARMACY_TYPE_PRIMARY,\n removePreferredPharmacyFromPatient,\n} from '@medplum/core';\nexport type { PreferredPharmacy } from '@medplum/core';\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { AddFavoriteParams, AddPharmacyResponse, PharmacySearchParams } from '@medplum/core';\nimport { isAddPharmacyResponse, isOrganizationArray } from '@medplum/core';\nimport type { Organization } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback } from 'react';\nimport { DOSESPOT_ADD_PATIENT_PHARMACY_BOT, DOSESPOT_SEARCH_PHARMACY_BOT } from './common';\n\nexport interface UseDoseSpotPharmacySearchReturn {\n searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;\n addToFavorites: (params: AddFavoriteParams) => Promise<AddPharmacyResponse>;\n}\n\n/**\n * React hook that provides DoseSpot-specific pharmacy search and add-to-favorites functionality.\n *\n * This hook encapsulates calls to the DoseSpot pharmacy search and add patient pharmacy bots,\n * and can be composed with the generic `PharmacyDialog` component from `@medplum/react`.\n *\n * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.\n */\nexport function useDoseSpotPharmacySearch(): UseDoseSpotPharmacySearchReturn {\n const medplum = useMedplum();\n\n const searchPharmacies = useCallback(\n async (params: PharmacySearchParams): Promise<Organization[]> => {\n const response = await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT, params);\n\n if (!isOrganizationArray(response)) {\n throw new Error('Invalid response from pharmacy search');\n }\n\n return response;\n },\n [medplum]\n );\n\n const addToFavorites = useCallback(\n async (params: AddFavoriteParams): Promise<AddPharmacyResponse> => {\n const response = await medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT, {\n patientId: params.patientId,\n pharmacy: params.pharmacy,\n setAsPrimary: params.setAsPrimary,\n });\n\n if (!isAddPharmacyResponse(response)) {\n throw new Error('Invalid response from add pharmacy bot');\n }\n\n return response;\n },\n [medplum]\n );\n\n return { searchPharmacies, addToFavorites };\n}\n"],
|
|
5
|
+
"mappings": "wpBAAA,4nECSA,gBAWO,yBAdA,IAkBM,mBAAqB,+BAGrB,2BAA6B,kCAC7B,4BAA8B,mCAC9B,mCAAqC,qDACrC,oCAAsC,2CAGtC,6BAA2C,CACtD,OAAQ,mBACR,MAAO,8BACT,EAEa,kCAAgD,CAC3D,OAAQ,mBACR,MAAO,mCACT,EAGa,0BAAwC,CACnD,OAAQ,mBACR,MAAO,2BACT,EAEa,oBAAkC,CAC7C,OAAQ,mBACR,MAAO,qBACT,EAEa,qCAAmD,CAC9D,OAAQ,mBACR,MAA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AAO,CAAE,iBAAkB,cAAe,CAC5C",
|
|
6
|
+
"names": ["import_core", "directions", "import_react_hooks", "import_react", "import_react_hooks", "import_react", "import_react_hooks", "import_react", "import_core", "import_core", "import_react_hooks", "import_react"]
|
|
7
7
|
}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,29 +1,81 @@
|
|
|
1
|
+
import type { AddFavoriteParams } from '@medplum/core';
|
|
2
|
+
import type { AddPharmacyResponse } from '@medplum/core';
|
|
3
|
+
import { addPreferredPharmacyToPatient } from '@medplum/core';
|
|
1
4
|
import type { CodeableConcept } from '@medplum/fhirtypes';
|
|
2
5
|
import type { Coding } from '@medplum/fhirtypes';
|
|
3
|
-
import
|
|
6
|
+
import { createPreferredPharmacyExtension } from '@medplum/core';
|
|
7
|
+
import { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT } from '@medplum/dosespot-core';
|
|
8
|
+
import { DOSESPOT_ADD_PATIENT_PHARMACY_BOT } from '@medplum/dosespot-core';
|
|
9
|
+
import { DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
10
|
+
import { DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
11
|
+
import { DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT } from '@medplum/dosespot-core';
|
|
12
|
+
import { DOSESPOT_IFRAME_BOT } from '@medplum/dosespot-core';
|
|
13
|
+
import { DOSESPOT_MEDICATION_HISTORY_BOT } from '@medplum/dosespot-core';
|
|
14
|
+
import { DOSESPOT_NOTIFICATION_COUNTS_BOT } from '@medplum/dosespot-core';
|
|
15
|
+
import { DOSESPOT_PATIENT_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
16
|
+
import { DOSESPOT_PATIENT_SYNC_BOT } from '@medplum/dosespot-core';
|
|
17
|
+
import { DOSESPOT_PHARMACY_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
18
|
+
import { DOSESPOT_PRESCRIPTIONS_SYNC_BOT } from '@medplum/dosespot-core';
|
|
19
|
+
import { DOSESPOT_SEARCH_MEDICATIONS_BOT } from '@medplum/dosespot-core';
|
|
20
|
+
import { DOSESPOT_SEARCH_PHARMACY_BOT } from '@medplum/dosespot-core';
|
|
21
|
+
import { DoseSpotNotificationCountsResponse } from '@medplum/dosespot-core';
|
|
22
|
+
import { getPreferredPharmaciesFromPatient } from '@medplum/core';
|
|
23
|
+
import { isAddPharmacyResponse } from '@medplum/core';
|
|
24
|
+
import { isOrganizationArray } from '@medplum/core';
|
|
4
25
|
import type { MedicationKnowledge } from '@medplum/fhirtypes';
|
|
26
|
+
import { MEDPLUM_BOT_SYSTEM } from '@medplum/dosespot-core';
|
|
27
|
+
import type { Organization } from '@medplum/fhirtypes';
|
|
28
|
+
import { PATIENT_PREFERRED_PHARMACY_URL } from '@medplum/core';
|
|
29
|
+
import { PHARMACY_PREFERENCE_TYPE_SYSTEM } from '@medplum/core';
|
|
30
|
+
import { PHARMACY_TYPE_PREFERRED } from '@medplum/core';
|
|
31
|
+
import { PHARMACY_TYPE_PRIMARY } from '@medplum/core';
|
|
32
|
+
import type { PharmacySearchParams as PharmacySearchParams_2 } from '@medplum/core';
|
|
33
|
+
import { PreferredPharmacy } from '@medplum/core';
|
|
34
|
+
import { removePreferredPharmacyFromPatient } from '@medplum/core';
|
|
5
35
|
|
|
6
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Response from adding a pharmacy to a patient's favorites.
|
|
38
|
+
*/
|
|
39
|
+
export declare interface AddPatientPharmacyResponse {
|
|
40
|
+
/** Whether the operation was successful */
|
|
41
|
+
success: boolean;
|
|
42
|
+
/** A message describing the result */
|
|
43
|
+
message: string;
|
|
44
|
+
/** The persisted Organization resource with ID */
|
|
45
|
+
organization?: Organization;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { addPreferredPharmacyToPatient }
|
|
49
|
+
|
|
50
|
+
export { createPreferredPharmacyExtension }
|
|
51
|
+
|
|
52
|
+
export { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT }
|
|
53
|
+
|
|
54
|
+
export { DOSESPOT_ADD_PATIENT_PHARMACY_BOT }
|
|
7
55
|
|
|
8
|
-
export
|
|
56
|
+
export { DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM }
|
|
9
57
|
|
|
10
|
-
export
|
|
58
|
+
export { DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM }
|
|
11
59
|
|
|
12
|
-
export
|
|
60
|
+
export { DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT }
|
|
13
61
|
|
|
14
|
-
export
|
|
62
|
+
export { DOSESPOT_IFRAME_BOT }
|
|
15
63
|
|
|
16
|
-
export
|
|
64
|
+
export { DOSESPOT_MEDICATION_HISTORY_BOT }
|
|
17
65
|
|
|
18
|
-
export
|
|
66
|
+
export { DOSESPOT_NOTIFICATION_COUNTS_BOT }
|
|
19
67
|
|
|
20
|
-
export
|
|
68
|
+
export { DOSESPOT_PATIENT_ID_SYSTEM }
|
|
21
69
|
|
|
22
|
-
export
|
|
70
|
+
export { DOSESPOT_PATIENT_SYNC_BOT }
|
|
23
71
|
|
|
24
|
-
export
|
|
72
|
+
export { DOSESPOT_PHARMACY_ID_SYSTEM }
|
|
25
73
|
|
|
26
|
-
export
|
|
74
|
+
export { DOSESPOT_PRESCRIPTIONS_SYNC_BOT }
|
|
75
|
+
|
|
76
|
+
export { DOSESPOT_SEARCH_MEDICATIONS_BOT }
|
|
77
|
+
|
|
78
|
+
export { DOSESPOT_SEARCH_PHARMACY_BOT }
|
|
27
79
|
|
|
28
80
|
export declare interface DoseSpotClinicFormularyReturn {
|
|
29
81
|
state: DoseSpotClinicFormularyState;
|
|
@@ -61,12 +113,7 @@ export declare interface DoseSpotIFrameOptions {
|
|
|
61
113
|
readonly onError?: (err: unknown) => void;
|
|
62
114
|
}
|
|
63
115
|
|
|
64
|
-
export
|
|
65
|
-
PendingPrescriptionsCount: number;
|
|
66
|
-
PendingRxChangeCount: number;
|
|
67
|
-
RefillRequestsCount: number;
|
|
68
|
-
TransactionErrorsCount: number;
|
|
69
|
-
}
|
|
116
|
+
export { DoseSpotNotificationCountsResponse }
|
|
70
117
|
|
|
71
118
|
export declare interface DoseSpotNotificationsOptions {
|
|
72
119
|
readonly refreshIntervalMilliseconds?: number;
|
|
@@ -74,9 +121,99 @@ export declare interface DoseSpotNotificationsOptions {
|
|
|
74
121
|
readonly onError?: (err: unknown) => void;
|
|
75
122
|
}
|
|
76
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Return type for the useDoseSpotPatientPharmacy hook.
|
|
126
|
+
*/
|
|
127
|
+
export declare interface DoseSpotPatientPharmacyReturn {
|
|
128
|
+
/** Current state of the hook */
|
|
129
|
+
state: DoseSpotPatientPharmacyState;
|
|
130
|
+
/**
|
|
131
|
+
* Search for pharmacies in DoseSpot.
|
|
132
|
+
* Returns synthetic Organization resources (not persisted to DB).
|
|
133
|
+
*/
|
|
134
|
+
readonly searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;
|
|
135
|
+
/**
|
|
136
|
+
* Set the currently selected pharmacy.
|
|
137
|
+
*/
|
|
138
|
+
readonly setSelectedPharmacy: (pharmacy: Organization | undefined) => void;
|
|
139
|
+
/**
|
|
140
|
+
* Set whether to add the pharmacy as the patient's primary pharmacy.
|
|
141
|
+
*/
|
|
142
|
+
readonly setAsPrimary: (primary: boolean) => void;
|
|
143
|
+
/**
|
|
144
|
+
* Add the selected pharmacy to the patient's favorites in DoseSpot.
|
|
145
|
+
* @param patientId - The Medplum Patient ID
|
|
146
|
+
*/
|
|
147
|
+
readonly addFavoritePharmacy: (patientId: string) => Promise<AddPatientPharmacyResponse>;
|
|
148
|
+
/**
|
|
149
|
+
* Clear the state (selected pharmacy and setAsPrimary flag).
|
|
150
|
+
*/
|
|
151
|
+
readonly clear: () => void;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* State managed by the useDoseSpotPatientPharmacy hook.
|
|
156
|
+
*/
|
|
157
|
+
export declare interface DoseSpotPatientPharmacyState {
|
|
158
|
+
/** The currently selected pharmacy Organization */
|
|
159
|
+
selectedPharmacy: Organization | undefined;
|
|
160
|
+
/** Whether to set the selected pharmacy as the patient's primary pharmacy */
|
|
161
|
+
setAsPrimary: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
77
164
|
export declare const getMedicationName: (medication: MedicationKnowledge | undefined) => string;
|
|
78
165
|
|
|
79
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Extracts the DoseSpot pharmacy ID from an Organization resource.
|
|
168
|
+
* @param organization - The FHIR Organization resource representing a pharmacy.
|
|
169
|
+
* @returns The DoseSpot pharmacy ID, or undefined if not found.
|
|
170
|
+
*/
|
|
171
|
+
export declare function getPharmacyIdFromOrganization(organization: Organization): number | undefined;
|
|
172
|
+
|
|
173
|
+
export { getPreferredPharmaciesFromPatient }
|
|
174
|
+
|
|
175
|
+
export { isAddPharmacyResponse }
|
|
176
|
+
|
|
177
|
+
export { isOrganizationArray }
|
|
178
|
+
|
|
179
|
+
export { MEDPLUM_BOT_SYSTEM }
|
|
180
|
+
|
|
181
|
+
export { PATIENT_PREFERRED_PHARMACY_URL }
|
|
182
|
+
|
|
183
|
+
export { PHARMACY_PREFERENCE_TYPE_SYSTEM }
|
|
184
|
+
|
|
185
|
+
export { PHARMACY_TYPE_PREFERRED }
|
|
186
|
+
|
|
187
|
+
export { PHARMACY_TYPE_PRIMARY }
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Search parameters for pharmacy search.
|
|
191
|
+
* See DoseSpot API section 3.13.2.
|
|
192
|
+
*/
|
|
193
|
+
export declare interface PharmacySearchParams {
|
|
194
|
+
/** Pharmacy's store name (min 3 chars) */
|
|
195
|
+
name?: string;
|
|
196
|
+
/** City (min 3 chars) */
|
|
197
|
+
city?: string;
|
|
198
|
+
/** State (min 3 chars) */
|
|
199
|
+
state?: string;
|
|
200
|
+
/** Zip code (min 3 chars) */
|
|
201
|
+
zip?: string;
|
|
202
|
+
/** Address (min 3 chars) */
|
|
203
|
+
address?: string;
|
|
204
|
+
/** Phone or fax number */
|
|
205
|
+
phoneOrFax?: string;
|
|
206
|
+
/** Collection of pharmacy specialties (numeric values) */
|
|
207
|
+
specialty?: number[];
|
|
208
|
+
/** National Council for Prescription Drug Programs Identifier */
|
|
209
|
+
ncpdpID?: string;
|
|
210
|
+
/** Page number of results (defaults to 1) */
|
|
211
|
+
pageNumber?: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export { PreferredPharmacy }
|
|
215
|
+
|
|
216
|
+
export { removePreferredPharmacyFromPatient }
|
|
80
217
|
|
|
81
218
|
export declare function useDoseSpotClinicFormulary(): DoseSpotClinicFormularyReturn;
|
|
82
219
|
|
|
@@ -84,4 +221,52 @@ export declare function useDoseSpotIFrame(options: DoseSpotIFrameOptions): strin
|
|
|
84
221
|
|
|
85
222
|
export declare function useDoseSpotNotifications(options?: DoseSpotNotificationsOptions): number | undefined;
|
|
86
223
|
|
|
224
|
+
/**
|
|
225
|
+
* React hook for searching DoseSpot pharmacies and adding them to patient favorites.
|
|
226
|
+
*
|
|
227
|
+
* @returns The hook return object with state and methods.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```tsx
|
|
231
|
+
* function PharmacySearch({ patientId }: { patientId: string }) {
|
|
232
|
+
* const {
|
|
233
|
+
* state,
|
|
234
|
+
* searchPharmacies,
|
|
235
|
+
* setSelectedPharmacy,
|
|
236
|
+
* setAsPrimary,
|
|
237
|
+
* addFavoritePharmacy,
|
|
238
|
+
* clear
|
|
239
|
+
* } = useDoseSpotPatientPharmacy();
|
|
240
|
+
*
|
|
241
|
+
* const handleSearch = async () => {
|
|
242
|
+
* const results = await searchPharmacies({ zip: '94118' });
|
|
243
|
+
* // Display results to user
|
|
244
|
+
* };
|
|
245
|
+
*
|
|
246
|
+
* const handleAddFavorite = async () => {
|
|
247
|
+
* const result = await addFavoritePharmacy(patientId);
|
|
248
|
+
* if (result.success) {
|
|
249
|
+
* clear();
|
|
250
|
+
* }
|
|
251
|
+
* };
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
export declare function useDoseSpotPatientPharmacy(): DoseSpotPatientPharmacyReturn;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* React hook that provides DoseSpot-specific pharmacy search and add-to-favorites functionality.
|
|
259
|
+
*
|
|
260
|
+
* This hook encapsulates calls to the DoseSpot pharmacy search and add patient pharmacy bots,
|
|
261
|
+
* and can be composed with the generic `PharmacyDialog` component from `@medplum/react`.
|
|
262
|
+
*
|
|
263
|
+
* @returns An object with `searchPharmacies` and `addToFavorites` callbacks.
|
|
264
|
+
*/
|
|
265
|
+
export declare function useDoseSpotPharmacySearch(): UseDoseSpotPharmacySearchReturn;
|
|
266
|
+
|
|
267
|
+
export declare interface UseDoseSpotPharmacySearchReturn {
|
|
268
|
+
searchPharmacies: (params: PharmacySearchParams_2) => Promise<Organization[]>;
|
|
269
|
+
addToFavorites: (params: AddFavoriteParams) => Promise<AddPharmacyResponse>;
|
|
270
|
+
}
|
|
271
|
+
|
|
87
272
|
export { }
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,29 +1,81 @@
|
|
|
1
|
+
import type { AddFavoriteParams } from '@medplum/core';
|
|
2
|
+
import type { AddPharmacyResponse } from '@medplum/core';
|
|
3
|
+
import { addPreferredPharmacyToPatient } from '@medplum/core';
|
|
1
4
|
import type { CodeableConcept } from '@medplum/fhirtypes';
|
|
2
5
|
import type { Coding } from '@medplum/fhirtypes';
|
|
3
|
-
import
|
|
6
|
+
import { createPreferredPharmacyExtension } from '@medplum/core';
|
|
7
|
+
import { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT } from '@medplum/dosespot-core';
|
|
8
|
+
import { DOSESPOT_ADD_PATIENT_PHARMACY_BOT } from '@medplum/dosespot-core';
|
|
9
|
+
import { DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
10
|
+
import { DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
11
|
+
import { DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT } from '@medplum/dosespot-core';
|
|
12
|
+
import { DOSESPOT_IFRAME_BOT } from '@medplum/dosespot-core';
|
|
13
|
+
import { DOSESPOT_MEDICATION_HISTORY_BOT } from '@medplum/dosespot-core';
|
|
14
|
+
import { DOSESPOT_NOTIFICATION_COUNTS_BOT } from '@medplum/dosespot-core';
|
|
15
|
+
import { DOSESPOT_PATIENT_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
16
|
+
import { DOSESPOT_PATIENT_SYNC_BOT } from '@medplum/dosespot-core';
|
|
17
|
+
import { DOSESPOT_PHARMACY_ID_SYSTEM } from '@medplum/dosespot-core';
|
|
18
|
+
import { DOSESPOT_PRESCRIPTIONS_SYNC_BOT } from '@medplum/dosespot-core';
|
|
19
|
+
import { DOSESPOT_SEARCH_MEDICATIONS_BOT } from '@medplum/dosespot-core';
|
|
20
|
+
import { DOSESPOT_SEARCH_PHARMACY_BOT } from '@medplum/dosespot-core';
|
|
21
|
+
import { DoseSpotNotificationCountsResponse } from '@medplum/dosespot-core';
|
|
22
|
+
import { getPreferredPharmaciesFromPatient } from '@medplum/core';
|
|
23
|
+
import { isAddPharmacyResponse } from '@medplum/core';
|
|
24
|
+
import { isOrganizationArray } from '@medplum/core';
|
|
4
25
|
import type { MedicationKnowledge } from '@medplum/fhirtypes';
|
|
26
|
+
import { MEDPLUM_BOT_SYSTEM } from '@medplum/dosespot-core';
|
|
27
|
+
import type { Organization } from '@medplum/fhirtypes';
|
|
28
|
+
import { PATIENT_PREFERRED_PHARMACY_URL } from '@medplum/core';
|
|
29
|
+
import { PHARMACY_PREFERENCE_TYPE_SYSTEM } from '@medplum/core';
|
|
30
|
+
import { PHARMACY_TYPE_PREFERRED } from '@medplum/core';
|
|
31
|
+
import { PHARMACY_TYPE_PRIMARY } from '@medplum/core';
|
|
32
|
+
import type { PharmacySearchParams as PharmacySearchParams_2 } from '@medplum/core';
|
|
33
|
+
import { PreferredPharmacy } from '@medplum/core';
|
|
34
|
+
import { removePreferredPharmacyFromPatient } from '@medplum/core';
|
|
5
35
|
|
|
6
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Response from adding a pharmacy to a patient's favorites.
|
|
38
|
+
*/
|
|
39
|
+
export declare interface AddPatientPharmacyResponse {
|
|
40
|
+
/** Whether the operation was successful */
|
|
41
|
+
success: boolean;
|
|
42
|
+
/** A message describing the result */
|
|
43
|
+
message: string;
|
|
44
|
+
/** The persisted Organization resource with ID */
|
|
45
|
+
organization?: Organization;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { addPreferredPharmacyToPatient }
|
|
49
|
+
|
|
50
|
+
export { createPreferredPharmacyExtension }
|
|
51
|
+
|
|
52
|
+
export { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT }
|
|
53
|
+
|
|
54
|
+
export { DOSESPOT_ADD_PATIENT_PHARMACY_BOT }
|
|
7
55
|
|
|
8
|
-
export
|
|
56
|
+
export { DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM }
|
|
9
57
|
|
|
10
|
-
export
|
|
58
|
+
export { DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM }
|
|
11
59
|
|
|
12
|
-
export
|
|
60
|
+
export { DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT }
|
|
13
61
|
|
|
14
|
-
export
|
|
62
|
+
export { DOSESPOT_IFRAME_BOT }
|
|
15
63
|
|
|
16
|
-
export
|
|
64
|
+
export { DOSESPOT_MEDICATION_HISTORY_BOT }
|
|
17
65
|
|
|
18
|
-
export
|
|
66
|
+
export { DOSESPOT_NOTIFICATION_COUNTS_BOT }
|
|
19
67
|
|
|
20
|
-
export
|
|
68
|
+
export { DOSESPOT_PATIENT_ID_SYSTEM }
|
|
21
69
|
|
|
22
|
-
export
|
|
70
|
+
export { DOSESPOT_PATIENT_SYNC_BOT }
|
|
23
71
|
|
|
24
|
-
export
|
|
72
|
+
export { DOSESPOT_PHARMACY_ID_SYSTEM }
|
|
25
73
|
|
|
26
|
-
export
|
|
74
|
+
export { DOSESPOT_PRESCRIPTIONS_SYNC_BOT }
|
|
75
|
+
|
|
76
|
+
export { DOSESPOT_SEARCH_MEDICATIONS_BOT }
|
|
77
|
+
|
|
78
|
+
export { DOSESPOT_SEARCH_PHARMACY_BOT }
|
|
27
79
|
|
|
28
80
|
export declare interface DoseSpotClinicFormularyReturn {
|
|
29
81
|
state: DoseSpotClinicFormularyState;
|
|
@@ -61,12 +113,7 @@ export declare interface DoseSpotIFrameOptions {
|
|
|
61
113
|
readonly onError?: (err: unknown) => void;
|
|
62
114
|
}
|
|
63
115
|
|
|
64
|
-
export
|
|
65
|
-
PendingPrescriptionsCount: number;
|
|
66
|
-
PendingRxChangeCount: number;
|
|
67
|
-
RefillRequestsCount: number;
|
|
68
|
-
TransactionErrorsCount: number;
|
|
69
|
-
}
|
|
116
|
+
export { DoseSpotNotificationCountsResponse }
|
|
70
117
|
|
|
71
118
|
export declare interface DoseSpotNotificationsOptions {
|
|
72
119
|
readonly refreshIntervalMilliseconds?: number;
|
|
@@ -74,9 +121,99 @@ export declare interface DoseSpotNotificationsOptions {
|
|
|
74
121
|
readonly onError?: (err: unknown) => void;
|
|
75
122
|
}
|
|
76
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Return type for the useDoseSpotPatientPharmacy hook.
|
|
126
|
+
*/
|
|
127
|
+
export declare interface DoseSpotPatientPharmacyReturn {
|
|
128
|
+
/** Current state of the hook */
|
|
129
|
+
state: DoseSpotPatientPharmacyState;
|
|
130
|
+
/**
|
|
131
|
+
* Search for pharmacies in DoseSpot.
|
|
132
|
+
* Returns synthetic Organization resources (not persisted to DB).
|
|
133
|
+
*/
|
|
134
|
+
readonly searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;
|
|
135
|
+
/**
|
|
136
|
+
* Set the currently selected pharmacy.
|
|
137
|
+
*/
|
|
138
|
+
readonly setSelectedPharmacy: (pharmacy: Organization | undefined) => void;
|
|
139
|
+
/**
|
|
140
|
+
* Set whether to add the pharmacy as the patient's primary pharmacy.
|
|
141
|
+
*/
|
|
142
|
+
readonly setAsPrimary: (primary: boolean) => void;
|
|
143
|
+
/**
|
|
144
|
+
* Add the selected pharmacy to the patient's favorites in DoseSpot.
|
|
145
|
+
* @param patientId - The Medplum Patient ID
|
|
146
|
+
*/
|
|
147
|
+
readonly addFavoritePharmacy: (patientId: string) => Promise<AddPatientPharmacyResponse>;
|
|
148
|
+
/**
|
|
149
|
+
* Clear the state (selected pharmacy and setAsPrimary flag).
|
|
150
|
+
*/
|
|
151
|
+
readonly clear: () => void;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* State managed by the useDoseSpotPatientPharmacy hook.
|
|
156
|
+
*/
|
|
157
|
+
export declare interface DoseSpotPatientPharmacyState {
|
|
158
|
+
/** The currently selected pharmacy Organization */
|
|
159
|
+
selectedPharmacy: Organization | undefined;
|
|
160
|
+
/** Whether to set the selected pharmacy as the patient's primary pharmacy */
|
|
161
|
+
setAsPrimary: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
77
164
|
export declare const getMedicationName: (medication: MedicationKnowledge | undefined) => string;
|
|
78
165
|
|
|
79
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Extracts the DoseSpot pharmacy ID from an Organization resource.
|
|
168
|
+
* @param organization - The FHIR Organization resource representing a pharmacy.
|
|
169
|
+
* @returns The DoseSpot pharmacy ID, or undefined if not found.
|
|
170
|
+
*/
|
|
171
|
+
export declare function getPharmacyIdFromOrganization(organization: Organization): number | undefined;
|
|
172
|
+
|
|
173
|
+
export { getPreferredPharmaciesFromPatient }
|
|
174
|
+
|
|
175
|
+
export { isAddPharmacyResponse }
|
|
176
|
+
|
|
177
|
+
export { isOrganizationArray }
|
|
178
|
+
|
|
179
|
+
export { MEDPLUM_BOT_SYSTEM }
|
|
180
|
+
|
|
181
|
+
export { PATIENT_PREFERRED_PHARMACY_URL }
|
|
182
|
+
|
|
183
|
+
export { PHARMACY_PREFERENCE_TYPE_SYSTEM }
|
|
184
|
+
|
|
185
|
+
export { PHARMACY_TYPE_PREFERRED }
|
|
186
|
+
|
|
187
|
+
export { PHARMACY_TYPE_PRIMARY }
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Search parameters for pharmacy search.
|
|
191
|
+
* See DoseSpot API section 3.13.2.
|
|
192
|
+
*/
|
|
193
|
+
export declare interface PharmacySearchParams {
|
|
194
|
+
/** Pharmacy's store name (min 3 chars) */
|
|
195
|
+
name?: string;
|
|
196
|
+
/** City (min 3 chars) */
|
|
197
|
+
city?: string;
|
|
198
|
+
/** State (min 3 chars) */
|
|
199
|
+
state?: string;
|
|
200
|
+
/** Zip code (min 3 chars) */
|
|
201
|
+
zip?: string;
|
|
202
|
+
/** Address (min 3 chars) */
|
|
203
|
+
address?: string;
|
|
204
|
+
/** Phone or fax number */
|
|
205
|
+
phoneOrFax?: string;
|
|
206
|
+
/** Collection of pharmacy specialties (numeric values) */
|
|
207
|
+
specialty?: number[];
|
|
208
|
+
/** National Council for Prescription Drug Programs Identifier */
|
|
209
|
+
ncpdpID?: string;
|
|
210
|
+
/** Page number of results (defaults to 1) */
|
|
211
|
+
pageNumber?: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export { PreferredPharmacy }
|
|
215
|
+
|
|
216
|
+
export { removePreferredPharmacyFromPatient }
|
|
80
217
|
|
|
81
218
|
export declare function useDoseSpotClinicFormulary(): DoseSpotClinicFormularyReturn;
|
|
82
219
|
|
|
@@ -84,4 +221,52 @@ export declare function useDoseSpotIFrame(options: DoseSpotIFrameOptions): strin
|
|
|
84
221
|
|
|
85
222
|
export declare function useDoseSpotNotifications(options?: DoseSpotNotificationsOptions): number | undefined;
|
|
86
223
|
|
|
224
|
+
/**
|
|
225
|
+
* React hook for searching DoseSpot pharmacies and adding them to patient favorites.
|
|
226
|
+
*
|
|
227
|
+
* @returns The hook return object with state and methods.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```tsx
|
|
231
|
+
* function PharmacySearch({ patientId }: { patientId: string }) {
|
|
232
|
+
* const {
|
|
233
|
+
* state,
|
|
234
|
+
* searchPharmacies,
|
|
235
|
+
* setSelectedPharmacy,
|
|
236
|
+
* setAsPrimary,
|
|
237
|
+
* addFavoritePharmacy,
|
|
238
|
+
* clear
|
|
239
|
+
* } = useDoseSpotPatientPharmacy();
|
|
240
|
+
*
|
|
241
|
+
* const handleSearch = async () => {
|
|
242
|
+
* const results = await searchPharmacies({ zip: '94118' });
|
|
243
|
+
* // Display results to user
|
|
244
|
+
* };
|
|
245
|
+
*
|
|
246
|
+
* const handleAddFavorite = async () => {
|
|
247
|
+
* const result = await addFavoritePharmacy(patientId);
|
|
248
|
+
* if (result.success) {
|
|
249
|
+
* clear();
|
|
250
|
+
* }
|
|
251
|
+
* };
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
export declare function useDoseSpotPatientPharmacy(): DoseSpotPatientPharmacyReturn;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* React hook that provides DoseSpot-specific pharmacy search and add-to-favorites functionality.
|
|
259
|
+
*
|
|
260
|
+
* This hook encapsulates calls to the DoseSpot pharmacy search and add patient pharmacy bots,
|
|
261
|
+
* and can be composed with the generic `PharmacyDialog` component from `@medplum/react`.
|
|
262
|
+
*
|
|
263
|
+
* @returns An object with `searchPharmacies` and `addToFavorites` callbacks.
|
|
264
|
+
*/
|
|
265
|
+
export declare function useDoseSpotPharmacySearch(): UseDoseSpotPharmacySearchReturn;
|
|
266
|
+
|
|
267
|
+
export declare interface UseDoseSpotPharmacySearchReturn {
|
|
268
|
+
searchPharmacies: (params: PharmacySearchParams_2) => Promise<Organization[]>;
|
|
269
|
+
addToFavorites: (params: AddFavoriteParams) => Promise<AddPharmacyResponse>;
|
|
270
|
+
}
|
|
271
|
+
|
|
87
272
|
export { }
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",DOSESPOT_PATIENT_ID_SYSTEM="https://dosespot.com/patient-id",DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM="https://dosespot.com/clinic-favorite-medication-id",DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM="https://dosespot.com/dispensable-drug-id",DOSESPOT_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-patient-sync-bot"},DOSESPOT_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-iframe-bot"},DOSESPOT_ADD_FAVORITE_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-add-favorite-medication-bot"},DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-get-favorite-medications-bot"},DOSESPOT_SEARCH_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-search-medication-bot"},DOSESPOT_MEDICATION_HISTORY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-medication-history-bot"},DOSESPOT_PRESCRIPTIONS_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-prescriptions-sync-bot"},DOSESPOT_NOTIFICATION_COUNTS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-notification-counts-bot"};import{isCodeableConcept,isCoding}from"@medplum/core";import{useMedplum}from"@medplum/react-hooks";import{useCallback,useState}from"react";function useDoseSpotClinicFormulary(){let[directions,privateSetDirections]=useState(void 0),[selectedMedication,privateSetSelectedMedication]=useState(void 0),medplum=useMedplum(),state={selectedMedication,directions},saveFavoriteMedication=useCallback(async()=>{if(!selectedMedication)throw new Error("Must select a medication before adding a favorite medication");let medicationKnowledgeWithDirections={resourceType:"MedicationKnowledge",code:{...selectedMedication},administrationGuidelines:[{dosage:[{dosage:[{patientInstruction:directions||""}],type:{coding:[{system:"https://dosespot.com/patient-instructions"}]}}]}]};return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,medicationKnowledgeWithDirections)},[selectedMedication,directions,medplum]),searchMedications=useCallback(async searchTerm=>await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT,{name:searchTerm}),[medplum]);return{state,searchMedications,setSelectedMedication:medication=>{let medicationToSet;isCodeableConcept(medication)?medicationToSet={...medication}:isCoding(medication)&&(medicationToSet={text:medication.display||"",coding:[medication]}),privateSetSelectedMedication(medicationToSet)},setSelectedMedicationDirections:directions2=>{privateSetDirections(directions2)},saveFavoriteMedication,clear:()=>{privateSetSelectedMedication(void 0),privateSetDirections(void 0)}}}import{useMedplum as useMedplum2}from"@medplum/react-hooks";import{useCallback as useCallback2,useEffect,useRef,useState as useState2}from"react";function useDoseSpotIFrame(options){let medplum=useMedplum2(),{patientId,onPatientSyncSuccess,onIframeSuccess,onError}=options,initializingRef=useRef(!1),[iframeUrl,setIframeUrl]=useState2(void 0),onPatientSyncSuccessRef=useRef(onPatientSyncSuccess);onPatientSyncSuccessRef.current=onPatientSyncSuccess;let onIframeSuccessRef=useRef(onIframeSuccess);onIframeSuccessRef.current=onIframeSuccess;let onErrorRef=useRef(onError);onErrorRef.current=onError;let initPage=useCallback2(async()=>{if(!initializingRef.current){initializingRef.current=!0;try{patientId&&(await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT,{patientId}),onPatientSyncSuccessRef.current?.());let result=await medplum.executeBot(DOSESPOT_IFRAME_BOT,{patientId});result.url&&(setIframeUrl(result.url),onIframeSuccessRef.current?.(result.url))}catch(err){onErrorRef.current?.(err)}}},[medplum,patientId]);return useEffect(()=>{initPage().catch(console.error)},[initPage]),iframeUrl}import{useMedplum as useMedplum3}from"@medplum/react-hooks";import{useCallback as useCallback3,useEffect as useEffect2,useRef as useRef2,useState as useState3}from"react";var DEFAULT_REFRESH_INTERVAL_MILLISECONDS=1e4;function useDoseSpotNotifications(options){let medplum=useMedplum3(),{onChange,onError}=options??{},hasDoseSpot=medplum.getProjectMembership()?.identifier?.some(i=>i.system?.includes("dosespot")),refreshInterval=options?.refreshIntervalMilliseconds??DEFAULT_REFRESH_INTERVAL_MILLISECONDS,timerRef=useRef2(void 0),[unreadCount,setUnreadCount]=useState3(void 0),stopTimer=useCallback3(()=>{let timerId=timerRef.current;timerId&&clearInterval(timerId)},[]),updateCount=useCallback3(async()=>{try{let result=await medplum.executeBot(DOSESPOT_NOTIFICATION_COUNTS_BOT,{}),newCount=0;result.PendingPrescriptionsCount&&(newCount+=result.PendingPrescriptionsCount),result.PendingRxChangeCount&&(newCount+=result.PendingRxChangeCount),result.RefillRequestsCount&&(newCount+=result.RefillRequestsCount),result.TransactionErrorsCount&&(newCount+=result.TransactionErrorsCount),newCount!==unreadCount&&(setUnreadCount(newCount),onChange?.(newCount))}catch(err){onError?.(err),stopTimer()}},[medplum,unreadCount,onChange,onError,stopTimer]),startTimer=useCallback3(()=>{timerRef.current=setInterval(()=>{updateCount().catch(console.error)},refreshInterval)},[updateCount,refreshInterval]);return useEffect2(()=>(hasDoseSpot&&startTimer(),stopTimer),[hasDoseSpot,startTimer,stopTimer]),unreadCount}var getMedicationName=medication=>medication?.code?.text||"";export{DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM,DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM,DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT,DOSESPOT_IFRAME_BOT,DOSESPOT_MEDICATION_HISTORY_BOT,DOSESPOT_NOTIFICATION_COUNTS_BOT,DOSESPOT_PATIENT_ID_SYSTEM,DOSESPOT_PATIENT_SYNC_BOT,DOSESPOT_PRESCRIPTIONS_SYNC_BOT,DOSESPOT_SEARCH_MEDICATIONS_BOT,MEDPLUM_BOT_SYSTEM,getMedicationName,useDoseSpotClinicFormulary,useDoseSpotIFrame,useDoseSpotNotifications};
|
|
1
|
+
import{addPreferredPharmacyToPatient,createPreferredPharmacyExtension,getPreferredPharmaciesFromPatient,isAddPharmacyResponse,isOrganizationArray,PATIENT_PREFERRED_PHARMACY_URL,PHARMACY_PREFERENCE_TYPE_SYSTEM,PHARMACY_TYPE_PREFERRED,PHARMACY_TYPE_PRIMARY,removePreferredPharmacyFromPatient}from"@medplum/core";var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",DOSESPOT_PATIENT_ID_SYSTEM="https://dosespot.com/patient-id",DOSESPOT_PHARMACY_ID_SYSTEM="https://dosespot.com/pharmacy-id",DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM="https://dosespot.com/clinic-favorite-medication-id",DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM="https://dosespot.com/dispensable-drug-id",DOSESPOT_SEARCH_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-search-pharmacy-bot"},DOSESPOT_ADD_PATIENT_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-add-patient-pharmacy-bot"},DOSESPOT_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-patient-sync-bot"},DOSESPOT_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-iframe-bot"},DOSESPOT_ADD_FAVORITE_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-add-favorite-medication-bot"},DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-get-favorite-medications-bot"},DOSESPOT_SEARCH_MEDICATIONS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-search-medication-bot"},DOSESPOT_MEDICATION_HISTORY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-medication-history-bot"},DOSESPOT_PRESCRIPTIONS_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-prescriptions-sync-bot"},DOSESPOT_NOTIFICATION_COUNTS_BOT={system:MEDPLUM_BOT_SYSTEM,value:"dosespot-notification-counts-bot"};import{isCodeableConcept,isCoding}from"@medplum/core";import{useMedplum}from"@medplum/react-hooks";import{useCallback,useState}from"react";function useDoseSpotClinicFormulary(){let[directions,privateSetDirections]=useState(void 0),[selectedMedication,privateSetSelectedMedication]=useState(void 0),medplum=useMedplum(),state={selectedMedication,directions},saveFavoriteMedication=useCallback(async()=>{if(!selectedMedication)throw new Error("Must select a medication before adding a favorite medication");let medicationKnowledgeWithDirections={resourceType:"MedicationKnowledge",code:{...selectedMedication},administrationGuidelines:[{dosage:[{dosage:[{patientInstruction:directions||""}],type:{coding:[{system:"https://dosespot.com/patient-instructions"}]}}]}]};return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,medicationKnowledgeWithDirections)},[selectedMedication,directions,medplum]),searchMedications=useCallback(async searchTerm=>await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT,{name:searchTerm}),[medplum]);return{state,searchMedications,setSelectedMedication:medication=>{let medicationToSet;isCodeableConcept(medication)?medicationToSet={...medication}:isCoding(medication)&&(medicationToSet={text:medication.display||"",coding:[medication]}),privateSetSelectedMedication(medicationToSet)},setSelectedMedicationDirections:directions2=>{privateSetDirections(directions2)},saveFavoriteMedication,clear:()=>{privateSetSelectedMedication(void 0),privateSetDirections(void 0)}}}import{useMedplum as useMedplum2}from"@medplum/react-hooks";import{useCallback as useCallback2,useEffect,useRef,useState as useState2}from"react";function useDoseSpotIFrame(options){let medplum=useMedplum2(),{patientId,onPatientSyncSuccess,onIframeSuccess,onError}=options,initializingRef=useRef(!1),[iframeUrl,setIframeUrl]=useState2(void 0),onPatientSyncSuccessRef=useRef(onPatientSyncSuccess);onPatientSyncSuccessRef.current=onPatientSyncSuccess;let onIframeSuccessRef=useRef(onIframeSuccess);onIframeSuccessRef.current=onIframeSuccess;let onErrorRef=useRef(onError);onErrorRef.current=onError,useEffect(()=>{initializingRef.current=!1},[patientId]);let initPage=useCallback2(async()=>{if(!initializingRef.current){initializingRef.current=!0;try{patientId&&(await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT,{patientId}),onPatientSyncSuccessRef.current?.());let result=await medplum.executeBot(DOSESPOT_IFRAME_BOT,{patientId});result.url&&(setIframeUrl(result.url),onIframeSuccessRef.current?.(result.url))}catch(err){onErrorRef.current?.(err)}}},[medplum,patientId]);return useEffect(()=>{initPage().catch(console.error)},[initPage]),iframeUrl}import{useMedplum as useMedplum3}from"@medplum/react-hooks";import{useCallback as useCallback3,useEffect as useEffect2,useRef as useRef2,useState as useState3}from"react";var DEFAULT_REFRESH_INTERVAL_MILLISECONDS=1e4;function useDoseSpotNotifications(options){let medplum=useMedplum3(),{onChange,onError}=options??{},hasDoseSpot=medplum.getProjectMembership()?.identifier?.some(i=>i.system?.includes("dosespot")),refreshInterval=options?.refreshIntervalMilliseconds??DEFAULT_REFRESH_INTERVAL_MILLISECONDS,timerRef=useRef2(void 0),[unreadCount,setUnreadCount]=useState3(void 0),stopTimer=useCallback3(()=>{let timerId=timerRef.current;timerId&&clearInterval(timerId)},[]),updateCount=useCallback3(async()=>{try{let result=await medplum.executeBot(DOSESPOT_NOTIFICATION_COUNTS_BOT,{}),newCount=0;result.PendingPrescriptionsCount&&(newCount+=result.PendingPrescriptionsCount),result.PendingRxChangeCount&&(newCount+=result.PendingRxChangeCount),result.RefillRequestsCount&&(newCount+=result.RefillRequestsCount),result.TransactionErrorsCount&&(newCount+=result.TransactionErrorsCount),newCount!==unreadCount&&(setUnreadCount(newCount),onChange?.(newCount))}catch(err){onError?.(err),stopTimer()}},[medplum,unreadCount,onChange,onError,stopTimer]),startTimer=useCallback3(()=>{timerRef.current=setInterval(()=>{updateCount().catch(console.error)},refreshInterval)},[updateCount,refreshInterval]);return useEffect2(()=>(hasDoseSpot&&startTimer(),stopTimer),[hasDoseSpot,startTimer,stopTimer]),unreadCount}import{useMedplum as useMedplum4}from"@medplum/react-hooks";import{useCallback as useCallback4,useState as useState4}from"react";import{addPreferredPharmacyToPatient as addPreferredPharmacyToPatient2,createPreferredPharmacyExtension as createPreferredPharmacyExtension2,getPreferredPharmaciesFromPatient as getPreferredPharmaciesFromPatient2,isAddPharmacyResponse as isAddPharmacyResponse2,isOrganizationArray as isOrganizationArray2,PATIENT_PREFERRED_PHARMACY_URL as PATIENT_PREFERRED_PHARMACY_URL2,PHARMACY_PREFERENCE_TYPE_SYSTEM as PHARMACY_PREFERENCE_TYPE_SYSTEM2,PHARMACY_TYPE_PREFERRED as PHARMACY_TYPE_PREFERRED2,PHARMACY_TYPE_PRIMARY as PHARMACY_TYPE_PRIMARY2,removePreferredPharmacyFromPatient as removePreferredPharmacyFromPatient2}from"@medplum/core";var getMedicationName=medication=>medication?.code?.text||"";function getPharmacyIdFromOrganization(organization){let id=organization.identifier?.find(i=>i.system===DOSESPOT_PHARMACY_ID_SYSTEM)?.value;return id?Number.parseInt(id,10):void 0}function useDoseSpotPatientPharmacy(){let[selectedPharmacy,privateSetSelectedPharmacy]=useState4(void 0),[setAsPrimaryState,privateSetAsPrimary]=useState4(!1),medplum=useMedplum4(),state={selectedPharmacy,setAsPrimary:setAsPrimaryState},searchPharmacies=useCallback4(async params=>await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT,params),[medplum]),setSelectedPharmacy=pharmacy=>{privateSetSelectedPharmacy(pharmacy)},setAsPrimary=primary=>{privateSetAsPrimary(primary)},addFavoritePharmacy=useCallback4(async patientId=>{if(!selectedPharmacy)throw new Error("Must select a pharmacy before adding it as a favorite");if(!getPharmacyIdFromOrganization(selectedPharmacy))throw new Error("Selected pharmacy does not have a valid DoseSpot pharmacy ID");return medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT,{patientId,pharmacy:selectedPharmacy,setAsPrimary:setAsPrimaryState})},[selectedPharmacy,setAsPrimaryState,medplum]);return{state,searchPharmacies,setSelectedPharmacy,setAsPrimary,addFavoritePharmacy,clear:()=>{privateSetSelectedPharmacy(void 0),privateSetAsPrimary(!1)}}}import{isAddPharmacyResponse as isAddPharmacyResponse3,isOrganizationArray as isOrganizationArray3}from"@medplum/core";import{useMedplum as useMedplum5}from"@medplum/react-hooks";import{useCallback as useCallback5}from"react";function useDoseSpotPharmacySearch(){let medplum=useMedplum5(),searchPharmacies=useCallback5(async params=>{let response=await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT,params);if(!isOrganizationArray3(response))throw new Error("Invalid response from pharmacy search");return response},[medplum]),addToFavorites=useCallback5(async params=>{let response=await medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT,{patientId:params.patientId,pharmacy:params.pharmacy,setAsPrimary:params.setAsPrimary});if(!isAddPharmacyResponse3(response))throw new Error("Invalid response from add pharmacy bot");return response},[medplum]);return{searchPharmacies,addToFavorites}}export{DOSESPOT_ADD_FAVORITE_MEDICATION_BOT,DOSESPOT_ADD_PATIENT_PHARMACY_BOT,DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM,DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM,DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT,DOSESPOT_IFRAME_BOT,DOSESPOT_MEDICATION_HISTORY_BOT,DOSESPOT_NOTIFICATION_COUNTS_BOT,DOSESPOT_PATIENT_ID_SYSTEM,DOSESPOT_PATIENT_SYNC_BOT,DOSESPOT_PHARMACY_ID_SYSTEM,DOSESPOT_PRESCRIPTIONS_SYNC_BOT,DOSESPOT_SEARCH_MEDICATIONS_BOT,DOSESPOT_SEARCH_PHARMACY_BOT,MEDPLUM_BOT_SYSTEM,PATIENT_PREFERRED_PHARMACY_URL2 as PATIENT_PREFERRED_PHARMACY_URL,PHARMACY_PREFERENCE_TYPE_SYSTEM2 as PHARMACY_PREFERENCE_TYPE_SYSTEM,PHARMACY_TYPE_PREFERRED2 as PHARMACY_TYPE_PREFERRED,PHARMACY_TYPE_PRIMARY2 as PHARMACY_TYPE_PRIMARY,addPreferredPharmacyToPatient2 as addPreferredPharmacyToPatient,createPreferredPharmacyExtension2 as createPreferredPharmacyExtension,getMedicationName,getPharmacyIdFromOrganization,getPreferredPharmaciesFromPatient2 as getPreferredPharmaciesFromPatient,isAddPharmacyResponse2 as isAddPharmacyResponse,isOrganizationArray2 as isOrganizationArray,removePreferredPharmacyFromPatient2 as removePreferredPharmacyFromPatient,useDoseSpotClinicFormulary,useDoseSpotIFrame,useDoseSpotNotifications,useDoseSpotPatientPharmacy,useDoseSpotPharmacySearch};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
4
|
-
"sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { Identifier } from '@medplum/fhirtypes';\n\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\nexport const DOSESPOT_PATIENT_ID_SYSTEM = 'https://dosespot.com/patient-id';\n\nexport const DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM = 'https://dosespot.com/clinic-favorite-medication-id';\n\nexport const DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM = 'https://dosespot.com/dispensable-drug-id';\n\nexport const DOSESPOT_PATIENT_SYNC_BOT: Identifier = { system: MEDPLUM_BOT_SYSTEM, value: 'dosespot-patient-sync-bot' };\n\nexport const DOSESPOT_IFRAME_BOT: Identifier = { system: MEDPLUM_BOT_SYSTEM, value: 'dosespot-iframe-bot' };\n\nexport const DOSESPOT_ADD_FAVORITE_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-add-favorite-medication-bot',\n};\n\nexport const DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-get-favorite-medications-bot',\n};\n\nexport const DOSESPOT_SEARCH_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-search-medication-bot',\n};\n\nexport const DOSESPOT_MEDICATION_HISTORY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-medication-history-bot',\n};\n\nexport const DOSESPOT_PRESCRIPTIONS_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-prescriptions-sync-bot',\n};\n\nexport const DOSESPOT_NOTIFICATION_COUNTS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-notification-counts-bot',\n};\n\nexport interface DoseSpotNotificationCountsResponse {\n PendingPrescriptionsCount: number;\n PendingRxChangeCount: number;\n RefillRequestsCount: number;\n TransactionErrorsCount: number;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { isCodeableConcept, isCoding } from '@medplum/core';\nimport type { CodeableConcept, Coding, MedicationKnowledge } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useState } from 'react';\nimport { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, DOSESPOT_SEARCH_MEDICATIONS_BOT } from './common';\n\nexport interface DoseSpotClinicFormularyReturn {\n state: DoseSpotClinicFormularyState;\n /**\n * Search for DoseSpot Medications and returns array of temporary MedicationKnowledge objects that are not yet saved to the FHIR server\n */\n readonly searchMedications: (searchTerm: string) => Promise<CodeableConcept[]>;\n /**\n * Set the currently selected medication. Can be set as a CodeableConcept or a Coding, but state is always stored as a CodeableConcept\n */\n readonly setSelectedMedication: (medication: CodeableConcept | Coding | undefined) => void;\n /**\n * Set the directions for the currently selected medication\n */\n readonly setSelectedMedicationDirections: (directions: string | undefined) => void;\n /**\n * Save a DoseSpot Medication to the Clinic's favorites and returns the MedicationKnowledge object that was saved\n */\n readonly saveFavoriteMedication: () => Promise<MedicationKnowledge>;\n /**\n * Clear the state\n */\n readonly clear: () => void;\n}\n\nexport interface DoseSpotClinicFormularyState {\n selectedMedication: CodeableConcept | undefined;\n directions: string | undefined;\n}\n\nexport function useDoseSpotClinicFormulary(): DoseSpotClinicFormularyReturn {\n const [directions, privateSetDirections] = useState<string | undefined>(undefined);\n const [selectedMedication, privateSetSelectedMedication] = useState<CodeableConcept | undefined>(undefined);\n const medplum = useMedplum();\n\n const state: DoseSpotClinicFormularyState = { selectedMedication, directions };\n\n const saveFavoriteMedication = useCallback(async (): Promise<MedicationKnowledge> => {\n if (!selectedMedication) {\n throw new Error('Must select a medication before adding a favorite medication');\n }\n\n //Add the directions to the medicationKnowledge object\n const medicationKnowledgeWithDirections = {\n resourceType: 'MedicationKnowledge',\n code: { ...selectedMedication },\n administrationGuidelines: [\n {\n dosage: [\n {\n dosage: [\n {\n patientInstruction: directions || '',\n },\n ],\n type: {\n coding: [\n {\n system: 'https://dosespot.com/patient-instructions',\n },\n ],\n },\n },\n ],\n },\n ],\n };\n\n return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, medicationKnowledgeWithDirections);\n }, [selectedMedication, directions, medplum]);\n\n const searchMedications = useCallback(\n async (searchTerm: string): Promise<CodeableConcept[]> => {\n return (await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT, { name: searchTerm })) as CodeableConcept[];\n },\n [medplum]\n );\n\n const setSelectedMedicationDirections = (directions: string | undefined): void => {\n privateSetDirections(directions);\n };\n\n const setSelectedMedication = (medication: CodeableConcept | Coding | undefined): void => {\n let medicationToSet: CodeableConcept | undefined;\n if (isCodeableConcept(medication)) {\n medicationToSet = { ...medication };\n } else if (isCoding(medication)) {\n medicationToSet = {\n text: medication.display || '',\n coding: [medication],\n };\n }\n privateSetSelectedMedication(medicationToSet);\n };\n\n const clear = (): void => {\n privateSetSelectedMedication(undefined);\n privateSetDirections(undefined);\n };\n\n return {\n state,\n searchMedications,\n setSelectedMedication,\n setSelectedMedicationDirections,\n saveFavoriteMedication,\n clear,\n };\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { DOSESPOT_IFRAME_BOT, DOSESPOT_PATIENT_SYNC_BOT } from './common';\n\nexport interface DoseSpotIFrameOptions {\n readonly patientId?: string;\n readonly onPatientSyncSuccess?: () => void;\n readonly onIframeSuccess?: (url: string) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nexport function useDoseSpotIFrame(options: DoseSpotIFrameOptions): string | undefined {\n const medplum = useMedplum();\n const { patientId, onPatientSyncSuccess, onIframeSuccess, onError } = options;\n const initializingRef = useRef<boolean>(false);\n const [iframeUrl, setIframeUrl] = useState<string | undefined>(undefined);\n\n const onPatientSyncSuccessRef = useRef(onPatientSyncSuccess);\n onPatientSyncSuccessRef.current = onPatientSyncSuccess;\n\n const onIframeSuccessRef = useRef(onIframeSuccess);\n onIframeSuccessRef.current = onIframeSuccess;\n\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n\n const initPage = useCallback(async () => {\n if (initializingRef.current) {\n return;\n }\n\n initializingRef.current = true;\n try {\n if (patientId) {\n await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT, { patientId });\n onPatientSyncSuccessRef.current?.();\n }\n const result = await medplum.executeBot(DOSESPOT_IFRAME_BOT, { patientId });\n if (result.url) {\n setIframeUrl(result.url);\n onIframeSuccessRef.current?.(result.url);\n }\n } catch (err: unknown) {\n onErrorRef.current?.(err);\n }\n }, [medplum, patientId]);\n\n useEffect(() => {\n initPage().catch(console.error);\n }, [initPage]);\n\n return iframeUrl;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { DoseSpotNotificationCountsResponse } from './common';\nimport { DOSESPOT_NOTIFICATION_COUNTS_BOT } from './common';\n\nexport interface DoseSpotNotificationsOptions {\n readonly refreshIntervalMilliseconds?: number;\n readonly onChange?: (count: number) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nconst DEFAULT_REFRESH_INTERVAL_MILLISECONDS = 10000;\n\nexport function useDoseSpotNotifications(options?: DoseSpotNotificationsOptions): number | undefined {\n const medplum = useMedplum();\n const { onChange, onError } = options ?? {};\n const hasDoseSpot = medplum.getProjectMembership()?.identifier?.some((i) => i.system?.includes('dosespot'));\n const refreshInterval = options?.refreshIntervalMilliseconds ?? DEFAULT_REFRESH_INTERVAL_MILLISECONDS;\n const timerRef = useRef<NodeJS.Timeout | undefined>(undefined);\n const [unreadCount, setUnreadCount] = useState<number | undefined>(undefined);\n\n const stopTimer = useCallback(() => {\n const timerId = timerRef.current;\n if (timerId) {\n clearInterval(timerId);\n }\n }, []);\n\n const updateCount = useCallback(async () => {\n try {\n const result = (await medplum.executeBot(\n DOSESPOT_NOTIFICATION_COUNTS_BOT,\n {}\n )) as DoseSpotNotificationCountsResponse;\n\n let newCount = 0;\n if (result.PendingPrescriptionsCount) {\n newCount += result.PendingPrescriptionsCount;\n }\n if (result.PendingRxChangeCount) {\n newCount += result.PendingRxChangeCount;\n }\n if (result.RefillRequestsCount) {\n newCount += result.RefillRequestsCount;\n }\n if (result.TransactionErrorsCount) {\n newCount += result.TransactionErrorsCount;\n }\n if (newCount !== unreadCount) {\n setUnreadCount(newCount);\n onChange?.(newCount);\n }\n } catch (err: unknown) {\n onError?.(err);\n stopTimer();\n }\n }, [medplum, unreadCount, onChange, onError, stopTimer]);\n\n const startTimer = useCallback(() => {\n timerRef.current = setInterval(() => {\n updateCount().catch(console.error);\n }, refreshInterval);\n }, [updateCount, refreshInterval]);\n\n useEffect(() => {\n // Start an interval timer to update the count every 5 seconds\n if (hasDoseSpot) {\n startTimer();\n }\n\n // Clear the interval timer when the component is unmounted\n return stopTimer;\n }, [hasDoseSpot, startTimer, stopTimer]);\n\n return unreadCount;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationKnowledge } from '@medplum/fhirtypes';\n\nexport const getMedicationName = (medication: MedicationKnowledge | undefined): string => {\n return medication?.code?.text || '';\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["directions", "useMedplum", "useCallback", "useState", "useMedplum", "useState", "useCallback", "useMedplum", "useCallback", "useEffect", "useRef", "useState", "useMedplum", "useRef", "useState", "useCallback", "useEffect"]
|
|
3
|
+
"sources": ["../../../dosespot-core/src/pharmacy-utils.ts", "../../src/useDoseSpotClinicFormulary.ts", "../../src/useDoseSpotIFrame.ts", "../../src/useDoseSpotNotifications.ts", "../../src/useDoseSpotPatientPharmacy.ts", "../../src/utils.ts", "../../src/useDoseSpotPharmacySearch.ts"],
|
|
4
|
+
"sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Identifier } from '@medplum/fhirtypes';\n\n// DoseSpot-specific pharmacy preference type system\nexport const DOSESPOT_PHARMACY_PREFERENCE_TYPE_SYSTEM = 'https://dosespot.com/pharmacy-preference-type';\n\n// Re-export generic pharmacy utilities from @medplum/core\nexport {\n addPreferredPharmacyToPatient,\n createPreferredPharmacyExtension,\n getPreferredPharmaciesFromPatient,\n isAddPharmacyResponse,\n isOrganizationArray,\n PATIENT_PREFERRED_PHARMACY_URL,\n PHARMACY_PREFERENCE_TYPE_SYSTEM,\n PHARMACY_TYPE_PREFERRED,\n PHARMACY_TYPE_PRIMARY,\n removePreferredPharmacyFromPatient,\n} from '@medplum/core';\nexport type { AddFavoriteParams, AddPharmacyResponse, PharmacySearchParams, PreferredPharmacy } from '@medplum/core';\n\n// Bot system\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\n// DoseSpot identifier systems\nexport const DOSESPOT_PATIENT_ID_SYSTEM = 'https://dosespot.com/patient-id';\nexport const DOSESPOT_PHARMACY_ID_SYSTEM = 'https://dosespot.com/pharmacy-id';\nexport const DOSESPOT_CLINIC_FAVORITE_ID_SYSTEM = 'https://dosespot.com/clinic-favorite-medication-id';\nexport const DOSESPOT_DISPENSABLE_DRUG_ID_SYSTEM = 'https://dosespot.com/dispensable-drug-id';\n\n// Bot identifiers - Pharmacy\nexport const DOSESPOT_SEARCH_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-search-pharmacy-bot',\n};\n\nexport const DOSESPOT_ADD_PATIENT_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-add-patient-pharmacy-bot',\n};\n\n// Bot identifiers - Patient and Medications\nexport const DOSESPOT_PATIENT_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-patient-sync-bot',\n};\n\nexport const DOSESPOT_IFRAME_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-iframe-bot',\n};\n\nexport const DOSESPOT_ADD_FAVORITE_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-add-favorite-medication-bot',\n};\n\nexport const DOSESPOT_GET_FAVORITE_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-get-favorite-medications-bot',\n};\n\nexport const DOSESPOT_SEARCH_MEDICATIONS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-search-medication-bot',\n};\n\nexport const DOSESPOT_MEDICATION_HISTORY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-medication-history-bot',\n};\n\nexport const DOSESPOT_PRESCRIPTIONS_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-prescriptions-sync-bot',\n};\n\nexport const DOSESPOT_NOTIFICATION_COUNTS_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'dosespot-notification-counts-bot',\n};\n\n// DoseSpot notification response type\nexport interface DoseSpotNotificationCountsResponse {\n PendingPrescriptionsCount: number;\n PendingRxChangeCount: number;\n RefillRequestsCount: number;\n TransactionErrorsCount: number;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { isCodeableConcept, isCoding } from '@medplum/core';\nimport type { CodeableConcept, Coding, MedicationKnowledge } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useState } from 'react';\nimport { DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, DOSESPOT_SEARCH_MEDICATIONS_BOT } from './common';\n\nexport interface DoseSpotClinicFormularyReturn {\n state: DoseSpotClinicFormularyState;\n /**\n * Search for DoseSpot Medications and returns array of temporary MedicationKnowledge objects that are not yet saved to the FHIR server\n */\n readonly searchMedications: (searchTerm: string) => Promise<CodeableConcept[]>;\n /**\n * Set the currently selected medication. Can be set as a CodeableConcept or a Coding, but state is always stored as a CodeableConcept\n */\n readonly setSelectedMedication: (medication: CodeableConcept | Coding | undefined) => void;\n /**\n * Set the directions for the currently selected medication\n */\n readonly setSelectedMedicationDirections: (directions: string | undefined) => void;\n /**\n * Save a DoseSpot Medication to the Clinic's favorites and returns the MedicationKnowledge object that was saved\n */\n readonly saveFavoriteMedication: () => Promise<MedicationKnowledge>;\n /**\n * Clear the state\n */\n readonly clear: () => void;\n}\n\nexport interface DoseSpotClinicFormularyState {\n selectedMedication: CodeableConcept | undefined;\n directions: string | undefined;\n}\n\nexport function useDoseSpotClinicFormulary(): DoseSpotClinicFormularyReturn {\n const [directions, privateSetDirections] = useState<string | undefined>(undefined);\n const [selectedMedication, privateSetSelectedMedication] = useState<CodeableConcept | undefined>(undefined);\n const medplum = useMedplum();\n\n const state: DoseSpotClinicFormularyState = { selectedMedication, directions };\n\n const saveFavoriteMedication = useCallback(async (): Promise<MedicationKnowledge> => {\n if (!selectedMedication) {\n throw new Error('Must select a medication before adding a favorite medication');\n }\n\n //Add the directions to the medicationKnowledge object\n const medicationKnowledgeWithDirections = {\n resourceType: 'MedicationKnowledge',\n code: { ...selectedMedication },\n administrationGuidelines: [\n {\n dosage: [\n {\n dosage: [\n {\n patientInstruction: directions || '',\n },\n ],\n type: {\n coding: [\n {\n system: 'https://dosespot.com/patient-instructions',\n },\n ],\n },\n },\n ],\n },\n ],\n };\n\n return medplum.executeBot(DOSESPOT_ADD_FAVORITE_MEDICATION_BOT, medicationKnowledgeWithDirections);\n }, [selectedMedication, directions, medplum]);\n\n const searchMedications = useCallback(\n async (searchTerm: string): Promise<CodeableConcept[]> => {\n return (await medplum.executeBot(DOSESPOT_SEARCH_MEDICATIONS_BOT, { name: searchTerm })) as CodeableConcept[];\n },\n [medplum]\n );\n\n const setSelectedMedicationDirections = (directions: string | undefined): void => {\n privateSetDirections(directions);\n };\n\n const setSelectedMedication = (medication: CodeableConcept | Coding | undefined): void => {\n let medicationToSet: CodeableConcept | undefined;\n if (isCodeableConcept(medication)) {\n medicationToSet = { ...medication };\n } else if (isCoding(medication)) {\n medicationToSet = {\n text: medication.display || '',\n coding: [medication],\n };\n }\n privateSetSelectedMedication(medicationToSet);\n };\n\n const clear = (): void => {\n privateSetSelectedMedication(undefined);\n privateSetDirections(undefined);\n };\n\n return {\n state,\n searchMedications,\n setSelectedMedication,\n setSelectedMedicationDirections,\n saveFavoriteMedication,\n clear,\n };\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { DOSESPOT_IFRAME_BOT, DOSESPOT_PATIENT_SYNC_BOT } from './common';\n\nexport interface DoseSpotIFrameOptions {\n readonly patientId?: string;\n readonly onPatientSyncSuccess?: () => void;\n readonly onIframeSuccess?: (url: string) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nexport function useDoseSpotIFrame(options: DoseSpotIFrameOptions): string | undefined {\n const medplum = useMedplum();\n const { patientId, onPatientSyncSuccess, onIframeSuccess, onError } = options;\n const initializingRef = useRef<boolean>(false);\n const [iframeUrl, setIframeUrl] = useState<string | undefined>(undefined);\n\n const onPatientSyncSuccessRef = useRef(onPatientSyncSuccess);\n onPatientSyncSuccessRef.current = onPatientSyncSuccess;\n\n const onIframeSuccessRef = useRef(onIframeSuccess);\n onIframeSuccessRef.current = onIframeSuccess;\n\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n\n // Reset when inputs change so we re-fetch the iframe URL\n useEffect(() => {\n initializingRef.current = false;\n }, [patientId]);\n\n const initPage = useCallback(async () => {\n if (initializingRef.current) {\n return;\n }\n\n initializingRef.current = true;\n try {\n if (patientId) {\n await medplum.executeBot(DOSESPOT_PATIENT_SYNC_BOT, { patientId });\n onPatientSyncSuccessRef.current?.();\n }\n const result = await medplum.executeBot(DOSESPOT_IFRAME_BOT, { patientId });\n if (result.url) {\n setIframeUrl(result.url);\n onIframeSuccessRef.current?.(result.url);\n }\n } catch (err: unknown) {\n onErrorRef.current?.(err);\n }\n }, [medplum, patientId]);\n\n useEffect(() => {\n initPage().catch(console.error);\n }, [initPage]);\n\n return iframeUrl;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { DoseSpotNotificationCountsResponse } from './common';\nimport { DOSESPOT_NOTIFICATION_COUNTS_BOT } from './common';\n\nexport interface DoseSpotNotificationsOptions {\n readonly refreshIntervalMilliseconds?: number;\n readonly onChange?: (count: number) => void;\n readonly onError?: (err: unknown) => void;\n}\n\nconst DEFAULT_REFRESH_INTERVAL_MILLISECONDS = 10000;\n\nexport function useDoseSpotNotifications(options?: DoseSpotNotificationsOptions): number | undefined {\n const medplum = useMedplum();\n const { onChange, onError } = options ?? {};\n const hasDoseSpot = medplum.getProjectMembership()?.identifier?.some((i) => i.system?.includes('dosespot'));\n const refreshInterval = options?.refreshIntervalMilliseconds ?? DEFAULT_REFRESH_INTERVAL_MILLISECONDS;\n const timerRef = useRef<NodeJS.Timeout | undefined>(undefined);\n const [unreadCount, setUnreadCount] = useState<number | undefined>(undefined);\n\n const stopTimer = useCallback(() => {\n const timerId = timerRef.current;\n if (timerId) {\n clearInterval(timerId);\n }\n }, []);\n\n const updateCount = useCallback(async () => {\n try {\n const result = (await medplum.executeBot(\n DOSESPOT_NOTIFICATION_COUNTS_BOT,\n {}\n )) as DoseSpotNotificationCountsResponse;\n\n let newCount = 0;\n if (result.PendingPrescriptionsCount) {\n newCount += result.PendingPrescriptionsCount;\n }\n if (result.PendingRxChangeCount) {\n newCount += result.PendingRxChangeCount;\n }\n if (result.RefillRequestsCount) {\n newCount += result.RefillRequestsCount;\n }\n if (result.TransactionErrorsCount) {\n newCount += result.TransactionErrorsCount;\n }\n if (newCount !== unreadCount) {\n setUnreadCount(newCount);\n onChange?.(newCount);\n }\n } catch (err: unknown) {\n onError?.(err);\n stopTimer();\n }\n }, [medplum, unreadCount, onChange, onError, stopTimer]);\n\n const startTimer = useCallback(() => {\n timerRef.current = setInterval(() => {\n updateCount().catch(console.error);\n }, refreshInterval);\n }, [updateCount, refreshInterval]);\n\n useEffect(() => {\n // Start an interval timer to update the count every 5 seconds\n if (hasDoseSpot) {\n startTimer();\n }\n\n // Clear the interval timer when the component is unmounted\n return stopTimer;\n }, [hasDoseSpot, startTimer, stopTimer]);\n\n return unreadCount;\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { Organization } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback, useState } from 'react';\nimport { DOSESPOT_ADD_PATIENT_PHARMACY_BOT, DOSESPOT_SEARCH_PHARMACY_BOT } from './common';\nimport { getPharmacyIdFromOrganization } from './utils';\n\n/**\n * Search parameters for pharmacy search.\n * See DoseSpot API section 3.13.2.\n */\nexport interface PharmacySearchParams {\n /** Pharmacy's store name (min 3 chars) */\n name?: string;\n /** City (min 3 chars) */\n city?: string;\n /** State (min 3 chars) */\n state?: string;\n /** Zip code (min 3 chars) */\n zip?: string;\n /** Address (min 3 chars) */\n address?: string;\n /** Phone or fax number */\n phoneOrFax?: string;\n /** Collection of pharmacy specialties (numeric values) */\n specialty?: number[];\n /** National Council for Prescription Drug Programs Identifier */\n ncpdpID?: string;\n /** Page number of results (defaults to 1) */\n pageNumber?: number;\n}\n\n/**\n * Response from adding a pharmacy to a patient's favorites.\n */\nexport interface AddPatientPharmacyResponse {\n /** Whether the operation was successful */\n success: boolean;\n /** A message describing the result */\n message: string;\n /** The persisted Organization resource with ID */\n organization?: Organization;\n}\n\n/**\n * State managed by the useDoseSpotPatientPharmacy hook.\n */\nexport interface DoseSpotPatientPharmacyState {\n /** The currently selected pharmacy Organization */\n selectedPharmacy: Organization | undefined;\n /** Whether to set the selected pharmacy as the patient's primary pharmacy */\n setAsPrimary: boolean;\n}\n\n/**\n * Return type for the useDoseSpotPatientPharmacy hook.\n */\nexport interface DoseSpotPatientPharmacyReturn {\n /** Current state of the hook */\n state: DoseSpotPatientPharmacyState;\n /**\n * Search for pharmacies in DoseSpot.\n * Returns synthetic Organization resources (not persisted to DB).\n */\n readonly searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;\n /**\n * Set the currently selected pharmacy.\n */\n readonly setSelectedPharmacy: (pharmacy: Organization | undefined) => void;\n /**\n * Set whether to add the pharmacy as the patient's primary pharmacy.\n */\n readonly setAsPrimary: (primary: boolean) => void;\n /**\n * Add the selected pharmacy to the patient's favorites in DoseSpot.\n * @param patientId - The Medplum Patient ID\n */\n readonly addFavoritePharmacy: (patientId: string) => Promise<AddPatientPharmacyResponse>;\n /**\n * Clear the state (selected pharmacy and setAsPrimary flag).\n */\n readonly clear: () => void;\n}\n\n/**\n * React hook for searching DoseSpot pharmacies and adding them to patient favorites.\n *\n * @returns The hook return object with state and methods.\n *\n * @example\n * ```tsx\n * function PharmacySearch({ patientId }: { patientId: string }) {\n * const {\n * state,\n * searchPharmacies,\n * setSelectedPharmacy,\n * setAsPrimary,\n * addFavoritePharmacy,\n * clear\n * } = useDoseSpotPatientPharmacy();\n *\n * const handleSearch = async () => {\n * const results = await searchPharmacies({ zip: '94118' });\n * // Display results to user\n * };\n *\n * const handleAddFavorite = async () => {\n * const result = await addFavoritePharmacy(patientId);\n * if (result.success) {\n * clear();\n * }\n * };\n * }\n * ```\n */\nexport function useDoseSpotPatientPharmacy(): DoseSpotPatientPharmacyReturn {\n const [selectedPharmacy, privateSetSelectedPharmacy] = useState<Organization | undefined>(undefined);\n const [setAsPrimaryState, privateSetAsPrimary] = useState<boolean>(false);\n const medplum = useMedplum();\n\n const state: DoseSpotPatientPharmacyState = {\n selectedPharmacy,\n setAsPrimary: setAsPrimaryState,\n };\n\n const searchPharmacies = useCallback(\n async (params: PharmacySearchParams): Promise<Organization[]> => {\n return (await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT, params)) as Organization[];\n },\n [medplum]\n );\n\n const setSelectedPharmacy = (pharmacy: Organization | undefined): void => {\n privateSetSelectedPharmacy(pharmacy);\n };\n\n const setAsPrimary = (primary: boolean): void => {\n privateSetAsPrimary(primary);\n };\n\n const addFavoritePharmacy = useCallback(\n async (patientId: string): Promise<AddPatientPharmacyResponse> => {\n if (!selectedPharmacy) {\n throw new Error('Must select a pharmacy before adding it as a favorite');\n }\n\n const pharmacyId = getPharmacyIdFromOrganization(selectedPharmacy);\n if (!pharmacyId) {\n throw new Error('Selected pharmacy does not have a valid DoseSpot pharmacy ID');\n }\n\n return medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT, {\n patientId,\n pharmacy: selectedPharmacy,\n setAsPrimary: setAsPrimaryState,\n }) as Promise<AddPatientPharmacyResponse>;\n },\n [selectedPharmacy, setAsPrimaryState, medplum]\n );\n\n const clear = (): void => {\n privateSetSelectedPharmacy(undefined);\n privateSetAsPrimary(false);\n };\n\n return {\n state,\n searchPharmacies,\n setSelectedPharmacy,\n setAsPrimary,\n addFavoritePharmacy,\n clear,\n };\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationKnowledge, Organization } from '@medplum/fhirtypes';\nimport { DOSESPOT_PHARMACY_ID_SYSTEM } from './common';\n\nexport const getMedicationName = (medication: MedicationKnowledge | undefined): string => {\n return medication?.code?.text || '';\n};\n\n/**\n * Extracts the DoseSpot pharmacy ID from an Organization resource.\n * @param organization - The FHIR Organization resource representing a pharmacy.\n * @returns The DoseSpot pharmacy ID, or undefined if not found.\n */\nexport function getPharmacyIdFromOrganization(organization: Organization): number | undefined {\n const id = organization.identifier?.find((i) => i.system === DOSESPOT_PHARMACY_ID_SYSTEM)?.value;\n return id ? Number.parseInt(id, 10) : undefined;\n}\n\nexport {\n addPreferredPharmacyToPatient,\n createPreferredPharmacyExtension,\n getPreferredPharmaciesFromPatient,\n isAddPharmacyResponse,\n isOrganizationArray,\n PATIENT_PREFERRED_PHARMACY_URL,\n PHARMACY_PREFERENCE_TYPE_SYSTEM,\n PHARMACY_TYPE_PREFERRED,\n PHARMACY_TYPE_PRIMARY,\n removePreferredPharmacyFromPatient,\n} from '@medplum/core';\nexport type { PreferredPharmacy } from '@medplum/core';\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { AddFavoriteParams, AddPharmacyResponse, PharmacySearchParams } from '@medplum/core';\nimport { isAddPharmacyResponse, isOrganizationArray } from '@medplum/core';\nimport type { Organization } from '@medplum/fhirtypes';\nimport { useMedplum } from '@medplum/react-hooks';\nimport { useCallback } from 'react';\nimport { DOSESPOT_ADD_PATIENT_PHARMACY_BOT, DOSESPOT_SEARCH_PHARMACY_BOT } from './common';\n\nexport interface UseDoseSpotPharmacySearchReturn {\n searchPharmacies: (params: PharmacySearchParams) => Promise<Organization[]>;\n addToFavorites: (params: AddFavoriteParams) => Promise<AddPharmacyResponse>;\n}\n\n/**\n * React hook that provides DoseSpot-specific pharmacy search and add-to-favorites functionality.\n *\n * This hook encapsulates calls to the DoseSpot pharmacy search and add patient pharmacy bots,\n * and can be composed with the generic `PharmacyDialog` component from `@medplum/react`.\n *\n * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.\n */\nexport function useDoseSpotPharmacySearch(): UseDoseSpotPharmacySearchReturn {\n const medplum = useMedplum();\n\n const searchPharmacies = useCallback(\n async (params: PharmacySearchParams): Promise<Organization[]> => {\n const response = await medplum.executeBot(DOSESPOT_SEARCH_PHARMACY_BOT, params);\n\n if (!isOrganizationArray(response)) {\n throw new Error('Invalid response from pharmacy search');\n }\n\n return response;\n },\n [medplum]\n );\n\n const addToFavorites = useCallback(\n async (params: AddFavoriteParams): Promise<AddPharmacyResponse> => {\n const response = await medplum.executeBot(DOSESPOT_ADD_PATIENT_PHARMACY_BOT, {\n patientId: params.patientId,\n pharmacy: params.pharmacy,\n setAsPrimary: params.setAsPrimary,\n });\n\n if (!isAddPharmacyResponse(response)) {\n throw new Error('Invalid response from add pharmacy bot');\n }\n\n return response;\n },\n [medplum]\n );\n\n return { searchPharmacies, addToFavorites };\n}\n"],
|
|
5
|
+
"mappings": "AASA,OACE,8BACA,iCACA,kCACA,sBACA,oBACA,+BACA,gCACA,wBACA,sBACA,uCACK,gBAdA,IAkBM,mBAAqB,+BAGrB,2BAA6B,kCAC7B,4BAA8B,mCAC9B,mCAAqC,qDACrC,oCAAsC,2CAGtC,6BAA2C,CACtD,OAAQ,mBACR,MAAO,8BACT,EAEa,kCAAgD,CAC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,SAAS,2BAA6D,CAC3E,IAAM,QAAUC,YAAW,EAErB,iBAAmBC,aACvB,MAAO,QAA0D,CAC/D,IAAM,SAAW,MAAM,QAAQ,WAAW,6BAA8B,MAAM,EAE9E,GAAI,CAACC,qBAAoB,QAAQ,EAC/B,MAAM,IAAI,MAAM,uCAAuC,EAGzD,OAAO,QACT,EACA,CAAC,OAAO,CACV,EAEM,eAAiBD,aACrB,MAAO,QAA4D,CACjE,IAAM,SAAW,MAAM,QAAQ,WAAW,kCAAmC,CAC3E,UAAW,OAAO,UAClB,SAAU,OAAO,SACjB,aAAc,OAAO,YACvB,CAAC,EAED,GAAI,CAACE,uBAAsB,QAAQ,EACjC,MAAM,IAAI,MAAM,wCAAwC,EAG1D,OAAO,QACT,EACA,CAAC,OAAO,CACV,EAEA,MAAO,CAAE,iBAAkB,cAAe,CAC5C",
|
|
6
|
+
"names": ["directions", "useMedplum", "useCallback", "useState", "useMedplum", "useState", "useCallback", "useMedplum", "useCallback", "useEffect", "useRef", "useState", "useMedplum", "useRef", "useState", "useCallback", "useEffect", "useMedplum", "useCallback", "useState", "addPreferredPharmacyToPatient", "createPreferredPharmacyExtension", "getPreferredPharmaciesFromPatient", "isAddPharmacyResponse", "isOrganizationArray", "PATIENT_PREFERRED_PHARMACY_URL", "PHARMACY_PREFERENCE_TYPE_SYSTEM", "PHARMACY_TYPE_PREFERRED", "PHARMACY_TYPE_PRIMARY", "removePreferredPharmacyFromPatient", "useState", "useMedplum", "useCallback", "isAddPharmacyResponse", "isOrganizationArray", "useMedplum", "useCallback", "useMedplum", "useCallback", "isOrganizationArray", "isAddPharmacyResponse"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medplum/dosespot-react",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.15",
|
|
4
4
|
"description": "Medplum DoseSpot React SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"medplum",
|
|
@@ -60,25 +60,27 @@
|
|
|
60
60
|
"test:watch": "vitest watch"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@medplum/core": "5.0.
|
|
64
|
-
"@medplum/
|
|
65
|
-
"@medplum/
|
|
66
|
-
"@medplum/
|
|
63
|
+
"@medplum/core": "5.0.15",
|
|
64
|
+
"@medplum/dosespot-core": "5.0.15",
|
|
65
|
+
"@medplum/fhirtypes": "5.0.15",
|
|
66
|
+
"@medplum/mock": "5.0.15",
|
|
67
|
+
"@medplum/react-hooks": "5.0.15",
|
|
67
68
|
"@testing-library/jest-dom": "6.9.1",
|
|
68
69
|
"@testing-library/react": "16.3.2",
|
|
69
|
-
"@types/node": "22.19.
|
|
70
|
-
"@types/react": "19.2.
|
|
70
|
+
"@types/node": "22.19.11",
|
|
71
|
+
"@types/react": "19.2.14",
|
|
71
72
|
"@types/react-dom": "19.2.3",
|
|
72
|
-
"@vitejs/plugin-react": "5.1.
|
|
73
|
-
"jsdom": "
|
|
74
|
-
"react": "19.2.
|
|
75
|
-
"react-dom": "19.2.
|
|
73
|
+
"@vitejs/plugin-react": "5.1.4",
|
|
74
|
+
"jsdom": "28.1.0",
|
|
75
|
+
"react": "19.2.4",
|
|
76
|
+
"react-dom": "19.2.4",
|
|
76
77
|
"vitest": "4.0.18"
|
|
77
78
|
},
|
|
78
79
|
"peerDependencies": {
|
|
79
|
-
"@medplum/core": "5.0.
|
|
80
|
-
"@medplum/
|
|
81
|
-
"@medplum/
|
|
80
|
+
"@medplum/core": "5.0.15",
|
|
81
|
+
"@medplum/dosespot-core": "5.0.15",
|
|
82
|
+
"@medplum/fhirtypes": "5.0.15",
|
|
83
|
+
"@medplum/react-hooks": "5.0.15",
|
|
82
84
|
"react": "^18.0.0 || ^19.0.0"
|
|
83
85
|
},
|
|
84
86
|
"engines": {
|