@medplum/scriptsure-react 5.1.13 → 5.1.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.
@@ -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_IFRAME_BOT:()=>SCRIPTSURE_IFRAME_BOT,SCRIPTSURE_PATIENT_ID_SYSTEM:()=>SCRIPTSURE_PATIENT_ID_SYSTEM,SCRIPTSURE_PATIENT_SYNC_BOT:()=>SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_SEARCH_PHARMACY_BOT:()=>SCRIPTSURE_SEARCH_PHARMACY_BOT,useScriptSureIFrame:()=>useScriptSureIFrame,useScriptSurePharmacySearch:()=>useScriptSurePharmacySearch});module.exports=__toCommonJS(index_exports);var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",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_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";var import_react_hooks=require("@medplum/react-hooks");function useScriptSureIFrame(options){return(0,import_react_hooks.useEPrescribingIFrame)(SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_IFRAME_BOT,options)}var import_react_hooks2=require("@medplum/react-hooks");function useScriptSurePharmacySearch(){return(0,import_react_hooks2.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_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)}
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/useScriptSureIFrame.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 './useScriptSureIFrame';\nexport * from './useScriptSurePharmacySearch';\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 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\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", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { EPrescribingIFrameOptions } from '@medplum/react-hooks';\nimport { useEPrescribingIFrame } from '@medplum/react-hooks';\nimport { SCRIPTSURE_IFRAME_BOT, SCRIPTSURE_PATIENT_SYNC_BOT } from './common';\n\nexport type ScriptSureIFrameOptions = EPrescribingIFrameOptions;\n\n/**\n * React hook that syncs a patient to ScriptSure and returns the iframe URL.\n *\n * Thin wrapper around the generic {@link useEPrescribingIFrame} 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 useEPrescribingIFrame(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 { 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,oiBCIO,IAAM,mBAAqB,+BAErB,sBAAoC,CAC/C,OAAQ,mBACR,MAAO,uBACT,EAEa,4BAA0C,CACrD,OAAQ,mBACR,MAAO,6BACT,EAEa,+BAA6C,CACxD,OAAQ,mBACR,MAAO,gCACT,EAEa,oCAAkD,CAC7D,OAAQ,mBACR,MAAO,qCACT,EAEa,6BAA+B,oCCvB5C,uBAAsC,gCAc/B,SAAS,oBAAoB,QAAsD,CACxF,SAAO,0CAAsB,4BAA6B,sBAAuB,OAAO,CAC1F,CCfA,IAAAA,oBAAkC,gCAa3B,SAAS,6BAAiE,CAC/E,SAAO,uCAAkB,+BAAgC,mCAAmC,CAC9F",
6
- "names": ["import_react_hooks"]
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",
6
+ "names": ["import_react_hooks", "import_react_hooks", "import_react_hooks"]
7
7
  }
@@ -1,25 +1,103 @@
1
- import type { EPrescribingIFrameOptions } from '@medplum/react-hooks';
2
1
  import type { Identifier } from '@medplum/fhirtypes';
2
+ import type { MedicationIFrameOptions } from '@medplum/react-hooks';
3
+ import type { MedicationOrderExtensions } from '@medplum/core';
4
+ import type { MedplumClient } from '@medplum/core';
5
+ import type { UseMedicationOrderReturn } from '@medplum/react-hooks';
6
+ import type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';
3
7
  import type { UsePharmacySearchReturn } from '@medplum/react-hooks';
4
8
 
9
+ /**
10
+ * Fetches NCI potency-unit codes for dispense quantity qualifiers via the
11
+ * vendor-neutral `$drug-quantity-qualifiers` custom FHIR operation. Each
12
+ * Medplum project picks the vendor implementation at deploy time by pointing
13
+ * its `OperationDefinition` at the appropriate Bot (ScriptSure's
14
+ * `scriptsure-drug-search-bot` today; see `deploy.ts`).
15
+ *
16
+ * @param medplum - Medplum client (user session).
17
+ * @returns `{ code, label }` rows for UI selects.
18
+ */
19
+ export declare function loadScriptSureQuantityQualifiers(medplum: MedplumClient): Promise<{
20
+ code: string;
21
+ label: string;
22
+ }[]>;
23
+
5
24
  export declare const MEDPLUM_BOT_SYSTEM = "https://www.medplum.com/bots";
6
25
 
7
26
  export declare const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier;
8
27
 
28
+ /**
29
+ * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via
30
+ * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).
31
+ * The bot identifier is kept exported for one release to preserve source
32
+ * compatibility for any caller still invoking `medplum.executeBot(...)`
33
+ * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`
34
+ * now register an `OperationDefinition` with code `drug-search` whose
35
+ * `operationDefinition-implementation` extension points at this bot.
36
+ */
37
+ export declare const SCRIPTSURE_DRUG_SEARCH_BOT: Identifier;
38
+
39
+ /** ScriptSure GenericName on a search-result Medication (parent generic when the row is a brand). */
40
+ export declare const SCRIPTSURE_GENERIC_NAME_EXTENSION = "https://scriptsure.com/generic-name";
41
+
9
42
  export declare const SCRIPTSURE_IFRAME_BOT: Identifier;
10
43
 
44
+ export declare const SCRIPTSURE_IFRAME_URL_EXTENSION = "https://scriptsure.com/iframe-url";
45
+
46
+ export declare const SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS: MedicationOrderExtensions;
47
+
48
+ /** ScriptSure MED_NAME_TYPE_CD on a search-result Medication: `'1'` = brand, `'2'` = generic. */
49
+ export declare const SCRIPTSURE_NAME_TYPE_EXTENSION = "https://scriptsure.com/name-type";
50
+
51
+ /**
52
+ * @deprecated Use the vendor-neutral `$order-medication` custom FHIR operation via
53
+ * `useMedicationOrder().orderMedication(...)` (see `@medplum/react-hooks`).
54
+ * The bot identifier is kept exported for one release to preserve source
55
+ * compatibility for any caller still invoking `medplum.executeBot(...)`
56
+ * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`
57
+ * now register an `OperationDefinition` with code `order-medication` whose
58
+ * `operationDefinition-implementation` extension points at this bot.
59
+ */
60
+ export declare const SCRIPTSURE_ORDER_MEDICATION_BOT: Identifier;
61
+
62
+ /**
63
+ * @deprecated Use the vendor-neutral `$order-set-url` custom FHIR operation via
64
+ * `useScriptSureOrderSet(...)` (thin wrapper around `useMedicationOrderSet`).
65
+ * The bot identifier is kept exported for one release to preserve source
66
+ * compatibility for any caller still invoking `medplum.executeBot(...)`
67
+ * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`
68
+ * now register an `OperationDefinition` with code `order-set-url` whose
69
+ * `operationDefinition-implementation` extension points at this bot.
70
+ */
71
+ export declare const SCRIPTSURE_ORDER_SET_BOT: Identifier;
72
+
73
+ /** Identifier system for the ScriptSure orderset id stamped on FHIR PlanDefinitions. */
74
+ export declare const SCRIPTSURE_ORDERSET_ID_SYSTEM = "https://spa.scriptsure.com/orderset-id";
75
+
11
76
  export declare const SCRIPTSURE_PATIENT_ID_SYSTEM = "https://scriptsure.com/patient-id";
12
77
 
13
78
  export declare const SCRIPTSURE_PATIENT_SYNC_BOT: Identifier;
14
79
 
80
+ export declare const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = "https://scriptsure.com/pending-order-id";
81
+
82
+ export declare const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = "https://scriptsure.com/pending-order-status";
83
+
84
+ /** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */
85
+ export declare const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = "https://scriptsure.com/routed-med-id";
86
+
15
87
  export declare const SCRIPTSURE_SEARCH_PHARMACY_BOT: Identifier;
16
88
 
17
- export declare type ScriptSureIFrameOptions = EPrescribingIFrameOptions;
89
+ /** Pre-built dosing option on a Medication from drug-format lookup (`routedMedId` search). */
90
+ export declare const SCRIPTSURE_SIG_EXTENSION = "https://scriptsure.com/sig";
91
+
92
+ /** Base URL for ScriptSure-specific extensions on in-memory Medication resources (e.g. `/sig`). */
93
+ export declare const SCRIPTSURE_SYSTEM = "https://scriptsure.com";
94
+
95
+ export declare type ScriptSureIFrameOptions = MedicationIFrameOptions;
18
96
 
19
97
  /**
20
98
  * React hook that syncs a patient to ScriptSure and returns the iframe URL.
21
99
  *
22
- * Thin wrapper around the generic {@link useEPrescribingIFrame} hook,
100
+ * Thin wrapper around the generic {@link useMedicationIFrame} hook,
23
101
  * pre-configured with ScriptSure bot identifiers.
24
102
  *
25
103
  * @param options - Configuration and callback options.
@@ -27,6 +105,58 @@ export declare type ScriptSureIFrameOptions = EPrescribingIFrameOptions;
27
105
  */
28
106
  export declare function useScriptSureIFrame(options: ScriptSureIFrameOptions): string | undefined;
29
107
 
108
+ /**
109
+ * React hook for ScriptSure drug search and pending order creation (iframe launch URL).
110
+ *
111
+ * Now a near-empty re-export of `useMedicationOrder` from `@medplum/react-hooks`: the
112
+ * vendor binding lives entirely on the server, where each Medplum project's
113
+ * `OperationDefinition` resources for `$drug-search` and `$order-medication`
114
+ * point at the ScriptSure bots via the
115
+ * `operationDefinition-implementation` extension. See the deploy script in
116
+ * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts` for how those
117
+ * resources are upserted.
118
+ *
119
+ * Kept as a typed alias for backwards source-compatibility with apps importing
120
+ * `useScriptSureOrderMedication` and as a documentation anchor for the
121
+ * ScriptSure-specific behavior (e.g. patient-must-be-synced precondition).
122
+ *
123
+ * @returns The same API as `useMedicationOrder` (search + order callbacks).
124
+ */
125
+ export declare function useScriptSureOrderMedication(): UseScriptSureOrderMedicationReturn;
126
+
127
+ export declare type UseScriptSureOrderMedicationReturn = UseMedicationOrderReturn;
128
+
129
+ /**
130
+ * React hook that returns the ScriptSure order-set prescribing widget URL via
131
+ * the vendor-neutral `$order-set-url` FHIR custom operation
132
+ * (`POST /fhir/R4/PlanDefinition/$order-set-url`).
133
+ *
134
+ * Thin wrapper around {@link useMedicationOrderSet}: forwards
135
+ * `scriptSureOrdersetId` as the operation's `vendorOrderSetId` parameter,
136
+ * leaves vendor binding to the deployed `OperationDefinition` →
137
+ * `Bot/scriptsure-order-set-bot` link.
138
+ *
139
+ * The operation is naturally idempotent — re-calls only refresh the session
140
+ * token in the returned URL — so callers can safely wire `refresh` into
141
+ * `PrescriptionIFrameModal.onRefreshLaunchUrl`.
142
+ *
143
+ * @param options - Patient + order-set picker (PD or ScriptSure id).
144
+ * @returns `{ url, loading, error, refresh }`.
145
+ */
146
+ export declare function useScriptSureOrderSet(options: UseScriptSureOrderSetOptions): UseScriptSureOrderSetReturn;
147
+
148
+ export declare interface UseScriptSureOrderSetOptions {
149
+ /** Patient to prescribe against. Hook stays idle (no operation call) until set. */
150
+ readonly patientId: string | undefined;
151
+ /** Medplum PlanDefinition id; bot reverse-looks up the ScriptSure orderset id. */
152
+ readonly planDefinitionId?: string;
153
+ /** ScriptSure orderset id (escape hatch when no synced PD exists yet). */
154
+ readonly scriptSureOrdersetId?: number;
155
+ readonly appId?: string;
156
+ }
157
+
158
+ export declare type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;
159
+
30
160
  /**
31
161
  * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.
32
162
  *
@@ -1,25 +1,103 @@
1
- import type { EPrescribingIFrameOptions } from '@medplum/react-hooks';
2
1
  import type { Identifier } from '@medplum/fhirtypes';
2
+ import type { MedicationIFrameOptions } from '@medplum/react-hooks';
3
+ import type { MedicationOrderExtensions } from '@medplum/core';
4
+ import type { MedplumClient } from '@medplum/core';
5
+ import type { UseMedicationOrderReturn } from '@medplum/react-hooks';
6
+ import type { UseMedicationOrderSetReturn } from '@medplum/react-hooks';
3
7
  import type { UsePharmacySearchReturn } from '@medplum/react-hooks';
4
8
 
9
+ /**
10
+ * Fetches NCI potency-unit codes for dispense quantity qualifiers via the
11
+ * vendor-neutral `$drug-quantity-qualifiers` custom FHIR operation. Each
12
+ * Medplum project picks the vendor implementation at deploy time by pointing
13
+ * its `OperationDefinition` at the appropriate Bot (ScriptSure's
14
+ * `scriptsure-drug-search-bot` today; see `deploy.ts`).
15
+ *
16
+ * @param medplum - Medplum client (user session).
17
+ * @returns `{ code, label }` rows for UI selects.
18
+ */
19
+ export declare function loadScriptSureQuantityQualifiers(medplum: MedplumClient): Promise<{
20
+ code: string;
21
+ label: string;
22
+ }[]>;
23
+
5
24
  export declare const MEDPLUM_BOT_SYSTEM = "https://www.medplum.com/bots";
6
25
 
7
26
  export declare const SCRIPTSURE_ADD_PATIENT_PHARMACY_BOT: Identifier;
8
27
 
28
+ /**
29
+ * @deprecated Use the vendor-neutral `$drug-search` custom FHIR operation via
30
+ * `useMedicationOrder().searchMedications(...)` (see `@medplum/react-hooks`).
31
+ * The bot identifier is kept exported for one release to preserve source
32
+ * compatibility for any caller still invoking `medplum.executeBot(...)`
33
+ * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`
34
+ * now register an `OperationDefinition` with code `drug-search` whose
35
+ * `operationDefinition-implementation` extension points at this bot.
36
+ */
37
+ export declare const SCRIPTSURE_DRUG_SEARCH_BOT: Identifier;
38
+
39
+ /** ScriptSure GenericName on a search-result Medication (parent generic when the row is a brand). */
40
+ export declare const SCRIPTSURE_GENERIC_NAME_EXTENSION = "https://scriptsure.com/generic-name";
41
+
9
42
  export declare const SCRIPTSURE_IFRAME_BOT: Identifier;
10
43
 
44
+ export declare const SCRIPTSURE_IFRAME_URL_EXTENSION = "https://scriptsure.com/iframe-url";
45
+
46
+ export declare const SCRIPTSURE_MEDICATION_ORDER_EXTENSIONS: MedicationOrderExtensions;
47
+
48
+ /** ScriptSure MED_NAME_TYPE_CD on a search-result Medication: `'1'` = brand, `'2'` = generic. */
49
+ export declare const SCRIPTSURE_NAME_TYPE_EXTENSION = "https://scriptsure.com/name-type";
50
+
51
+ /**
52
+ * @deprecated Use the vendor-neutral `$order-medication` custom FHIR operation via
53
+ * `useMedicationOrder().orderMedication(...)` (see `@medplum/react-hooks`).
54
+ * The bot identifier is kept exported for one release to preserve source
55
+ * compatibility for any caller still invoking `medplum.executeBot(...)`
56
+ * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`
57
+ * now register an `OperationDefinition` with code `order-medication` whose
58
+ * `operationDefinition-implementation` extension points at this bot.
59
+ */
60
+ export declare const SCRIPTSURE_ORDER_MEDICATION_BOT: Identifier;
61
+
62
+ /**
63
+ * @deprecated Use the vendor-neutral `$order-set-url` custom FHIR operation via
64
+ * `useScriptSureOrderSet(...)` (thin wrapper around `useMedicationOrderSet`).
65
+ * The bot identifier is kept exported for one release to preserve source
66
+ * compatibility for any caller still invoking `medplum.executeBot(...)`
67
+ * directly. Project deploys via `medplum-ee/packages/scriptsure/src/scripts/deploy.ts`
68
+ * now register an `OperationDefinition` with code `order-set-url` whose
69
+ * `operationDefinition-implementation` extension points at this bot.
70
+ */
71
+ export declare const SCRIPTSURE_ORDER_SET_BOT: Identifier;
72
+
73
+ /** Identifier system for the ScriptSure orderset id stamped on FHIR PlanDefinitions. */
74
+ export declare const SCRIPTSURE_ORDERSET_ID_SYSTEM = "https://spa.scriptsure.com/orderset-id";
75
+
11
76
  export declare const SCRIPTSURE_PATIENT_ID_SYSTEM = "https://scriptsure.com/patient-id";
12
77
 
13
78
  export declare const SCRIPTSURE_PATIENT_SYNC_BOT: Identifier;
14
79
 
80
+ export declare const SCRIPTSURE_PENDING_ORDER_ID_SYSTEM = "https://scriptsure.com/pending-order-id";
81
+
82
+ export declare const SCRIPTSURE_PENDING_ORDER_STATUS_EXTENSION = "https://scriptsure.com/pending-order-status";
83
+
84
+ /** Identifier system for ScriptSure ROUTED_MED_ID on in-memory Medication resources from drug search. */
85
+ export declare const SCRIPTSURE_ROUTED_MED_ID_SYSTEM = "https://scriptsure.com/routed-med-id";
86
+
15
87
  export declare const SCRIPTSURE_SEARCH_PHARMACY_BOT: Identifier;
16
88
 
17
- export declare type ScriptSureIFrameOptions = EPrescribingIFrameOptions;
89
+ /** Pre-built dosing option on a Medication from drug-format lookup (`routedMedId` search). */
90
+ export declare const SCRIPTSURE_SIG_EXTENSION = "https://scriptsure.com/sig";
91
+
92
+ /** Base URL for ScriptSure-specific extensions on in-memory Medication resources (e.g. `/sig`). */
93
+ export declare const SCRIPTSURE_SYSTEM = "https://scriptsure.com";
94
+
95
+ export declare type ScriptSureIFrameOptions = MedicationIFrameOptions;
18
96
 
19
97
  /**
20
98
  * React hook that syncs a patient to ScriptSure and returns the iframe URL.
21
99
  *
22
- * Thin wrapper around the generic {@link useEPrescribingIFrame} hook,
100
+ * Thin wrapper around the generic {@link useMedicationIFrame} hook,
23
101
  * pre-configured with ScriptSure bot identifiers.
24
102
  *
25
103
  * @param options - Configuration and callback options.
@@ -27,6 +105,58 @@ export declare type ScriptSureIFrameOptions = EPrescribingIFrameOptions;
27
105
  */
28
106
  export declare function useScriptSureIFrame(options: ScriptSureIFrameOptions): string | undefined;
29
107
 
108
+ /**
109
+ * React hook for ScriptSure drug search and pending order creation (iframe launch URL).
110
+ *
111
+ * Now a near-empty re-export of `useMedicationOrder` from `@medplum/react-hooks`: the
112
+ * vendor binding lives entirely on the server, where each Medplum project's
113
+ * `OperationDefinition` resources for `$drug-search` and `$order-medication`
114
+ * point at the ScriptSure bots via the
115
+ * `operationDefinition-implementation` extension. See the deploy script in
116
+ * `medplum-ee/packages/scriptsure/src/scripts/deploy.ts` for how those
117
+ * resources are upserted.
118
+ *
119
+ * Kept as a typed alias for backwards source-compatibility with apps importing
120
+ * `useScriptSureOrderMedication` and as a documentation anchor for the
121
+ * ScriptSure-specific behavior (e.g. patient-must-be-synced precondition).
122
+ *
123
+ * @returns The same API as `useMedicationOrder` (search + order callbacks).
124
+ */
125
+ export declare function useScriptSureOrderMedication(): UseScriptSureOrderMedicationReturn;
126
+
127
+ export declare type UseScriptSureOrderMedicationReturn = UseMedicationOrderReturn;
128
+
129
+ /**
130
+ * React hook that returns the ScriptSure order-set prescribing widget URL via
131
+ * the vendor-neutral `$order-set-url` FHIR custom operation
132
+ * (`POST /fhir/R4/PlanDefinition/$order-set-url`).
133
+ *
134
+ * Thin wrapper around {@link useMedicationOrderSet}: forwards
135
+ * `scriptSureOrdersetId` as the operation's `vendorOrderSetId` parameter,
136
+ * leaves vendor binding to the deployed `OperationDefinition` →
137
+ * `Bot/scriptsure-order-set-bot` link.
138
+ *
139
+ * The operation is naturally idempotent — re-calls only refresh the session
140
+ * token in the returned URL — so callers can safely wire `refresh` into
141
+ * `PrescriptionIFrameModal.onRefreshLaunchUrl`.
142
+ *
143
+ * @param options - Patient + order-set picker (PD or ScriptSure id).
144
+ * @returns `{ url, loading, error, refresh }`.
145
+ */
146
+ export declare function useScriptSureOrderSet(options: UseScriptSureOrderSetOptions): UseScriptSureOrderSetReturn;
147
+
148
+ export declare interface UseScriptSureOrderSetOptions {
149
+ /** Patient to prescribe against. Hook stays idle (no operation call) until set. */
150
+ readonly patientId: string | undefined;
151
+ /** Medplum PlanDefinition id; bot reverse-looks up the ScriptSure orderset id. */
152
+ readonly planDefinitionId?: string;
153
+ /** ScriptSure orderset id (escape hatch when no synced PD exists yet). */
154
+ readonly scriptSureOrdersetId?: number;
155
+ readonly appId?: string;
156
+ }
157
+
158
+ export declare type UseScriptSureOrderSetReturn = UseMedicationOrderSetReturn;
159
+
30
160
  /**
31
161
  * React hook that provides ScriptSure-specific pharmacy search and add-to-favorites functionality.
32
162
  *
@@ -1,2 +1,2 @@
1
- var MEDPLUM_BOT_SYSTEM="https://www.medplum.com/bots",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_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";import{useEPrescribingIFrame}from"@medplum/react-hooks";function useScriptSureIFrame(options){return useEPrescribingIFrame(SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_IFRAME_BOT,options)}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_IFRAME_BOT,SCRIPTSURE_PATIENT_ID_SYSTEM,SCRIPTSURE_PATIENT_SYNC_BOT,SCRIPTSURE_SEARCH_PHARMACY_BOT,useScriptSureIFrame,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):[]}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};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/common.ts", "../../src/useScriptSureIFrame.ts", "../../src/useScriptSurePharmacySearch.ts"],
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 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\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", "// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors\n// SPDX-License-Identifier: Apache-2.0\nimport type { EPrescribingIFrameOptions } from '@medplum/react-hooks';\nimport { useEPrescribingIFrame } from '@medplum/react-hooks';\nimport { SCRIPTSURE_IFRAME_BOT, SCRIPTSURE_PATIENT_SYNC_BOT } from './common';\n\nexport type ScriptSureIFrameOptions = EPrescribingIFrameOptions;\n\n/**\n * React hook that syncs a patient to ScriptSure and returns the iframe URL.\n *\n * Thin wrapper around the generic {@link useEPrescribingIFrame} 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 useEPrescribingIFrame(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 { 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": "AAIO,IAAM,mBAAqB,+BAErB,sBAAoC,CAC/C,OAAQ,mBACR,MAAO,uBACT,EAEa,4BAA0C,CACrD,OAAQ,mBACR,MAAO,6BACT,EAEa,+BAA6C,CACxD,OAAQ,mBACR,MAAO,gCACT,EAEa,oCAAkD,CAC7D,OAAQ,mBACR,MAAO,qCACT,EAEa,6BAA+B,oCCvB5C,OAAS,0BAA6B,uBAc/B,SAAS,oBAAoB,QAAsD,CACxF,OAAO,sBAAsB,4BAA6B,sBAAuB,OAAO,CAC1F,CCfA,OAAS,sBAAyB,uBAa3B,SAAS,6BAAiE,CAC/E,OAAO,kBAAkB,+BAAgC,mCAAmC,CAC9F",
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",
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.13",
3
+ "version": "5.1.15",
4
4
  "description": "Medplum ScriptSure React SDK",
5
5
  "keywords": [
6
6
  "medplum",
@@ -58,25 +58,25 @@
58
58
  "test:watch": "vitest watch"
59
59
  },
60
60
  "devDependencies": {
61
- "@medplum/core": "5.1.13",
62
- "@medplum/fhirtypes": "5.1.13",
63
- "@medplum/mock": "5.1.13",
64
- "@medplum/react-hooks": "5.1.13",
61
+ "@medplum/core": "5.1.15",
62
+ "@medplum/fhirtypes": "5.1.15",
63
+ "@medplum/mock": "5.1.15",
64
+ "@medplum/react-hooks": "5.1.15",
65
65
  "@testing-library/jest-dom": "6.9.1",
66
66
  "@testing-library/react": "16.3.2",
67
67
  "@types/node": "22.19.19",
68
- "@types/react": "19.2.14",
68
+ "@types/react": "19.2.15",
69
69
  "@types/react-dom": "19.2.3",
70
70
  "@vitejs/plugin-react": "6.0.2",
71
71
  "jsdom": "29.1.1",
72
72
  "react": "19.2.6",
73
73
  "react-dom": "19.2.6",
74
- "vitest": "4.1.6"
74
+ "vitest": "4.1.7"
75
75
  },
76
76
  "peerDependencies": {
77
- "@medplum/core": "5.1.13",
78
- "@medplum/fhirtypes": "5.1.13",
79
- "@medplum/react-hooks": "5.1.13",
77
+ "@medplum/core": "5.1.15",
78
+ "@medplum/fhirtypes": "5.1.15",
79
+ "@medplum/react-hooks": "5.1.15",
80
80
  "react": "^18.0.0 || ^19.0.0"
81
81
  },
82
82
  "engines": {