@medplum/scriptsure-react 5.1.23 → 5.1.26

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.
@@ -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,{MEDPLUM_BOT_SYSTEM:()=>MEDPLUM_BOT_SYSTEM,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT:()=>SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT,SCRIPTSURE_DRUG_SEARCH_BOT:()=>SCRIPTSURE_DRUG_SEARCH_BOT,SCRIPTSURE_GENERIC_NAME_EXTENSION:()=>SCRIPTSURE_GENERIC_NAME_EXTENSION,SCRIPTSURE_IFRAME_BOT:()=>SCRIPTSURE_IFRAME_BOT,SCRIPTSURE_IFRAME_URL_EXTENSION:()=>SCRIPTSURE_IFRAME_URL_EXTENSION,SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS:()=>SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS,SCRIPTSURE_NAME_TYPE_EXTENSION:()=>SCRIPTSURE_NAME_TYPE_EXTENSION,SCRIPTSURE_ORDERSET_ID_SYSTEM:()=>SCRIPTSURE_ORDERSET_ID_SYSTEM,SCRIPTSURE_ORDER_MEDICATION_BOT:()=>SCRIPTSURE_ORDER_MEDICATION_BOT,SCRIPTSURE_ORDER_SET_BOT:()=>SCRIPTSURE_ORDER_SET_BOT,SCRIPTSURE_PATIENT_ID_SYSTEM:()=>SCRIPTSURE_PATIENT_ID_SYSTEM,SCRIPTSURE_PATIENT_SYNC_BOT:()=>SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_PENDING_ORDER_ID_SYSTEM:()=>SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION:()=>SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,SCRIPTSURE_ROUTED_MED_ID_SYSTEM:()=>SCRIPTSURE_ROUTED_MED_ID_SYSTEM,SCRIPTSURE_SEARCH_PHARMACY_BOT:()=>SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_SIG_EXTENSION:()=>SCRIPTSURE_SIG_EXTENSION,SCRIPTSURE_SYSTEM:()=>SCRIPTSURE_SYSTEM,loadScriptSureQuantityQualifiers:()=>loadScriptSureQuantityQualifiers,useScriptSureIFrame:()=>useScriptSureIFrame,useScriptSureOrderMedication:()=>useScriptSureOrderMedication,useScriptSureOrderSet:()=>useScriptSureOrderSet,useScriptSurePharmacySearch:()=>useScriptSurePharmacySearch});module.exports=__toCommonJS(index_exports);var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",SCRIPTSURE_DRUG_SEARCH_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-drug-search-bot"},SCRIPTSURE_ORDER_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-medication-bot"},SCRIPTSURE_ROUTED_MED_ID_SYSTEM="https://scriptsure.com/routed-med-id",SCRIPTSURE_PENDING_ORDER_ID_SYSTEM="https://scriptsure.com/pending-order-id",SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION="https://scriptsure.com/pending-order-status",SCRIPTSURE_IFRAME_URL_EXTENSION="https://scriptsure.com/iframe-url",SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS={pendingOrderIdSystem:SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,pendingOrderStatusUrl:SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,iframeUrlExtension:SCRIPTSURE_IFRAME_URL_EXTENSION},SCRIPTSURE_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-iframe-bot"},SCRIPTSURE_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-patient-sync-bot"},SCRIPTSURE_ORDER_SET_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-set-bot"},SCRIPTSURE_ORDERSET_ID_SYSTEM="https://spa.scriptsure.com/orderset-id",SCRIPTSURE_SEARCH_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-search-pharmacy-bot"},SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-add-patient-pharmacy-bot"},SCRIPTSURE_PATIENT_ID_SYSTEM="https://scriptsure.com/patient-id",SCRIPTSURE_SYSTEM="https://scriptsure.com",SCRIPTSURE_SIG_EXTENSION=`${SCRIPTSURE_SYSTEM}/sig`,SCRIPTSURE_NAME_TYPE_EXTENSION=`${SCRIPTSURE_SYSTEM}/name-type`,SCRIPTSURE_GENERIC_NAME_EXTENSION=`${SCRIPTSURE_SYSTEM}/generic-name`;var import_core=require("@medplum/core");function parametersToQuantityQualifiers(params){let rows=[];for(let p of params.parameter??[]){if(p.name!=="quantityQualifier"||!p.part)continue;let code=p.part.find(part=>part.name==="code")?.valueString,label=p.part.find(part=>part.name==="label")?.valueString;typeof code=="string"&&typeof label=="string"&&rows.push({code,label})}return rows}async function loadScriptSureQuantityQualifiers(medplum){let url=medplum.fhirUrl("Medication","$drug-quantity-qualifiers"),body=(0,import_core.medicationSearchParamsToParameters)({quantityQualifiers:!0}),response=await medplum.post(url,body);return(0,import_core.isResource)(response,"Parameters")?parametersToQuantityQualifiers(response):[]}var import_react_hooks=require("@medplum/react-hooks");function useScriptSureIFrame(options){return(0,import_react_hooks.useMedicationIFrame)(SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_IFRAME_BOT,options)}var import_react_hooks2=require("@medplum/react-hooks");function useScriptSureOrderMedication(){return(0,import_react_hooks2.useMedicationOrder)()}var import_react_hooks3=require("@medplum/react-hooks");function useScriptSureOrderSet(options){return(0,import_react_hooks3.useMedicationOrderSet)({patientId:options.patientId,planDefinitionId:options.planDefinitionId,vendorOrderSetId:options.scriptSureOrdersetId,appId:options.appId})}var import_react_hooks4=require("@medplum/react-hooks");function useScriptSurePharmacySearch(){return(0,import_react_hooks4.usePharmacySearch)(SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT)}
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,{MEDPLUM_BOT_SYSTEM:()=>MEDPLUM_BOT_SYSTEM,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT:()=>SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT,SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES:()=>SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES,SCRIPTSURE_DRUG_SEARCH_BOT:()=>SCRIPTSURE_DRUG_SEARCH_BOT,SCRIPTSURE_GENERIC_NAME_EXTENSION:()=>SCRIPTSURE_GENERIC_NAME_EXTENSION,SCRIPTSURE_IFRAME_BOT:()=>SCRIPTSURE_IFRAME_BOT,SCRIPTSURE_IFRAME_URL_EXTENSION:()=>SCRIPTSURE_IFRAME_URL_EXTENSION,SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS:()=>SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS,SCRIPTSURE_NAME_TYPE_EXTENSION:()=>SCRIPTSURE_NAME_TYPE_EXTENSION,SCRIPTSURE_ORDERSET_ID_SYSTEM:()=>SCRIPTSURE_ORDERSET_ID_SYSTEM,SCRIPTSURE_ORDER_MEDICATION_BOT:()=>SCRIPTSURE_ORDER_MEDICATION_BOT,SCRIPTSURE_ORDER_SET_BOT:()=>SCRIPTSURE_ORDER_SET_BOT,SCRIPTSURE_PATIENT_ID_SYSTEM:()=>SCRIPTSURE_PATIENT_ID_SYSTEM,SCRIPTSURE_PATIENT_SYNC_BOT:()=>SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_PENDING_ORDER_ID_SYSTEM:()=>SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION:()=>SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS:()=>SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS,SCRIPTSURE_ROUTED_MED_ID_SYSTEM:()=>SCRIPTSURE_ROUTED_MED_ID_SYSTEM,SCRIPTSURE_SEARCH_PHARMACY_BOT:()=>SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_SIG_EXTENSION:()=>SCRIPTSURE_SIG_EXTENSION,SCRIPTSURE_SYSTEM:()=>SCRIPTSURE_SYSTEM,loadScriptSureQuantityQualifiers:()=>loadScriptSureQuantityQualifiers,useScriptSureIFrame:()=>useScriptSureIFrame,useScriptSureOrderMedication:()=>useScriptSureOrderMedication,useScriptSureOrderSet:()=>useScriptSureOrderSet,useScriptSurePharmacySearch:()=>useScriptSurePharmacySearch});module.exports=__toCommonJS(index_exports);var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",SCRIPTSURE_DRUG_SEARCH_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-drug-search-bot"},SCRIPTSURE_ORDER_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-medication-bot"},SCRIPTSURE_ROUTED_MED_ID_SYSTEM="https://scriptsure.com/routed-med-id",SCRIPTSURE_PENDING_ORDER_ID_SYSTEM="https://scriptsure.com/pending-order-id",SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION="https://scriptsure.com/pending-order-status",SCRIPTSURE_IFRAME_URL_EXTENSION="https://scriptsure.com/iframe-url",SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS={pendingOrderIdSystem:SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,pendingOrderStatusUrl:SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,iframeUrlExtension:SCRIPTSURE_IFRAME_URL_EXTENSION},SCRIPTSURE_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-iframe-bot"},SCRIPTSURE_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-patient-sync-bot"},SCRIPTSURE_ORDER_SET_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-set-bot"},SCRIPTSURE_ORDERSET_ID_SYSTEM="https://spa.scriptsure.com/orderset-id",SCRIPTSURE_SEARCH_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-search-pharmacy-bot"},SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-add-patient-pharmacy-bot"},SCRIPTSURE_PATIENT_ID_SYSTEM="https://scriptsure.com/patient-id",SCRIPTSURE_SYSTEM="https://scriptsure.com",SCRIPTSURE_SIG_EXTENSION=`${SCRIPTSURE_SYSTEM}/sig`,SCRIPTSURE_NAME_TYPE_EXTENSION=`${SCRIPTSURE_SYSTEM}/name-type`,SCRIPTSURE_GENERIC_NAME_EXTENSION=`${SCRIPTSURE_SYSTEM}/generic-name`;var import_core=require("@medplum/core");function parametersToQuantityQualifiers(params){let rows=[];for(let p of params.parameter??[]){if(p.name!=="quantityQualifier"||!p.part)continue;let code=p.part.find(part=>part.name==="code")?.valueString,label=p.part.find(part=>part.name==="label")?.valueString;typeof code=="string"&&typeof label=="string"&&rows.push({code,label})}return rows}async function loadScriptSureQuantityQualifiers(medplum){let url=medplum.fhirUrl("Medication","$drug-quantity-qualifiers"),body=(0,import_core.medicationSearchParamsToParameters)({quantityQualifiers:!0}),response=await medplum.post(url,body);return(0,import_core.isResource)(response,"Parameters")?parametersToQuantityQualifiers(response):[]}var SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS=[{value:"Retail",label:"Retail"},{value:"MailOrder",label:"Mail order"},{value:"TwentyFourHourStore",label:"24-hour"},{value:"LongTermCare",label:"Long-term care"},{value:"Specialty",label:"Specialty"},{value:"SupportsDigitalSignature",label:"Digital signature"},{value:"FaxPharmacySurescripts",label:"Fax (Surescripts)"}],SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES=["Retail"];var import_react_hooks=require("@medplum/react-hooks");function useScriptSureIFrame(options){return(0,import_react_hooks.useMedicationIFrame)(SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_IFRAME_BOT,options)}var import_react_hooks2=require("@medplum/react-hooks");function useScriptSureOrderMedication(){return(0,import_react_hooks2.useMedicationOrder)()}var import_react_hooks3=require("@medplum/react-hooks");function useScriptSureOrderSet(options){return(0,import_react_hooks3.useMedicationOrderSet)({patientId:options.patientId,planDefinitionId:options.planDefinitionId,vendorOrderSetId:options.scriptSureOrdersetId,appId:options.appId})}var import_react_hooks4=require("@medplum/react-hooks");function useScriptSurePharmacySearch(){return(0,import_react_hooks4.usePharmacySearch)(SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT)}
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/index.ts", "../../src/common.ts", "../../src/loadScriptSureQuantityQualifiers.ts", "../../src/useScriptSureIFrame.ts", "../../src/useScriptSureOrderMedication.ts", "../../src/useScriptSureOrderSet.ts", "../../src/useScriptSurePharmacySearch.ts"],
4
- "sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nexport * from './common';\nexport * from './loadScriptSureQuantityQualifiers';\nexport * from './useScriptSureIFrame';\nexport * from './useScriptSureOrderMedication';\nexport * from './useScriptSureOrderSet';\nexport * from './useScriptSurePharmacySearch';\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationOrderExtensions } from '@medplum/core';\nimport type { Identifier } from '@medplum/fhirtypes';\n\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\n/**\n * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via\n * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `drug-search` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_DRUG_SEARCH_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-drug-search-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-medication` custom FHIR operation via\n * `useMedicationOrder().orderMedication(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-medication` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-medication-bot',\n};\n\n/** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */\nexport const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = 'https://scriptsure.com/routed-med-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = 'https://scriptsure.com/pending-order-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = 'https://scriptsure.com/pending-order-status';\n\nexport const SCRIPTSURE_IFRAME_URL_EXTENSION = 'https://scriptsure.com/iframe-url';\n\nexport const SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS: MedicationOrderExtensions = {\n pendingOrderIdSystem: SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,\n pendingOrderStatusUrl: SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,\n iframeUrlExtension: SCRIPTSURE_IFRAME_URL_EXTENSION,\n};\n\nexport const SCRIPTSURE_IFRAME_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-iframe-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-patient-sync-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-set-url` custom FHIR operation via\n * `useScriptSureOrderSet(...)` (thin wrapper around `useMedicationOrderSet`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-set-url` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_SET_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-set-bot',\n};\n\n/** Identifier system for the ScriptSure orderset id stamped on FHIR PlanDefinitions. */\nexport const SCRIPTSURE_ORDERSET_ID_SYSTEM = 'https://spa.scriptsure.com/orderset-id';\n\nexport const SCRIPTSURE_SEARCH_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-search-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-add-patient-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_ID_SYSTEM = 'https://scriptsure.com/patient-id';\n\n/** Base URL for ScriptSure-specific extensions on in-memory Medication resources (e.g. `/sig`). */\nexport const SCRIPTSURE_SYSTEM = 'https://scriptsure.com';\n\n/** Pre-built dosing option on a Medication from drug-format lookup (`routedMedId` search). */\nexport const SCRIPTSURE_SIG_EXTENSION = `${SCRIPTSURE_SYSTEM}/sig`;\n\n/** ScriptSure MED_NAME_TYPE_CD on a search-result Medication: `'1'` = brand, `'2'` = generic. */\nexport const SCRIPTSURE_NAME_TYPE_EXTENSION = `${SCRIPTSURE_SYSTEM}/name-type`;\n\n/** ScriptSure GenericName on a search-result Medication (parent generic when the row is a brand). */\nexport const SCRIPTSURE_GENERIC_NAME_EXTENSION = `${SCRIPTSURE_SYSTEM}/generic-name`;\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MedplumClient } from '@medplum/core';\nimport { isResource, medicationSearchParamsToParameters } from '@medplum/core';\nimport type { Parameters } from '@medplum/fhirtypes';\n\n/**\n * Reads `{ code, label }` rows from a `Parameters` resource produced by the\n * `$drug-quantity-qualifiers` custom operation.\n *\n * The OperationDefinition (see `scriptsure-drug-search-bot` registration in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`) declares a single\n * repeating output parameter named `quantityQualifier`, each entry bearing\n * `part: [{ name: 'code', valueString }, { name: 'label', valueString }]`.\n * The server's `buildOutputParameters` wraps the bot return value into that\n * shape, so the parser only needs to handle this one canonical layout.\n * Entries missing either inner part are skipped defensively.\n *\n * @param params - `Parameters` resource returned by the operation.\n * @returns `{ code, label }` rows for UI selects.\n */\nfunction parametersToQuantityQualifiers(params: Parameters): { code: string; label: string }[] {\n const rows: { code: string; label: string }[] = [];\n for (const p of params.parameter ?? []) {\n if (p.name !== 'quantityQualifier' || !p.part) {\n continue;\n }\n const code = p.part.find((part) => part.name === 'code')?.valueString;\n const label = p.part.find((part) => part.name === 'label')?.valueString;\n if (typeof code === 'string' && typeof label === 'string') {\n rows.push({ code, label });\n }\n }\n return rows;\n}\n\n/**\n * Fetches NCI potency-unit codes for dispense quantity qualifiers via the\n * vendor-neutral `$drug-quantity-qualifiers` custom FHIR operation. Each\n * Medplum project picks the vendor implementation at deploy time by pointing\n * its `OperationDefinition` at the appropriate Bot (ScriptSure's\n * `scriptsure-drug-search-bot` today; see `deploy.ts`).\n *\n * @param medplum - Medplum client (user session).\n * @returns `{ code, label }` rows for UI selects.\n */\nexport async function loadScriptSureQuantityQualifiers(\n medplum: MedplumClient\n): Promise<{ code: string; label: string }[]> {\n const url = medplum.fhirUrl('Medication', '$drug-quantity-qualifiers');\n const body = medicationSearchParamsToParameters({ quantityQualifiers: true });\n const response = await medplum.post(url, body);\n if (!isResource<Parameters>(response, 'Parameters')) {\n return [];\n }\n return parametersToQuantityQualifiers(response);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationIFrameOptions } from '@medplum/react-hooks';\nimport { useMedicationIFrame } from '@medplum/react-hooks';\nimport { SCRIPTSURE_IFRAME_BOT, SCRIPTSURE_PATIENT_SYNC_BOT } from './common';\n\nexport type ScriptSureIFrameOptions = MedicationIFrameOptions;\n\n/**\n * React hook that syncs a patient to ScriptSure and returns the iframe URL.\n *\n * Thin wrapper around the generic {@link useMedicationIFrame} hook,\n * pre-configured with ScriptSure bot identifiers.\n *\n * @param options - Configuration and callback options.\n * @returns The ScriptSure iframe URL, or undefined while loading.\n */\nexport function useScriptSureIFrame(options: ScriptSureIFrameOptions): string | undefined {\n return useMedicationIFrame(SCRIPTSURE_PATIENT_SYNC_BOT, SCRIPTSURE_IFRAME_BOT, options);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseMedicationOrderReturn } from '@medplum/react-hooks';\nimport { useMedicationOrder } from '@medplum/react-hooks';\n\nexport type UseScriptSureOrderMedicationReturn = UseMedicationOrderReturn;\n\n/**\n * React hook for ScriptSure drug search and pending order creation (iframe launch URL).\n *\n * Now a near-empty re-export of `useMedicationOrder` from `@medplum/react-hooks`: the\n * vendor binding lives entirely on the server, where each Medplum project's\n * `OperationDefinition` resources for `$drug-search` and `$order-medication`\n * point at the ScriptSure bots via the\n * `operationDefinition-implementation` extension. See the deploy script in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts` for how those\n * resources are upserted.\n *\n * Kept as a typed alias for backwards source-compatibility with apps importing\n * `useScriptSureOrderMedication` and as a documentation anchor for the\n * ScriptSure-specific behavior (e.g. patient-must-be-synced precondition).\n *\n * @returns The same API as `useMedicationOrder` (search + order callbacks).\n */\nexport function useScriptSureOrderMedication(): UseScriptSureOrderMedicationReturn {\n return useMedicationOrder();\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';\nimport { useMedicationOrderSet } from '@medplum/react-hooks';\n\nexport interface UseScriptSureOrderSetOptions {\n /** Patient to prescribe against. Hook stays idle (no operation call) until set. */\n readonly patientId: string | undefined;\n /** Medplum PlanDefinition id; bot reverse-looks up the ScriptSure orderset id. */\n readonly planDefinitionId?: string;\n /** ScriptSure orderset id (escape hatch when no synced PD exists yet). */\n readonly scriptSureOrdersetId?: number;\n readonly appId?: string;\n}\n\nexport type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;\n\n/**\n * React hook that returns the ScriptSure order-set prescribing widget URL via\n * the vendor-neutral `$order-set-url` FHIR custom operation\n * (`POST /fhir/R4/PlanDefinition/$order-set-url`).\n *\n * Thin wrapper around {@link useMedicationOrderSet}: forwards\n * `scriptSureOrdersetId` as the operation's `vendorOrderSetId` parameter,\n * leaves vendor binding to the deployed `OperationDefinition` \u2192\n * `Bot/scriptsure-order-set-bot` link.\n *\n * The operation is naturally idempotent \u2014 re-calls only refresh the session\n * token in the returned URL \u2014 so callers can safely wire `refresh` into\n * `PrescriptionIFrameModal.onRefreshLaunchUrl`.\n *\n * @param options - Patient + order-set picker (PD or ScriptSure id).\n * @returns `{ url, loading, error, refresh }`.\n */\nexport function useScriptSureOrderSet(options: UseScriptSureOrderSetOptions): UseScriptSureOrderSetReturn {\n return useMedicationOrderSet({\n patientId: options.patientId,\n planDefinitionId: options.planDefinitionId,\n vendorOrderSetId: options.scriptSureOrdersetId,\n appId: options.appId,\n });\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UsePharmacySearchReturn } from '@medplum/react-hooks';\nimport { usePharmacySearch } from '@medplum/react-hooks';\nimport { SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT, SCRIPTSURE_SEARCH_PHARMACY_BOT } from './common';\n\nexport type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn;\n\n/**\n * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.\n *\n * Thin wrapper around the generic {@link usePharmacySearch} hook,\n * pre-configured with ScriptSure bot identifiers.\n *\n * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.\n */\nexport function useScriptSurePharmacySearch(): UseScriptSurePharmacySearchReturn {\n return usePharmacySearch(SCRIPTSURE_SEARCH_PHARMACY_BOT, SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT);\n}\n"],
5
- "mappings": "wpBAAA,gjDCKO,IAAM,mBAAqB,+BAWrB,2BAAyC,CACpD,OAAQ,mBACR,MAAO,4BACT,EAWa,gCAA8C,CACzD,OAAQ,mBACR,MAAO,iCACT,EAGa,gCAAkC,uCAElC,mCAAqC,0CAErC,0CAA4C,8CAE5C,gCAAkC,oCAElC,uCAAoE,CAC/E,qBAAsB,mCACtB,sBAAuB,0CACvB,mBAAoB,+BACtB,EAEa,sBAAoC,CAC/C,OAAQ,mBACR,MAAO,uBACT,EAEa,4BAA0C,CACrD,OAAQ,mBACR,MAAO,6BACT,EAWa,yBAAuC,CAClD,OAAQ,mBACR,MAAO,0BACT,EAGa,8BAAgC,yCAEhC,+BAA6C,CACxD,OAAQ,mBACR,MAAO,gCACT,EAEa,oCAAkD,CAC7D,OAAQ,mBACR,MAAO,qCACT,EAEa,6BAA+B,oCAG/B,kBAAoB,yBAGpB,yBAA2B,GAAG,iBAAiB,OAG/C,+BAAiC,GAAG,iBAAiB,aAGrD,kCAAoC,GAAG,iBAAiB,gBC/FrE,gBAA+D,yBAkB/D,SAAS,+BAA+B,OAAuD,CAC7F,IAAM,KAA0C,CAAC,EACjD,QAAW,KAAK,OAAO,WAAa,CAAC,EAAG,CACtC,GAAI,EAAE,OAAS,qBAAuB,CAAC,EAAE,KACvC,SAEF,IAAM,KAAO,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,MAAM,GAAG,YACpD,MAAQ,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,OAAO,GAAG,YACxD,OAAO,MAAS,UAAY,OAAO,OAAU,UAC/C,KAAK,KAAK,CAAE,KAAM,KAAM,CAAC,CAE7B,CACA,OAAO,IACT,CAYA,eAAsB,iCACpB,QAC4C,CAC5C,IAAM,IAAM,QAAQ,QAAQ,aAAc,2BAA2B,EAC/D,QAAO,gDAAmC,CAAE,mBAAoB,EAAK,CAAC,EACtE,SAAW,MAAM,QAAQ,KAAK,IAAK,IAAI,EAC7C,SAAK,wBAAuB,SAAU,YAAY,EAG3C,+BAA+B,QAAQ,EAFrC,CAAC,CAGZ,CCtDA,uBAAoC,gCAc7B,SAAS,oBAAoB,QAAsD,CACxF,SAAO,wCAAoB,4BAA6B,sBAAuB,OAAO,CACxF,CCfA,IAAAA,oBAAmC,gCAqB5B,SAAS,8BAAmE,CACjF,SAAO,wCAAmB,CAC5B,CCxBA,IAAAC,oBAAsC,gCA+B/B,SAAS,sBAAsB,QAAoE,CACxG,SAAO,2CAAsB,CAC3B,UAAW,QAAQ,UACnB,iBAAkB,QAAQ,iBAC1B,iBAAkB,QAAQ,qBAC1B,MAAO,QAAQ,KACjB,CAAC,CACH,CCrCA,IAAAC,oBAAkC,gCAa3B,SAAS,6BAAiE,CAC/E,SAAO,uCAAkB,+BAAgC,mCAAmC,CAC9F",
3
+ "sources": ["../../src/index.ts", "../../src/common.ts", "../../src/loadScriptSureQuantityQualifiers.ts", "../../src/pharmacy-search.ts", "../../src/useScriptSureIFrame.ts", "../../src/useScriptSureOrderMedication.ts", "../../src/useScriptSureOrderSet.ts", "../../src/useScriptSurePharmacySearch.ts"],
4
+ "sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nexport * from './common';\nexport * from './loadScriptSureQuantityQualifiers';\nexport * from './pharmacy-search';\nexport * from './useScriptSureIFrame';\nexport * from './useScriptSureOrderMedication';\nexport * from './useScriptSureOrderSet';\nexport * from './useScriptSurePharmacySearch';\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationOrderExtensions } from '@medplum/core';\nimport type { Identifier } from '@medplum/fhirtypes';\n\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\n/**\n * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via\n * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `drug-search` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_DRUG_SEARCH_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-drug-search-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-medication` custom FHIR operation via\n * `useMedicationOrder().orderMedication(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-medication` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-medication-bot',\n};\n\n/** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */\nexport const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = 'https://scriptsure.com/routed-med-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = 'https://scriptsure.com/pending-order-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = 'https://scriptsure.com/pending-order-status';\n\nexport const SCRIPTSURE_IFRAME_URL_EXTENSION = 'https://scriptsure.com/iframe-url';\n\nexport const SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS: MedicationOrderExtensions = {\n pendingOrderIdSystem: SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,\n pendingOrderStatusUrl: SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,\n iframeUrlExtension: SCRIPTSURE_IFRAME_URL_EXTENSION,\n};\n\nexport const SCRIPTSURE_IFRAME_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-iframe-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-patient-sync-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-set-url` custom FHIR operation via\n * `useScriptSureOrderSet(...)` (thin wrapper around `useMedicationOrderSet`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-set-url` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_SET_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-set-bot',\n};\n\n/** Identifier system for the ScriptSure orderset id stamped on FHIR PlanDefinitions. */\nexport const SCRIPTSURE_ORDERSET_ID_SYSTEM = 'https://spa.scriptsure.com/orderset-id';\n\nexport const SCRIPTSURE_SEARCH_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-search-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-add-patient-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_ID_SYSTEM = 'https://scriptsure.com/patient-id';\n\n/** Base URL for ScriptSure-specific extensions on in-memory Medication resources (e.g. `/sig`). */\nexport const SCRIPTSURE_SYSTEM = 'https://scriptsure.com';\n\n/** Pre-built dosing option on a Medication from drug-format lookup (`routedMedId` search). */\nexport const SCRIPTSURE_SIG_EXTENSION = `${SCRIPTSURE_SYSTEM}/sig`;\n\n/** ScriptSure MED_NAME_TYPE_CD on a search-result Medication: `'1'` = brand, `'2'` = generic. */\nexport const SCRIPTSURE_NAME_TYPE_EXTENSION = `${SCRIPTSURE_SYSTEM}/name-type`;\n\n/** ScriptSure GenericName on a search-result Medication (parent generic when the row is a brand). */\nexport const SCRIPTSURE_GENERIC_NAME_EXTENSION = `${SCRIPTSURE_SYSTEM}/generic-name`;\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MedplumClient } from '@medplum/core';\nimport { isResource, medicationSearchParamsToParameters } from '@medplum/core';\nimport type { Parameters } from '@medplum/fhirtypes';\n\n/**\n * Reads `{ code, label }` rows from a `Parameters` resource produced by the\n * `$drug-quantity-qualifiers` custom operation.\n *\n * The OperationDefinition (see `scriptsure-drug-search-bot` registration in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`) declares a single\n * repeating output parameter named `quantityQualifier`, each entry bearing\n * `part: [{ name: 'code', valueString }, { name: 'label', valueString }]`.\n * The server's `buildOutputParameters` wraps the bot return value into that\n * shape, so the parser only needs to handle this one canonical layout.\n * Entries missing either inner part are skipped defensively.\n *\n * @param params - `Parameters` resource returned by the operation.\n * @returns `{ code, label }` rows for UI selects.\n */\nfunction parametersToQuantityQualifiers(params: Parameters): { code: string; label: string }[] {\n const rows: { code: string; label: string }[] = [];\n for (const p of params.parameter ?? []) {\n if (p.name !== 'quantityQualifier' || !p.part) {\n continue;\n }\n const code = p.part.find((part) => part.name === 'code')?.valueString;\n const label = p.part.find((part) => part.name === 'label')?.valueString;\n if (typeof code === 'string' && typeof label === 'string') {\n rows.push({ code, label });\n }\n }\n return rows;\n}\n\n/**\n * Fetches NCI potency-unit codes for dispense quantity qualifiers via the\n * vendor-neutral `$drug-quantity-qualifiers` custom FHIR operation. Each\n * Medplum project picks the vendor implementation at deploy time by pointing\n * its `OperationDefinition` at the appropriate Bot (ScriptSure's\n * `scriptsure-drug-search-bot` today; see `deploy.ts`).\n *\n * @param medplum - Medplum client (user session).\n * @returns `{ code, label }` rows for UI selects.\n */\nexport async function loadScriptSureQuantityQualifiers(\n medplum: MedplumClient\n): Promise<{ code: string; label: string }[]> {\n const url = medplum.fhirUrl('Medication', '$drug-quantity-qualifiers');\n const body = medicationSearchParamsToParameters({ quantityQualifiers: true });\n const response = await medplum.post(url, body);\n if (!isResource<Parameters>(response, 'Parameters')) {\n return [];\n }\n return parametersToQuantityQualifiers(response);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PharmacySearchParams } from '@medplum/core';\n\n/**\n * SureScripts pharmacy specialty tags accepted by POST /v3/pharmacy/search `specialties`.\n * Must stay aligned with ScriptSure API allowed values.\n */\nexport type ScriptSurePharmacySpecialty =\n | 'Retail'\n | 'MailOrder'\n | 'TwentyFourHourStore'\n | 'SupportsDigitalSignature'\n | 'LongTermCare'\n | 'Specialty'\n | 'FaxPharmacySurescripts';\n\nexport interface ScriptSurePharmacySpecialtyOption {\n readonly value: ScriptSurePharmacySpecialty;\n readonly label: string;\n}\n\n/** Category filters shown in the ScriptSure pharmacy search dialog. */\nexport const SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS: readonly ScriptSurePharmacySpecialtyOption[] = [\n { value: 'Retail', label: 'Retail' },\n { value: 'MailOrder', label: 'Mail order' },\n { value: 'TwentyFourHourStore', label: '24-hour' },\n { value: 'LongTermCare', label: 'Long-term care' },\n { value: 'Specialty', label: 'Specialty' },\n { value: 'SupportsDigitalSignature', label: 'Digital signature' },\n { value: 'FaxPharmacySurescripts', label: 'Fax (Surescripts)' },\n] as const;\n\n/** Default specialty filter for nearby retail pharmacy pickers. */\nexport const SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES: readonly ScriptSurePharmacySpecialty[] = ['Retail'];\n\n/**\n * ScriptSure pharmacy search parameters.\n * Extends the shared dialog fields with SureScripts specialty filters.\n */\nexport interface ScriptSurePharmacySearchParams extends PharmacySearchParams {\n specialties?: ScriptSurePharmacySpecialty[];\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationIFrameOptions } from '@medplum/react-hooks';\nimport { useMedicationIFrame } from '@medplum/react-hooks';\nimport { SCRIPTSURE_IFRAME_BOT, SCRIPTSURE_PATIENT_SYNC_BOT } from './common';\n\nexport type ScriptSureIFrameOptions = MedicationIFrameOptions;\n\n/**\n * React hook that syncs a patient to ScriptSure and returns the iframe URL.\n *\n * Thin wrapper around the generic {@link useMedicationIFrame} hook,\n * pre-configured with ScriptSure bot identifiers.\n *\n * @param options - Configuration and callback options.\n * @returns The ScriptSure iframe URL, or undefined while loading.\n */\nexport function useScriptSureIFrame(options: ScriptSureIFrameOptions): string | undefined {\n return useMedicationIFrame(SCRIPTSURE_PATIENT_SYNC_BOT, SCRIPTSURE_IFRAME_BOT, options);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseMedicationOrderReturn } from '@medplum/react-hooks';\nimport { useMedicationOrder } from '@medplum/react-hooks';\n\nexport type UseScriptSureOrderMedicationReturn = UseMedicationOrderReturn;\n\n/**\n * React hook for ScriptSure drug search and pending order creation (iframe launch URL).\n *\n * Now a near-empty re-export of `useMedicationOrder` from `@medplum/react-hooks`: the\n * vendor binding lives entirely on the server, where each Medplum project's\n * `OperationDefinition` resources for `$drug-search` and `$order-medication`\n * point at the ScriptSure bots via the\n * `operationDefinition-implementation` extension. See the deploy script in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts` for how those\n * resources are upserted.\n *\n * Kept as a typed alias for backwards source-compatibility with apps importing\n * `useScriptSureOrderMedication` and as a documentation anchor for the\n * ScriptSure-specific behavior (e.g. patient-must-be-synced precondition).\n *\n * @returns The same API as `useMedicationOrder` (search + order callbacks).\n */\nexport function useScriptSureOrderMedication(): UseScriptSureOrderMedicationReturn {\n return useMedicationOrder();\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';\nimport { useMedicationOrderSet } from '@medplum/react-hooks';\n\nexport interface UseScriptSureOrderSetOptions {\n /** Patient to prescribe against. Hook stays idle (no operation call) until set. */\n readonly patientId: string | undefined;\n /** Medplum PlanDefinition id; bot reverse-looks up the ScriptSure orderset id. */\n readonly planDefinitionId?: string;\n /** ScriptSure orderset id (escape hatch when no synced PD exists yet). */\n readonly scriptSureOrdersetId?: number;\n readonly appId?: string;\n}\n\nexport type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;\n\n/**\n * React hook that returns the ScriptSure order-set prescribing widget URL via\n * the vendor-neutral `$order-set-url` FHIR custom operation\n * (`POST /fhir/R4/PlanDefinition/$order-set-url`).\n *\n * Thin wrapper around {@link useMedicationOrderSet}: forwards\n * `scriptSureOrdersetId` as the operation's `vendorOrderSetId` parameter,\n * leaves vendor binding to the deployed `OperationDefinition` \u2192\n * `Bot/scriptsure-order-set-bot` link.\n *\n * The operation is naturally idempotent \u2014 re-calls only refresh the session\n * token in the returned URL \u2014 so callers can safely wire `refresh` into\n * `PrescriptionIFrameModal.onRefreshLaunchUrl`.\n *\n * @param options - Patient + order-set picker (PD or ScriptSure id).\n * @returns `{ url, loading, error, refresh }`.\n */\nexport function useScriptSureOrderSet(options: UseScriptSureOrderSetOptions): UseScriptSureOrderSetReturn {\n return useMedicationOrderSet({\n patientId: options.patientId,\n planDefinitionId: options.planDefinitionId,\n vendorOrderSetId: options.scriptSureOrdersetId,\n appId: options.appId,\n });\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UsePharmacySearchReturn } from '@medplum/react-hooks';\nimport { usePharmacySearch } from '@medplum/react-hooks';\nimport { SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT, SCRIPTSURE_SEARCH_PHARMACY_BOT } from './common';\nimport type { ScriptSurePharmacySearchParams } from './pharmacy-search';\n\nexport type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn<ScriptSurePharmacySearchParams>;\n\n/**\n * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.\n *\n * Thin wrapper around the generic {@link usePharmacySearch} hook, pre-configured with\n * ScriptSure bot identifiers and widened so search params carry ScriptSure-only\n * `specialties` filters for POST /v3/pharmacy/search.\n *\n * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.\n */\nexport function useScriptSurePharmacySearch(): UseScriptSurePharmacySearchReturn {\n return usePharmacySearch<ScriptSurePharmacySearchParams>(\n SCRIPTSURE_SEARCH_PHARMACY_BOT,\n SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT\n );\n}\n"],
5
+ "mappings": "wpBAAA,otDCKO,IAAM,mBAAqB,+BAWrB,2BAAyC,CACpD,OAAQ,mBACR,MAAO,4BACT,EAWa,gCAA8C,CACzD,OAAQ,mBACR,MAAO,iCACT,EAGa,gCAAkC,uCAElC,mCAAqC,0CAErC,0CAA4C,8CAE5C,gCAAkC,oCAElC,uCAAoE,CAC/E,qBAAsB,mCACtB,sBAAuB,0CACvB,mBAAoB,+BACtB,EAEa,sBAAoC,CAC/C,OAAQ,mBACR,MAAO,uBACT,EAEa,4BAA0C,CACrD,OAAQ,mBACR,MAAO,6BACT,EAWa,yBAAuC,CAClD,OAAQ,mBACR,MAAO,0BACT,EAGa,8BAAgC,yCAEhC,+BAA6C,CACxD,OAAQ,mBACR,MAAO,gCACT,EAEa,oCAAkD,CAC7D,OAAQ,mBACR,MAAO,qCACT,EAEa,6BAA+B,oCAG/B,kBAAoB,yBAGpB,yBAA2B,GAAG,iBAAiB,OAG/C,+BAAiC,GAAG,iBAAiB,aAGrD,kCAAoC,GAAG,iBAAiB,gBC/FrE,gBAA+D,yBAkB/D,SAAS,+BAA+B,OAAuD,CAC7F,IAAM,KAA0C,CAAC,EACjD,QAAW,KAAK,OAAO,WAAa,CAAC,EAAG,CACtC,GAAI,EAAE,OAAS,qBAAuB,CAAC,EAAE,KACvC,SAEF,IAAM,KAAO,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,MAAM,GAAG,YACpD,MAAQ,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,OAAO,GAAG,YACxD,OAAO,MAAS,UAAY,OAAO,OAAU,UAC/C,KAAK,KAAK,CAAE,KAAM,KAAM,CAAC,CAE7B,CACA,OAAO,IACT,CAYA,eAAsB,iCACpB,QAC4C,CAC5C,IAAM,IAAM,QAAQ,QAAQ,aAAc,2BAA2B,EAC/D,QAAO,gDAAmC,CAAE,mBAAoB,EAAK,CAAC,EACtE,SAAW,MAAM,QAAQ,KAAK,IAAK,IAAI,EAC7C,SAAK,wBAAuB,SAAU,YAAY,EAG3C,+BAA+B,QAAQ,EAFrC,CAAC,CAGZ,CCjCO,IAAM,sCAAsF,CACjG,CAAE,MAAO,SAAU,MAAO,QAAS,EACnC,CAAE,MAAO,YAAa,MAAO,YAAa,EAC1C,CAAE,MAAO,sBAAuB,MAAO,SAAU,EACjD,CAAE,MAAO,eAAgB,MAAO,gBAAiB,EACjD,CAAE,MAAO,YAAa,MAAO,WAAY,EACzC,CAAE,MAAO,2BAA4B,MAAO,mBAAoB,EAChE,CAAE,MAAO,yBAA0B,MAAO,mBAAoB,CAChE,EAGa,wCAAkF,CAAC,QAAQ,EChCxG,uBAAoC,gCAc7B,SAAS,oBAAoB,QAAsD,CACxF,SAAO,wCAAoB,4BAA6B,sBAAuB,OAAO,CACxF,CCfA,IAAAA,oBAAmC,gCAqB5B,SAAS,8BAAmE,CACjF,SAAO,wCAAmB,CAC5B,CCxBA,IAAAC,oBAAsC,gCA+B/B,SAAS,sBAAsB,QAAoE,CACxG,SAAO,2CAAsB,CAC3B,UAAW,QAAQ,UACnB,iBAAkB,QAAQ,iBAC1B,iBAAkB,QAAQ,qBAC1B,MAAO,QAAQ,KACjB,CAAC,CACH,CCrCA,IAAAC,oBAAkC,gCAe3B,SAAS,6BAAiE,CAC/E,SAAO,uCACL,+BACA,mCACF,CACF",
6
6
  "names": ["import_react_hooks", "import_react_hooks", "import_react_hooks"]
7
7
  }
@@ -2,6 +2,7 @@ import type { Identifier } from '@medplum/fhirtypes';
2
2
  import type { MedicationIFrameOptions } from '@medplum/react-hooks';
3
3
  import type { MedicationOrderExtensions } from '@medplum/core';
4
4
  import type { MedplumClient } from '@medplum/core';
5
+ import type { PharmacySearchParams } from '@medplum/core';
5
6
  import type { UseMedicationOrderReturn } from '@medplum/react-hooks';
6
7
  import type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';
7
8
  import type { UsePharmacySearchReturn } from '@medplum/react-hooks';
@@ -25,6 +26,9 @@ export declare const MEDPLUM_BOT_SYSTEM = "https://www.medplum.com/bots";
25
26
 
26
27
  export declare const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier;
27
28
 
29
+ /** Default specialty filter for nearby retail pharmacy pickers. */
30
+ export declare const SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES: readonly ScriptSurePharmacySpecialty[];
31
+
28
32
  /**
29
33
  * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via
30
34
  * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).
@@ -81,6 +85,9 @@ export declare const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = "https://scriptsure.co
81
85
 
82
86
  export declare const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = "https://scriptsure.com/pending-order-status";
83
87
 
88
+ /** Category filters shown in the ScriptSure pharmacy search dialog. */
89
+ export declare const SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS: readonly ScriptSurePharmacySpecialtyOption[];
90
+
84
91
  /** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */
85
92
  export declare const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = "https://scriptsure.com/routed-med-id";
86
93
 
@@ -94,6 +101,25 @@ export declare const SCRIPTSURE_SYSTEM = "https://scriptsure.com";
94
101
 
95
102
  export declare type ScriptSureIFrameOptions = MedicationIFrameOptions;
96
103
 
104
+ /**
105
+ * ScriptSure pharmacy search parameters.
106
+ * Extends the shared dialog fields with SureScripts specialty filters.
107
+ */
108
+ export declare interface ScriptSurePharmacySearchParams extends PharmacySearchParams {
109
+ specialties?: ScriptSurePharmacySpecialty[];
110
+ }
111
+
112
+ /**
113
+ * SureScripts pharmacy specialty tags accepted by POST /v3/pharmacy/search `specialties`.
114
+ * Must stay aligned with ScriptSure API allowed values.
115
+ */
116
+ export declare type ScriptSurePharmacySpecialty = 'Retail' | 'MailOrder' | 'TwentyFourHourStore' | 'SupportsDigitalSignature' | 'LongTermCare' | 'Specialty' | 'FaxPharmacySurescripts';
117
+
118
+ export declare interface ScriptSurePharmacySpecialtyOption {
119
+ readonly value: ScriptSurePharmacySpecialty;
120
+ readonly label: string;
121
+ }
122
+
97
123
  /**
98
124
  * React hook that syncs a patient to ScriptSure and returns the iframe URL.
99
125
  *
@@ -160,13 +186,14 @@ export declare type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;
160
186
  /**
161
187
  * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.
162
188
  *
163
- * Thin wrapper around the generic {@link usePharmacySearch} hook,
164
- * pre-configured with ScriptSure bot identifiers.
189
+ * Thin wrapper around the generic {@link usePharmacySearch} hook, pre-configured with
190
+ * ScriptSure bot identifiers and widened so search params carry ScriptSure-only
191
+ * `specialties` filters for POST /v3/pharmacy/search.
165
192
  *
166
193
  * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.
167
194
  */
168
195
  export declare function useScriptSurePharmacySearch(): UseScriptSurePharmacySearchReturn;
169
196
 
170
- export declare type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn;
197
+ export declare type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn<ScriptSurePharmacySearchParams>;
171
198
 
172
199
  export { }
@@ -2,6 +2,7 @@ import type { Identifier } from '@medplum/fhirtypes';
2
2
  import type { MedicationIFrameOptions } from '@medplum/react-hooks';
3
3
  import type { MedicationOrderExtensions } from '@medplum/core';
4
4
  import type { MedplumClient } from '@medplum/core';
5
+ import type { PharmacySearchParams } from '@medplum/core';
5
6
  import type { UseMedicationOrderReturn } from '@medplum/react-hooks';
6
7
  import type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';
7
8
  import type { UsePharmacySearchReturn } from '@medplum/react-hooks';
@@ -25,6 +26,9 @@ export declare const MEDPLUM_BOT_SYSTEM = "https://www.medplum.com/bots";
25
26
 
26
27
  export declare const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier;
27
28
 
29
+ /** Default specialty filter for nearby retail pharmacy pickers. */
30
+ export declare const SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES: readonly ScriptSurePharmacySpecialty[];
31
+
28
32
  /**
29
33
  * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via
30
34
  * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).
@@ -81,6 +85,9 @@ export declare const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = "https://scriptsure.co
81
85
 
82
86
  export declare const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = "https://scriptsure.com/pending-order-status";
83
87
 
88
+ /** Category filters shown in the ScriptSure pharmacy search dialog. */
89
+ export declare const SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS: readonly ScriptSurePharmacySpecialtyOption[];
90
+
84
91
  /** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */
85
92
  export declare const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = "https://scriptsure.com/routed-med-id";
86
93
 
@@ -94,6 +101,25 @@ export declare const SCRIPTSURE_SYSTEM = "https://scriptsure.com";
94
101
 
95
102
  export declare type ScriptSureIFrameOptions = MedicationIFrameOptions;
96
103
 
104
+ /**
105
+ * ScriptSure pharmacy search parameters.
106
+ * Extends the shared dialog fields with SureScripts specialty filters.
107
+ */
108
+ export declare interface ScriptSurePharmacySearchParams extends PharmacySearchParams {
109
+ specialties?: ScriptSurePharmacySpecialty[];
110
+ }
111
+
112
+ /**
113
+ * SureScripts pharmacy specialty tags accepted by POST /v3/pharmacy/search `specialties`.
114
+ * Must stay aligned with ScriptSure API allowed values.
115
+ */
116
+ export declare type ScriptSurePharmacySpecialty = 'Retail' | 'MailOrder' | 'TwentyFourHourStore' | 'SupportsDigitalSignature' | 'LongTermCare' | 'Specialty' | 'FaxPharmacySurescripts';
117
+
118
+ export declare interface ScriptSurePharmacySpecialtyOption {
119
+ readonly value: ScriptSurePharmacySpecialty;
120
+ readonly label: string;
121
+ }
122
+
97
123
  /**
98
124
  * React hook that syncs a patient to ScriptSure and returns the iframe URL.
99
125
  *
@@ -160,13 +186,14 @@ export declare type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;
160
186
  /**
161
187
  * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.
162
188
  *
163
- * Thin wrapper around the generic {@link usePharmacySearch} hook,
164
- * pre-configured with ScriptSure bot identifiers.
189
+ * Thin wrapper around the generic {@link usePharmacySearch} hook, pre-configured with
190
+ * ScriptSure bot identifiers and widened so search params carry ScriptSure-only
191
+ * `specialties` filters for POST /v3/pharmacy/search.
165
192
  *
166
193
  * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.
167
194
  */
168
195
  export declare function useScriptSurePharmacySearch(): UseScriptSurePharmacySearchReturn;
169
196
 
170
- export declare type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn;
197
+ export declare type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn<ScriptSurePharmacySearchParams>;
171
198
 
172
199
  export { }
@@ -1,2 +1,2 @@
1
- var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",SCRIPTSURE_DRUG_SEARCH_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-drug-search-bot"},SCRIPTSURE_ORDER_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-medication-bot"},SCRIPTSURE_ROUTED_MED_ID_SYSTEM="https://scriptsure.com/routed-med-id",SCRIPTSURE_PENDING_ORDER_ID_SYSTEM="https://scriptsure.com/pending-order-id",SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION="https://scriptsure.com/pending-order-status",SCRIPTSURE_IFRAME_URL_EXTENSION="https://scriptsure.com/iframe-url",SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS={pendingOrderIdSystem:SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,pendingOrderStatusUrl:SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,iframeUrlExtension:SCRIPTSURE_IFRAME_URL_EXTENSION},SCRIPTSURE_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-iframe-bot"},SCRIPTSURE_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-patient-sync-bot"},SCRIPTSURE_ORDER_SET_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-set-bot"},SCRIPTSURE_ORDERSET_ID_SYSTEM="https://spa.scriptsure.com/orderset-id",SCRIPTSURE_SEARCH_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-search-pharmacy-bot"},SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-add-patient-pharmacy-bot"},SCRIPTSURE_PATIENT_ID_SYSTEM="https://scriptsure.com/patient-id",SCRIPTSURE_SYSTEM="https://scriptsure.com",SCRIPTSURE_SIG_EXTENSION=`${SCRIPTSURE_SYSTEM}/sig`,SCRIPTSURE_NAME_TYPE_EXTENSION=`${SCRIPTSURE_SYSTEM}/name-type`,SCRIPTSURE_GENERIC_NAME_EXTENSION=`${SCRIPTSURE_SYSTEM}/generic-name`;import{isResource,medicationSearchParamsToParameters}from"@medplum/core";function parametersToQuantityQualifiers(params){let rows=[];for(let p of params.parameter??[]){if(p.name!=="quantityQualifier"||!p.part)continue;let code=p.part.find(part=>part.name==="code")?.valueString,label=p.part.find(part=>part.name==="label")?.valueString;typeof code=="string"&&typeof label=="string"&&rows.push({code,label})}return rows}async function loadScriptSureQuantityQualifiers(medplum){let url=medplum.fhirUrl("Medication","$drug-quantity-qualifiers"),body=medicationSearchParamsToParameters({quantityQualifiers:!0}),response=await medplum.post(url,body);return isResource(response,"Parameters")?parametersToQuantityQualifiers(response):[]}import{useMedicationIFrame}from"@medplum/react-hooks";function useScriptSureIFrame(options){return useMedicationIFrame(SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_IFRAME_BOT,options)}import{useMedicationOrder}from"@medplum/react-hooks";function useScriptSureOrderMedication(){return useMedicationOrder()}import{useMedicationOrderSet}from"@medplum/react-hooks";function useScriptSureOrderSet(options){return useMedicationOrderSet({patientId:options.patientId,planDefinitionId:options.planDefinitionId,vendorOrderSetId:options.scriptSureOrdersetId,appId:options.appId})}import{usePharmacySearch}from"@medplum/react-hooks";function useScriptSurePharmacySearch(){return usePharmacySearch(SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT)}export{MEDPLUM_BOT_SYSTEM,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT,SCRIPTSURE_DRUG_SEARCH_BOT,SCRIPTSURE_GENERIC_NAME_EXTENSION,SCRIPTSURE_IFRAME_BOT,SCRIPTSURE_IFRAME_URL_EXTENSION,SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS,SCRIPTSURE_NAME_TYPE_EXTENSION,SCRIPTSURE_ORDERSET_ID_SYSTEM,SCRIPTSURE_ORDER_MEDICATION_BOT,SCRIPTSURE_ORDER_SET_BOT,SCRIPTSURE_PATIENT_ID_SYSTEM,SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,SCRIPTSURE_ROUTED_MED_ID_SYSTEM,SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_SIG_EXTENSION,SCRIPTSURE_SYSTEM,loadScriptSureQuantityQualifiers,useScriptSureIFrame,useScriptSureOrderMedication,useScriptSureOrderSet,useScriptSurePharmacySearch};
1
+ var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",SCRIPTSURE_DRUG_SEARCH_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-drug-search-bot"},SCRIPTSURE_ORDER_MEDICATION_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-medication-bot"},SCRIPTSURE_ROUTED_MED_ID_SYSTEM="https://scriptsure.com/routed-med-id",SCRIPTSURE_PENDING_ORDER_ID_SYSTEM="https://scriptsure.com/pending-order-id",SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION="https://scriptsure.com/pending-order-status",SCRIPTSURE_IFRAME_URL_EXTENSION="https://scriptsure.com/iframe-url",SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS={pendingOrderIdSystem:SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,pendingOrderStatusUrl:SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,iframeUrlExtension:SCRIPTSURE_IFRAME_URL_EXTENSION},SCRIPTSURE_IFRAME_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-iframe-bot"},SCRIPTSURE_PATIENT_SYNC_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-patient-sync-bot"},SCRIPTSURE_ORDER_SET_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-order-set-bot"},SCRIPTSURE_ORDERSET_ID_SYSTEM="https://spa.scriptsure.com/orderset-id",SCRIPTSURE_SEARCH_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-search-pharmacy-bot"},SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT={system:MEDPLUM_BOT_SYSTEM,value:"scriptsure-add-patient-pharmacy-bot"},SCRIPTSURE_PATIENT_ID_SYSTEM="https://scriptsure.com/patient-id",SCRIPTSURE_SYSTEM="https://scriptsure.com",SCRIPTSURE_SIG_EXTENSION=`${SCRIPTSURE_SYSTEM}/sig`,SCRIPTSURE_NAME_TYPE_EXTENSION=`${SCRIPTSURE_SYSTEM}/name-type`,SCRIPTSURE_GENERIC_NAME_EXTENSION=`${SCRIPTSURE_SYSTEM}/generic-name`;import{isResource,medicationSearchParamsToParameters}from"@medplum/core";function parametersToQuantityQualifiers(params){let rows=[];for(let p of params.parameter??[]){if(p.name!=="quantityQualifier"||!p.part)continue;let code=p.part.find(part=>part.name==="code")?.valueString,label=p.part.find(part=>part.name==="label")?.valueString;typeof code=="string"&&typeof label=="string"&&rows.push({code,label})}return rows}async function loadScriptSureQuantityQualifiers(medplum){let url=medplum.fhirUrl("Medication","$drug-quantity-qualifiers"),body=medicationSearchParamsToParameters({quantityQualifiers:!0}),response=await medplum.post(url,body);return isResource(response,"Parameters")?parametersToQuantityQualifiers(response):[]}var SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS=[{value:"Retail",label:"Retail"},{value:"MailOrder",label:"Mail order"},{value:"TwentyFourHourStore",label:"24-hour"},{value:"LongTermCare",label:"Long-term care"},{value:"Specialty",label:"Specialty"},{value:"SupportsDigitalSignature",label:"Digital signature"},{value:"FaxPharmacySurescripts",label:"Fax (Surescripts)"}],SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES=["Retail"];import{useMedicationIFrame}from"@medplum/react-hooks";function useScriptSureIFrame(options){return useMedicationIFrame(SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_IFRAME_BOT,options)}import{useMedicationOrder}from"@medplum/react-hooks";function useScriptSureOrderMedication(){return useMedicationOrder()}import{useMedicationOrderSet}from"@medplum/react-hooks";function useScriptSureOrderSet(options){return useMedicationOrderSet({patientId:options.patientId,planDefinitionId:options.planDefinitionId,vendorOrderSetId:options.scriptSureOrdersetId,appId:options.appId})}import{usePharmacySearch}from"@medplum/react-hooks";function useScriptSurePharmacySearch(){return usePharmacySearch(SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT)}export{MEDPLUM_BOT_SYSTEM,SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT,SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES,SCRIPTSURE_DRUG_SEARCH_BOT,SCRIPTSURE_GENERIC_NAME_EXTENSION,SCRIPTSURE_IFRAME_BOT,SCRIPTSURE_IFRAME_URL_EXTENSION,SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS,SCRIPTSURE_NAME_TYPE_EXTENSION,SCRIPTSURE_ORDERSET_ID_SYSTEM,SCRIPTSURE_ORDER_MEDICATION_BOT,SCRIPTSURE_ORDER_SET_BOT,SCRIPTSURE_PATIENT_ID_SYSTEM,SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS,SCRIPTSURE_ROUTED_MED_ID_SYSTEM,SCRIPTSURE_SEARCH_PHARMACY_BOT,SCRIPTSURE_SIG_EXTENSION,SCRIPTSURE_SYSTEM,loadScriptSureQuantityQualifiers,useScriptSureIFrame,useScriptSureOrderMedication,useScriptSureOrderSet,useScriptSurePharmacySearch};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/common.ts", "../../src/loadScriptSureQuantityQualifiers.ts", "../../src/useScriptSureIFrame.ts", "../../src/useScriptSureOrderMedication.ts", "../../src/useScriptSureOrderSet.ts", "../../src/useScriptSurePharmacySearch.ts"],
4
- "sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationOrderExtensions } from '@medplum/core';\nimport type { Identifier } from '@medplum/fhirtypes';\n\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\n/**\n * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via\n * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `drug-search` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_DRUG_SEARCH_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-drug-search-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-medication` custom FHIR operation via\n * `useMedicationOrder().orderMedication(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-medication` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-medication-bot',\n};\n\n/** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */\nexport const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = 'https://scriptsure.com/routed-med-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = 'https://scriptsure.com/pending-order-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = 'https://scriptsure.com/pending-order-status';\n\nexport const SCRIPTSURE_IFRAME_URL_EXTENSION = 'https://scriptsure.com/iframe-url';\n\nexport const SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS: MedicationOrderExtensions = {\n pendingOrderIdSystem: SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,\n pendingOrderStatusUrl: SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,\n iframeUrlExtension: SCRIPTSURE_IFRAME_URL_EXTENSION,\n};\n\nexport const SCRIPTSURE_IFRAME_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-iframe-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-patient-sync-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-set-url` custom FHIR operation via\n * `useScriptSureOrderSet(...)` (thin wrapper around `useMedicationOrderSet`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-set-url` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_SET_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-set-bot',\n};\n\n/** Identifier system for the ScriptSure orderset id stamped on FHIR PlanDefinitions. */\nexport const SCRIPTSURE_ORDERSET_ID_SYSTEM = 'https://spa.scriptsure.com/orderset-id';\n\nexport const SCRIPTSURE_SEARCH_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-search-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-add-patient-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_ID_SYSTEM = 'https://scriptsure.com/patient-id';\n\n/** Base URL for ScriptSure-specific extensions on in-memory Medication resources (e.g. `/sig`). */\nexport const SCRIPTSURE_SYSTEM = 'https://scriptsure.com';\n\n/** Pre-built dosing option on a Medication from drug-format lookup (`routedMedId` search). */\nexport const SCRIPTSURE_SIG_EXTENSION = `${SCRIPTSURE_SYSTEM}/sig`;\n\n/** ScriptSure MED_NAME_TYPE_CD on a search-result Medication: `'1'` = brand, `'2'` = generic. */\nexport const SCRIPTSURE_NAME_TYPE_EXTENSION = `${SCRIPTSURE_SYSTEM}/name-type`;\n\n/** ScriptSure GenericName on a search-result Medication (parent generic when the row is a brand). */\nexport const SCRIPTSURE_GENERIC_NAME_EXTENSION = `${SCRIPTSURE_SYSTEM}/generic-name`;\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MedplumClient } from '@medplum/core';\nimport { isResource, medicationSearchParamsToParameters } from '@medplum/core';\nimport type { Parameters } from '@medplum/fhirtypes';\n\n/**\n * Reads `{ code, label }` rows from a `Parameters` resource produced by the\n * `$drug-quantity-qualifiers` custom operation.\n *\n * The OperationDefinition (see `scriptsure-drug-search-bot` registration in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`) declares a single\n * repeating output parameter named `quantityQualifier`, each entry bearing\n * `part: [{ name: 'code', valueString }, { name: 'label', valueString }]`.\n * The server's `buildOutputParameters` wraps the bot return value into that\n * shape, so the parser only needs to handle this one canonical layout.\n * Entries missing either inner part are skipped defensively.\n *\n * @param params - `Parameters` resource returned by the operation.\n * @returns `{ code, label }` rows for UI selects.\n */\nfunction parametersToQuantityQualifiers(params: Parameters): { code: string; label: string }[] {\n const rows: { code: string; label: string }[] = [];\n for (const p of params.parameter ?? []) {\n if (p.name !== 'quantityQualifier' || !p.part) {\n continue;\n }\n const code = p.part.find((part) => part.name === 'code')?.valueString;\n const label = p.part.find((part) => part.name === 'label')?.valueString;\n if (typeof code === 'string' && typeof label === 'string') {\n rows.push({ code, label });\n }\n }\n return rows;\n}\n\n/**\n * Fetches NCI potency-unit codes for dispense quantity qualifiers via the\n * vendor-neutral `$drug-quantity-qualifiers` custom FHIR operation. Each\n * Medplum project picks the vendor implementation at deploy time by pointing\n * its `OperationDefinition` at the appropriate Bot (ScriptSure's\n * `scriptsure-drug-search-bot` today; see `deploy.ts`).\n *\n * @param medplum - Medplum client (user session).\n * @returns `{ code, label }` rows for UI selects.\n */\nexport async function loadScriptSureQuantityQualifiers(\n medplum: MedplumClient\n): Promise<{ code: string; label: string }[]> {\n const url = medplum.fhirUrl('Medication', '$drug-quantity-qualifiers');\n const body = medicationSearchParamsToParameters({ quantityQualifiers: true });\n const response = await medplum.post(url, body);\n if (!isResource<Parameters>(response, 'Parameters')) {\n return [];\n }\n return parametersToQuantityQualifiers(response);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationIFrameOptions } from '@medplum/react-hooks';\nimport { useMedicationIFrame } from '@medplum/react-hooks';\nimport { SCRIPTSURE_IFRAME_BOT, SCRIPTSURE_PATIENT_SYNC_BOT } from './common';\n\nexport type ScriptSureIFrameOptions = MedicationIFrameOptions;\n\n/**\n * React hook that syncs a patient to ScriptSure and returns the iframe URL.\n *\n * Thin wrapper around the generic {@link useMedicationIFrame} hook,\n * pre-configured with ScriptSure bot identifiers.\n *\n * @param options - Configuration and callback options.\n * @returns The ScriptSure iframe URL, or undefined while loading.\n */\nexport function useScriptSureIFrame(options: ScriptSureIFrameOptions): string | undefined {\n return useMedicationIFrame(SCRIPTSURE_PATIENT_SYNC_BOT, SCRIPTSURE_IFRAME_BOT, options);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseMedicationOrderReturn } from '@medplum/react-hooks';\nimport { useMedicationOrder } from '@medplum/react-hooks';\n\nexport type UseScriptSureOrderMedicationReturn = UseMedicationOrderReturn;\n\n/**\n * React hook for ScriptSure drug search and pending order creation (iframe launch URL).\n *\n * Now a near-empty re-export of `useMedicationOrder` from `@medplum/react-hooks`: the\n * vendor binding lives entirely on the server, where each Medplum project's\n * `OperationDefinition` resources for `$drug-search` and `$order-medication`\n * point at the ScriptSure bots via the\n * `operationDefinition-implementation` extension. See the deploy script in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts` for how those\n * resources are upserted.\n *\n * Kept as a typed alias for backwards source-compatibility with apps importing\n * `useScriptSureOrderMedication` and as a documentation anchor for the\n * ScriptSure-specific behavior (e.g. patient-must-be-synced precondition).\n *\n * @returns The same API as `useMedicationOrder` (search + order callbacks).\n */\nexport function useScriptSureOrderMedication(): UseScriptSureOrderMedicationReturn {\n return useMedicationOrder();\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';\nimport { useMedicationOrderSet } from '@medplum/react-hooks';\n\nexport interface UseScriptSureOrderSetOptions {\n /** Patient to prescribe against. Hook stays idle (no operation call) until set. */\n readonly patientId: string | undefined;\n /** Medplum PlanDefinition id; bot reverse-looks up the ScriptSure orderset id. */\n readonly planDefinitionId?: string;\n /** ScriptSure orderset id (escape hatch when no synced PD exists yet). */\n readonly scriptSureOrdersetId?: number;\n readonly appId?: string;\n}\n\nexport type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;\n\n/**\n * React hook that returns the ScriptSure order-set prescribing widget URL via\n * the vendor-neutral `$order-set-url` FHIR custom operation\n * (`POST /fhir/R4/PlanDefinition/$order-set-url`).\n *\n * Thin wrapper around {@link useMedicationOrderSet}: forwards\n * `scriptSureOrdersetId` as the operation's `vendorOrderSetId` parameter,\n * leaves vendor binding to the deployed `OperationDefinition` \u2192\n * `Bot/scriptsure-order-set-bot` link.\n *\n * The operation is naturally idempotent \u2014 re-calls only refresh the session\n * token in the returned URL \u2014 so callers can safely wire `refresh` into\n * `PrescriptionIFrameModal.onRefreshLaunchUrl`.\n *\n * @param options - Patient + order-set picker (PD or ScriptSure id).\n * @returns `{ url, loading, error, refresh }`.\n */\nexport function useScriptSureOrderSet(options: UseScriptSureOrderSetOptions): UseScriptSureOrderSetReturn {\n return useMedicationOrderSet({\n patientId: options.patientId,\n planDefinitionId: options.planDefinitionId,\n vendorOrderSetId: options.scriptSureOrdersetId,\n appId: options.appId,\n });\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UsePharmacySearchReturn } from '@medplum/react-hooks';\nimport { usePharmacySearch } from '@medplum/react-hooks';\nimport { SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT, SCRIPTSURE_SEARCH_PHARMACY_BOT } from './common';\n\nexport type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn;\n\n/**\n * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.\n *\n * Thin wrapper around the generic {@link usePharmacySearch} hook,\n * pre-configured with ScriptSure bot identifiers.\n *\n * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.\n */\nexport function useScriptSurePharmacySearch(): UseScriptSurePharmacySearchReturn {\n return usePharmacySearch(SCRIPTSURE_SEARCH_PHARMACY_BOT, SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT);\n}\n"],
5
- "mappings": "AAKO,IAAM,mBAAqB,+BAWrB,2BAAyC,CACpD,OAAQ,mBACR,MAAO,4BACT,EAWa,gCAA8C,CACzD,OAAQ,mBACR,MAAO,iCACT,EAGa,gCAAkC,uCAElC,mCAAqC,0CAErC,0CAA4C,8CAE5C,gCAAkC,oCAElC,uCAAoE,CAC/E,qBAAsB,mCACtB,sBAAuB,0CACvB,mBAAoB,+BACtB,EAEa,sBAAoC,CAC/C,OAAQ,mBACR,MAAO,uBACT,EAEa,4BAA0C,CACrD,OAAQ,mBACR,MAAO,6BACT,EAWa,yBAAuC,CAClD,OAAQ,mBACR,MAAO,0BACT,EAGa,8BAAgC,yCAEhC,+BAA6C,CACxD,OAAQ,mBACR,MAAO,gCACT,EAEa,oCAAkD,CAC7D,OAAQ,mBACR,MAAO,qCACT,EAEa,6BAA+B,oCAG/B,kBAAoB,yBAGpB,yBAA2B,GAAG,iBAAiB,OAG/C,+BAAiC,GAAG,iBAAiB,aAGrD,kCAAoC,GAAG,iBAAiB,gBC/FrE,OAAS,WAAY,uCAA0C,gBAkB/D,SAAS,+BAA+B,OAAuD,CAC7F,IAAM,KAA0C,CAAC,EACjD,QAAW,KAAK,OAAO,WAAa,CAAC,EAAG,CACtC,GAAI,EAAE,OAAS,qBAAuB,CAAC,EAAE,KACvC,SAEF,IAAM,KAAO,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,MAAM,GAAG,YACpD,MAAQ,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,OAAO,GAAG,YACxD,OAAO,MAAS,UAAY,OAAO,OAAU,UAC/C,KAAK,KAAK,CAAE,KAAM,KAAM,CAAC,CAE7B,CACA,OAAO,IACT,CAYA,eAAsB,iCACpB,QAC4C,CAC5C,IAAM,IAAM,QAAQ,QAAQ,aAAc,2BAA2B,EAC/D,KAAO,mCAAmC,CAAE,mBAAoB,EAAK,CAAC,EACtE,SAAW,MAAM,QAAQ,KAAK,IAAK,IAAI,EAC7C,OAAK,WAAuB,SAAU,YAAY,EAG3C,+BAA+B,QAAQ,EAFrC,CAAC,CAGZ,CCtDA,OAAS,wBAA2B,uBAc7B,SAAS,oBAAoB,QAAsD,CACxF,OAAO,oBAAoB,4BAA6B,sBAAuB,OAAO,CACxF,CCfA,OAAS,uBAA0B,uBAqB5B,SAAS,8BAAmE,CACjF,OAAO,mBAAmB,CAC5B,CCxBA,OAAS,0BAA6B,uBA+B/B,SAAS,sBAAsB,QAAoE,CACxG,OAAO,sBAAsB,CAC3B,UAAW,QAAQ,UACnB,iBAAkB,QAAQ,iBAC1B,iBAAkB,QAAQ,qBAC1B,MAAO,QAAQ,KACjB,CAAC,CACH,CCrCA,OAAS,sBAAyB,uBAa3B,SAAS,6BAAiE,CAC/E,OAAO,kBAAkB,+BAAgC,mCAAmC,CAC9F",
3
+ "sources": ["../../src/common.ts", "../../src/loadScriptSureQuantityQualifiers.ts", "../../src/pharmacy-search.ts", "../../src/useScriptSureIFrame.ts", "../../src/useScriptSureOrderMedication.ts", "../../src/useScriptSureOrderSet.ts", "../../src/useScriptSurePharmacySearch.ts"],
4
+ "sourcesContent": ["// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationOrderExtensions } from '@medplum/core';\nimport type { Identifier } from '@medplum/fhirtypes';\n\nexport const MEDPLUM_BOT_SYSTEM = 'https://www.medplum.com/bots';\n\n/**\n * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via\n * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `drug-search` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_DRUG_SEARCH_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-drug-search-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-medication` custom FHIR operation via\n * `useMedicationOrder().orderMedication(...)` (see `@medplum/react-hooks`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-medication` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_MEDICATION_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-medication-bot',\n};\n\n/** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */\nexport const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = 'https://scriptsure.com/routed-med-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = 'https://scriptsure.com/pending-order-id';\n\nexport const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = 'https://scriptsure.com/pending-order-status';\n\nexport const SCRIPTSURE_IFRAME_URL_EXTENSION = 'https://scriptsure.com/iframe-url';\n\nexport const SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS: MedicationOrderExtensions = {\n pendingOrderIdSystem: SCRIPTSURE_PENDING_ORDER_ID_SYSTEM,\n pendingOrderStatusUrl: SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION,\n iframeUrlExtension: SCRIPTSURE_IFRAME_URL_EXTENSION,\n};\n\nexport const SCRIPTSURE_IFRAME_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-iframe-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_SYNC_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-patient-sync-bot',\n};\n\n/**\n * @deprecated Use the vendor-neutral `$order-set-url` custom FHIR operation via\n * `useScriptSureOrderSet(...)` (thin wrapper around `useMedicationOrderSet`).\n * The bot identifier is kept exported for one release to preserve source\n * compatibility for any caller still invoking `medplum.executeBot(...)`\n * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`\n * now register an `OperationDefinition` with code `order-set-url` whose\n * `operationDefinition-implementation` extension points at this bot.\n */\nexport const SCRIPTSURE_ORDER_SET_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-order-set-bot',\n};\n\n/** Identifier system for the ScriptSure orderset id stamped on FHIR PlanDefinitions. */\nexport const SCRIPTSURE_ORDERSET_ID_SYSTEM = 'https://spa.scriptsure.com/orderset-id';\n\nexport const SCRIPTSURE_SEARCH_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-search-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier = {\n system: MEDPLUM_BOT_SYSTEM,\n value: 'scriptsure-add-patient-pharmacy-bot',\n};\n\nexport const SCRIPTSURE_PATIENT_ID_SYSTEM = 'https://scriptsure.com/patient-id';\n\n/** Base URL for ScriptSure-specific extensions on in-memory Medication resources (e.g. `/sig`). */\nexport const SCRIPTSURE_SYSTEM = 'https://scriptsure.com';\n\n/** Pre-built dosing option on a Medication from drug-format lookup (`routedMedId` search). */\nexport const SCRIPTSURE_SIG_EXTENSION = `${SCRIPTSURE_SYSTEM}/sig`;\n\n/** ScriptSure MED_NAME_TYPE_CD on a search-result Medication: `'1'` = brand, `'2'` = generic. */\nexport const SCRIPTSURE_NAME_TYPE_EXTENSION = `${SCRIPTSURE_SYSTEM}/name-type`;\n\n/** ScriptSure GenericName on a search-result Medication (parent generic when the row is a brand). */\nexport const SCRIPTSURE_GENERIC_NAME_EXTENSION = `${SCRIPTSURE_SYSTEM}/generic-name`;\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MedplumClient } from '@medplum/core';\nimport { isResource, medicationSearchParamsToParameters } from '@medplum/core';\nimport type { Parameters } from '@medplum/fhirtypes';\n\n/**\n * Reads `{ code, label }` rows from a `Parameters` resource produced by the\n * `$drug-quantity-qualifiers` custom operation.\n *\n * The OperationDefinition (see `scriptsure-drug-search-bot` registration in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`) declares a single\n * repeating output parameter named `quantityQualifier`, each entry bearing\n * `part: [{ name: 'code', valueString }, { name: 'label', valueString }]`.\n * The server's `buildOutputParameters` wraps the bot return value into that\n * shape, so the parser only needs to handle this one canonical layout.\n * Entries missing either inner part are skipped defensively.\n *\n * @param params - `Parameters` resource returned by the operation.\n * @returns `{ code, label }` rows for UI selects.\n */\nfunction parametersToQuantityQualifiers(params: Parameters): { code: string; label: string }[] {\n const rows: { code: string; label: string }[] = [];\n for (const p of params.parameter ?? []) {\n if (p.name !== 'quantityQualifier' || !p.part) {\n continue;\n }\n const code = p.part.find((part) => part.name === 'code')?.valueString;\n const label = p.part.find((part) => part.name === 'label')?.valueString;\n if (typeof code === 'string' && typeof label === 'string') {\n rows.push({ code, label });\n }\n }\n return rows;\n}\n\n/**\n * Fetches NCI potency-unit codes for dispense quantity qualifiers via the\n * vendor-neutral `$drug-quantity-qualifiers` custom FHIR operation. Each\n * Medplum project picks the vendor implementation at deploy time by pointing\n * its `OperationDefinition` at the appropriate Bot (ScriptSure's\n * `scriptsure-drug-search-bot` today; see `deploy.ts`).\n *\n * @param medplum - Medplum client (user session).\n * @returns `{ code, label }` rows for UI selects.\n */\nexport async function loadScriptSureQuantityQualifiers(\n medplum: MedplumClient\n): Promise<{ code: string; label: string }[]> {\n const url = medplum.fhirUrl('Medication', '$drug-quantity-qualifiers');\n const body = medicationSearchParamsToParameters({ quantityQualifiers: true });\n const response = await medplum.post(url, body);\n if (!isResource<Parameters>(response, 'Parameters')) {\n return [];\n }\n return parametersToQuantityQualifiers(response);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PharmacySearchParams } from '@medplum/core';\n\n/**\n * SureScripts pharmacy specialty tags accepted by POST /v3/pharmacy/search `specialties`.\n * Must stay aligned with ScriptSure API allowed values.\n */\nexport type ScriptSurePharmacySpecialty =\n | 'Retail'\n | 'MailOrder'\n | 'TwentyFourHourStore'\n | 'SupportsDigitalSignature'\n | 'LongTermCare'\n | 'Specialty'\n | 'FaxPharmacySurescripts';\n\nexport interface ScriptSurePharmacySpecialtyOption {\n readonly value: ScriptSurePharmacySpecialty;\n readonly label: string;\n}\n\n/** Category filters shown in the ScriptSure pharmacy search dialog. */\nexport const SCRIPTSURE_PHARMACY_SPECIALTY_OPTIONS: readonly ScriptSurePharmacySpecialtyOption[] = [\n { value: 'Retail', label: 'Retail' },\n { value: 'MailOrder', label: 'Mail order' },\n { value: 'TwentyFourHourStore', label: '24-hour' },\n { value: 'LongTermCare', label: 'Long-term care' },\n { value: 'Specialty', label: 'Specialty' },\n { value: 'SupportsDigitalSignature', label: 'Digital signature' },\n { value: 'FaxPharmacySurescripts', label: 'Fax (Surescripts)' },\n] as const;\n\n/** Default specialty filter for nearby retail pharmacy pickers. */\nexport const SCRIPTSURE_DEFAULT_PHARMACY_SPECIALTIES: readonly ScriptSurePharmacySpecialty[] = ['Retail'];\n\n/**\n * ScriptSure pharmacy search parameters.\n * Extends the shared dialog fields with SureScripts specialty filters.\n */\nexport interface ScriptSurePharmacySearchParams extends PharmacySearchParams {\n specialties?: ScriptSurePharmacySpecialty[];\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { MedicationIFrameOptions } from '@medplum/react-hooks';\nimport { useMedicationIFrame } from '@medplum/react-hooks';\nimport { SCRIPTSURE_IFRAME_BOT, SCRIPTSURE_PATIENT_SYNC_BOT } from './common';\n\nexport type ScriptSureIFrameOptions = MedicationIFrameOptions;\n\n/**\n * React hook that syncs a patient to ScriptSure and returns the iframe URL.\n *\n * Thin wrapper around the generic {@link useMedicationIFrame} hook,\n * pre-configured with ScriptSure bot identifiers.\n *\n * @param options - Configuration and callback options.\n * @returns The ScriptSure iframe URL, or undefined while loading.\n */\nexport function useScriptSureIFrame(options: ScriptSureIFrameOptions): string | undefined {\n return useMedicationIFrame(SCRIPTSURE_PATIENT_SYNC_BOT, SCRIPTSURE_IFRAME_BOT, options);\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseMedicationOrderReturn } from '@medplum/react-hooks';\nimport { useMedicationOrder } from '@medplum/react-hooks';\n\nexport type UseScriptSureOrderMedicationReturn = UseMedicationOrderReturn;\n\n/**\n * React hook for ScriptSure drug search and pending order creation (iframe launch URL).\n *\n * Now a near-empty re-export of `useMedicationOrder` from `@medplum/react-hooks`: the\n * vendor binding lives entirely on the server, where each Medplum project's\n * `OperationDefinition` resources for `$drug-search` and `$order-medication`\n * point at the ScriptSure bots via the\n * `operationDefinition-implementation` extension. See the deploy script in\n * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts` for how those\n * resources are upserted.\n *\n * Kept as a typed alias for backwards source-compatibility with apps importing\n * `useScriptSureOrderMedication` and as a documentation anchor for the\n * ScriptSure-specific behavior (e.g. patient-must-be-synced precondition).\n *\n * @returns The same API as `useMedicationOrder` (search + order callbacks).\n */\nexport function useScriptSureOrderMedication(): UseScriptSureOrderMedicationReturn {\n return useMedicationOrder();\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';\nimport { useMedicationOrderSet } from '@medplum/react-hooks';\n\nexport interface UseScriptSureOrderSetOptions {\n /** Patient to prescribe against. Hook stays idle (no operation call) until set. */\n readonly patientId: string | undefined;\n /** Medplum PlanDefinition id; bot reverse-looks up the ScriptSure orderset id. */\n readonly planDefinitionId?: string;\n /** ScriptSure orderset id (escape hatch when no synced PD exists yet). */\n readonly scriptSureOrdersetId?: number;\n readonly appId?: string;\n}\n\nexport type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;\n\n/**\n * React hook that returns the ScriptSure order-set prescribing widget URL via\n * the vendor-neutral `$order-set-url` FHIR custom operation\n * (`POST /fhir/R4/PlanDefinition/$order-set-url`).\n *\n * Thin wrapper around {@link useMedicationOrderSet}: forwards\n * `scriptSureOrdersetId` as the operation's `vendorOrderSetId` parameter,\n * leaves vendor binding to the deployed `OperationDefinition` \u2192\n * `Bot/scriptsure-order-set-bot` link.\n *\n * The operation is naturally idempotent \u2014 re-calls only refresh the session\n * token in the returned URL \u2014 so callers can safely wire `refresh` into\n * `PrescriptionIFrameModal.onRefreshLaunchUrl`.\n *\n * @param options - Patient + order-set picker (PD or ScriptSure id).\n * @returns `{ url, loading, error, refresh }`.\n */\nexport function useScriptSureOrderSet(options: UseScriptSureOrderSetOptions): UseScriptSureOrderSetReturn {\n return useMedicationOrderSet({\n patientId: options.patientId,\n planDefinitionId: options.planDefinitionId,\n vendorOrderSetId: options.scriptSureOrdersetId,\n appId: options.appId,\n });\n}\n", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UsePharmacySearchReturn } from '@medplum/react-hooks';\nimport { usePharmacySearch } from '@medplum/react-hooks';\nimport { SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT, SCRIPTSURE_SEARCH_PHARMACY_BOT } from './common';\nimport type { ScriptSurePharmacySearchParams } from './pharmacy-search';\n\nexport type UseScriptSurePharmacySearchReturn = UsePharmacySearchReturn<ScriptSurePharmacySearchParams>;\n\n/**\n * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.\n *\n * Thin wrapper around the generic {@link usePharmacySearch} hook, pre-configured with\n * ScriptSure bot identifiers and widened so search params carry ScriptSure-only\n * `specialties` filters for POST /v3/pharmacy/search.\n *\n * @returns An object with `searchPharmacies` and `addToFavorites` callbacks.\n */\nexport function useScriptSurePharmacySearch(): UseScriptSurePharmacySearchReturn {\n return usePharmacySearch<ScriptSurePharmacySearchParams>(\n SCRIPTSURE_SEARCH_PHARMACY_BOT,\n SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT\n );\n}\n"],
5
+ "mappings": "AAKO,IAAM,mBAAqB,+BAWrB,2BAAyC,CACpD,OAAQ,mBACR,MAAO,4BACT,EAWa,gCAA8C,CACzD,OAAQ,mBACR,MAAO,iCACT,EAGa,gCAAkC,uCAElC,mCAAqC,0CAErC,0CAA4C,8CAE5C,gCAAkC,oCAElC,uCAAoE,CAC/E,qBAAsB,mCACtB,sBAAuB,0CACvB,mBAAoB,+BACtB,EAEa,sBAAoC,CAC/C,OAAQ,mBACR,MAAO,uBACT,EAEa,4BAA0C,CACrD,OAAQ,mBACR,MAAO,6BACT,EAWa,yBAAuC,CAClD,OAAQ,mBACR,MAAO,0BACT,EAGa,8BAAgC,yCAEhC,+BAA6C,CACxD,OAAQ,mBACR,MAAO,gCACT,EAEa,oCAAkD,CAC7D,OAAQ,mBACR,MAAO,qCACT,EAEa,6BAA+B,oCAG/B,kBAAoB,yBAGpB,yBAA2B,GAAG,iBAAiB,OAG/C,+BAAiC,GAAG,iBAAiB,aAGrD,kCAAoC,GAAG,iBAAiB,gBC/FrE,OAAS,WAAY,uCAA0C,gBAkB/D,SAAS,+BAA+B,OAAuD,CAC7F,IAAM,KAA0C,CAAC,EACjD,QAAW,KAAK,OAAO,WAAa,CAAC,EAAG,CACtC,GAAI,EAAE,OAAS,qBAAuB,CAAC,EAAE,KACvC,SAEF,IAAM,KAAO,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,MAAM,GAAG,YACpD,MAAQ,EAAE,KAAK,KAAM,MAAS,KAAK,OAAS,OAAO,GAAG,YACxD,OAAO,MAAS,UAAY,OAAO,OAAU,UAC/C,KAAK,KAAK,CAAE,KAAM,KAAM,CAAC,CAE7B,CACA,OAAO,IACT,CAYA,eAAsB,iCACpB,QAC4C,CAC5C,IAAM,IAAM,QAAQ,QAAQ,aAAc,2BAA2B,EAC/D,KAAO,mCAAmC,CAAE,mBAAoB,EAAK,CAAC,EACtE,SAAW,MAAM,QAAQ,KAAK,IAAK,IAAI,EAC7C,OAAK,WAAuB,SAAU,YAAY,EAG3C,+BAA+B,QAAQ,EAFrC,CAAC,CAGZ,CCjCO,IAAM,sCAAsF,CACjG,CAAE,MAAO,SAAU,MAAO,QAAS,EACnC,CAAE,MAAO,YAAa,MAAO,YAAa,EAC1C,CAAE,MAAO,sBAAuB,MAAO,SAAU,EACjD,CAAE,MAAO,eAAgB,MAAO,gBAAiB,EACjD,CAAE,MAAO,YAAa,MAAO,WAAY,EACzC,CAAE,MAAO,2BAA4B,MAAO,mBAAoB,EAChE,CAAE,MAAO,yBAA0B,MAAO,mBAAoB,CAChE,EAGa,wCAAkF,CAAC,QAAQ,EChCxG,OAAS,wBAA2B,uBAc7B,SAAS,oBAAoB,QAAsD,CACxF,OAAO,oBAAoB,4BAA6B,sBAAuB,OAAO,CACxF,CCfA,OAAS,uBAA0B,uBAqB5B,SAAS,8BAAmE,CACjF,OAAO,mBAAmB,CAC5B,CCxBA,OAAS,0BAA6B,uBA+B/B,SAAS,sBAAsB,QAAoE,CACxG,OAAO,sBAAsB,CAC3B,UAAW,QAAQ,UACnB,iBAAkB,QAAQ,iBAC1B,iBAAkB,QAAQ,qBAC1B,MAAO,QAAQ,KACjB,CAAC,CACH,CCrCA,OAAS,sBAAyB,uBAe3B,SAAS,6BAAiE,CAC/E,OAAO,kBACL,+BACA,mCACF,CACF",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/scriptsure-react",
3
- "version": "5.1.23",
3
+ "version": "5.1.26",
4
4
  "description": "Medplum ScriptSure React SDK",
5
5
  "keywords": [
6
6
  "medplum",
@@ -58,10 +58,10 @@
58
58
  "test:watch": "vitest watch"
59
59
  },
60
60
  "devDependencies": {
61
- "@medplum/core": "5.1.23",
62
- "@medplum/fhirtypes": "5.1.23",
63
- "@medplum/mock": "5.1.23",
64
- "@medplum/react-hooks": "5.1.23",
61
+ "@medplum/core": "5.1.26",
62
+ "@medplum/fhirtypes": "5.1.26",
63
+ "@medplum/mock": "5.1.26",
64
+ "@medplum/react-hooks": "5.1.26",
65
65
  "@testing-library/jest-dom": "6.9.1",
66
66
  "@testing-library/react": "16.3.2",
67
67
  "@types/react": "19.2.17",
@@ -71,9 +71,9 @@
71
71
  "react-dom": "19.2.7"
72
72
  },
73
73
  "peerDependencies": {
74
- "@medplum/core": "5.1.23",
75
- "@medplum/fhirtypes": "5.1.23",
76
- "@medplum/react-hooks": "5.1.23",
74
+ "@medplum/core": "5.1.26",
75
+ "@medplum/fhirtypes": "5.1.26",
76
+ "@medplum/react-hooks": "5.1.26",
77
77
  "react": "^18.0.0 || ^19.0.0"
78
78
  },
79
79
  "engines": {