vintasend 0.4.0 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/examples/vintasend-medplum-example/.env.example +11 -0
- package/dist/examples/vintasend-medplum-example/IMPLEMENTATION_PLAN_FILE_ATTACHMENTS.md +597 -0
- package/dist/examples/vintasend-medplum-example/README.md +190 -0
- package/dist/examples/vintasend-medplum-example/TUTORIAL_EMAIL_NOTIFICATIONS.md +2596 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-pending-notifications-bot.ts +39 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-task-assignment-email.ts +41 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/task-due-soon-notification-bot.ts +86 -0
- package/dist/examples/vintasend-medplum-example/bots/index.ts +53 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/schedule-task-due-soon-email.ts +84 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.test.ts +388 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.ts +113 -0
- package/dist/examples/vintasend-medplum-example/bots/shared/task-due-soon-helpers.ts +115 -0
- package/dist/examples/vintasend-medplum-example/bots/task-assignment-bot.ts +41 -0
- package/dist/examples/vintasend-medplum-example/compiled-notification-templates.json +6 -0
- package/dist/examples/vintasend-medplum-example/esbuild-script.mjs +71 -0
- package/dist/examples/vintasend-medplum-example/index.html +14 -0
- package/dist/examples/vintasend-medplum-example/lib/constants.ts +32 -0
- package/dist/examples/vintasend-medplum-example/lib/extensions.ts +1 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.test.ts +389 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.ts +222 -0
- package/dist/examples/vintasend-medplum-example/lib/medplum-singleton.ts +18 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.test.ts +293 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.ts +284 -0
- package/dist/examples/vintasend-medplum-example/lib/patients.ts +20 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/body.html.pug +37 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/body.html.pug +34 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/package.json +75 -0
- package/dist/examples/vintasend-medplum-example/plugins/gql-plugin.mjs +31 -0
- package/dist/examples/vintasend-medplum-example/postcss.config.mjs +21 -0
- package/dist/examples/vintasend-medplum-example/public/favicon.ico +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/acuity.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/auth0.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/azure.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/calcom.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/candid.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/claude.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/datadog.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/deepseek.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/entra.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/epic.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/google.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthgorilla.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthie.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/labcorp.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/okta.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/openai.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/particle.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/quest.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/recaptcha.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/snowflake.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stedi.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stripe.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/sumo.png +0 -0
- package/dist/examples/vintasend-medplum-example/scripts/README.md +162 -0
- package/dist/examples/vintasend-medplum-example/scripts/client.ts +18 -0
- package/dist/examples/vintasend-medplum-example/scripts/deploy-bots.ts +171 -0
- package/dist/examples/vintasend-medplum-example/src/App.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.test.tsx +350 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.test.tsx +616 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.tsx +138 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.test.tsx +92 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.test.tsx +464 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.tsx +186 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.test.tsx +80 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.module.css +3 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.tsx +62 -0
- package/dist/examples/vintasend-medplum-example/src/components/MessageWithLinks.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.test.tsx +299 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.tsx +52 -0
- package/dist/examples/vintasend-medplum-example/src/components/ResourceFormWithRequiredProfile.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.test.tsx +1016 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.tsx +298 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.test.tsx +732 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.tsx +282 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.test.tsx +268 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.tsx +212 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.test.tsx +120 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.test.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.test.tsx +431 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.tsx +130 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.module.css +31 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.tsx +143 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.module.css +11 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.test.tsx +875 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.tsx +943 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.test.tsx +413 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabSelectEmpty.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/README.md +104 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.test.tsx +318 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.test.tsx +126 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.tsx +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.test.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.tsx +165 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.test.tsx +523 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.tsx +230 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.test.tsx +567 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.tsx +358 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.module.css +40 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.tsx +257 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.test.tsx +279 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.test.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.module.css +26 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.test.tsx +305 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.module.css +262 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.test.tsx +622 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.tsx +286 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/NewTaskModal.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskAttachmentList.tsx +132 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.test.tsx +749 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.test.tsx +278 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFileUpload.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.test.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.tsx +142 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.utils.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.test.tsx +134 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.tsx +250 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.test.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.test.tsx +68 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.test.tsx +555 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.test.tsx +32 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.tsx +34 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.test.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.tsx +29 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.test.tsx +285 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.test.tsx +455 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.test.tsx +435 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.tsx +116 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.module.css +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.test.tsx +200 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.test.ts +176 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.ts +17 -0
- package/dist/examples/vintasend-medplum-example/src/config/constants.ts +3 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.test.tsx +166 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.ts +11 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.test.tsx +477 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.ts +191 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.ts +18 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.test.tsx +379 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.ts +194 -0
- package/dist/examples/vintasend-medplum-example/src/index.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/main.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.test.tsx +295 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.tsx +124 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.test.tsx +77 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.test.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.tsx +27 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.test.tsx +287 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.tsx +151 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.test.tsx +519 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.tsx +179 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/FavoriteMedicationsTable.tsx +76 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.tsx +222 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.test.tsx +356 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.test.tsx +103 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.tsx +78 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.test.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.test.tsx +364 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.test.tsx +159 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.test.tsx +140 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.tsx +72 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.test.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.test.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.tsx +710 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.module.css +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.test.tsx +428 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.tsx +334 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.module.css +24 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.test.tsx +154 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.test.ts +223 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.ts +89 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.test.tsx +147 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.tsx +79 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientTabsNavigation.tsx +35 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.test.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TimelineTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.test.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.tsx +117 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceDetailPage.tsx +28 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.test.tsx +131 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.tsx +65 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.test.tsx +108 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.tsx +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.test.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/useResourceType.ts +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/utils.ts +9 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.test.tsx +302 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/ChatInput.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.test.tsx +102 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.test.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/test-utils/render.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/test.setup.ts +49 -0
- package/dist/examples/vintasend-medplum-example/src/types/encounter.ts +8 -0
- package/dist/examples/vintasend-medplum-example/src/types/spaces.ts +10 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.test.ts +141 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.ts +59 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.test.ts +153 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.ts +65 -0
- package/dist/examples/vintasend-medplum-example/src/utils/communication-search.ts +47 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.test.ts +48 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.ts +33 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.test.ts +102 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.ts +55 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.test.ts +169 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.ts +261 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.test.ts +154 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.ts +272 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.test.ts +1137 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.ts +827 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.test.ts +27 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.ts +15 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spaceMessaging.ts +249 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.test.ts +450 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.ts +147 -0
- package/dist/examples/vintasend-medplum-example/src/utils/task-search.ts +63 -0
- package/dist/examples/vintasend-medplum-example/src/vite-env.d.ts +3 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.bots.json +4 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.json +19 -0
- package/dist/examples/vintasend-medplum-example/vercel.json +3 -0
- package/dist/examples/vintasend-medplum-example/vite.config.ts +44 -0
- package/dist/services/notification-backends/base-notification-backend.d.ts +5 -0
- package/dist/services/notification-service.js +11 -1
- package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
6
|
+
import { MedplumProvider } from '@medplum/react';
|
|
7
|
+
import type { Encounter, Organization, Patient, Practitioner, Task } from '@medplum/fhirtypes';
|
|
8
|
+
import { MockClient } from '@medplum/mock';
|
|
9
|
+
import { describe, expect, test, vi, beforeEach } from 'vitest';
|
|
10
|
+
import { TaskProperties } from './TaskProperties';
|
|
11
|
+
|
|
12
|
+
describe('TaskProperties', () => {
|
|
13
|
+
let medplum: MockClient;
|
|
14
|
+
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
medplum = new MockClient();
|
|
17
|
+
vi.clearAllMocks();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const setup = (
|
|
21
|
+
task: Task,
|
|
22
|
+
props: Partial<React.ComponentProps<typeof TaskProperties>> = {}
|
|
23
|
+
): ReturnType<typeof render> => {
|
|
24
|
+
return render(
|
|
25
|
+
<MedplumProvider medplum={medplum}>
|
|
26
|
+
<MantineProvider>
|
|
27
|
+
<TaskProperties task={task} onTaskChange={vi.fn()} {...props} />
|
|
28
|
+
</MantineProvider>
|
|
29
|
+
</MedplumProvider>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const mockTask: Task = {
|
|
34
|
+
resourceType: 'Task',
|
|
35
|
+
id: 'task-123',
|
|
36
|
+
status: 'in-progress',
|
|
37
|
+
intent: 'order',
|
|
38
|
+
code: { text: 'Test Task' },
|
|
39
|
+
priority: 'routine',
|
|
40
|
+
for: { reference: 'Patient/patient-123', display: 'Test Patient' },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
test('renders all task property fields', async () => {
|
|
44
|
+
setup(mockTask);
|
|
45
|
+
|
|
46
|
+
await waitFor(() => {
|
|
47
|
+
expect(screen.getByText('Status')).toBeInTheDocument();
|
|
48
|
+
expect(screen.getByText('Due Date')).toBeInTheDocument();
|
|
49
|
+
expect(screen.getByText('Assignee')).toBeInTheDocument();
|
|
50
|
+
expect(screen.getByText('Priority')).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByText('Based On')).toBeInTheDocument();
|
|
52
|
+
expect(screen.getByText('Patient')).toBeInTheDocument();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('renders due date field', async () => {
|
|
57
|
+
setup(mockTask);
|
|
58
|
+
|
|
59
|
+
await waitFor(() => {
|
|
60
|
+
expect(screen.getByLabelText('Due Date')).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('renders due date field with value when restriction period is set', async () => {
|
|
65
|
+
const dueDate = new Date('2024-12-31T00:00:00');
|
|
66
|
+
|
|
67
|
+
const taskWithDueDate: Task = {
|
|
68
|
+
...mockTask,
|
|
69
|
+
restriction: {
|
|
70
|
+
period: {
|
|
71
|
+
end: dueDate.toISOString(),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
setup(taskWithDueDate);
|
|
77
|
+
|
|
78
|
+
await waitFor(() => {
|
|
79
|
+
const dueDateInput = screen.getByLabelText('Due Date');
|
|
80
|
+
expect(dueDateInput).toBeInTheDocument();
|
|
81
|
+
expect(dueDateInput).toHaveValue('2024-12-31T00:00');
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('renders priority field with current priority value', async () => {
|
|
86
|
+
setup(mockTask);
|
|
87
|
+
|
|
88
|
+
await waitFor(() => {
|
|
89
|
+
expect(screen.getByText('routine')).toBeInTheDocument();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('shows ReferenceInput for basedOn when not present', async () => {
|
|
94
|
+
setup(mockTask);
|
|
95
|
+
|
|
96
|
+
await waitFor(() => {
|
|
97
|
+
expect(screen.getByText('Based On')).toBeInTheDocument();
|
|
98
|
+
expect(screen.getByPlaceholderText('Select any resource...')).toBeInTheDocument();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('displays encounter when present', async () => {
|
|
103
|
+
const encounter: Encounter = {
|
|
104
|
+
resourceType: 'Encounter',
|
|
105
|
+
id: 'encounter-123',
|
|
106
|
+
status: 'finished',
|
|
107
|
+
class: { code: 'AMB', system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode' },
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
await medplum.createResource(encounter);
|
|
111
|
+
|
|
112
|
+
const taskWithEncounter: Task = {
|
|
113
|
+
...mockTask,
|
|
114
|
+
encounter: { reference: 'Encounter/encounter-123' },
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
setup(taskWithEncounter);
|
|
118
|
+
|
|
119
|
+
await waitFor(() => {
|
|
120
|
+
expect(screen.getByText('Encounter')).toBeInTheDocument();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('does not display encounter when not present', async () => {
|
|
125
|
+
setup(mockTask);
|
|
126
|
+
|
|
127
|
+
await waitFor(() => {
|
|
128
|
+
expect(screen.getByText('Patient')).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
expect(screen.queryByText('Encounter')).not.toBeInTheDocument();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('updates task when initialTask changes', async () => {
|
|
135
|
+
const { rerender } = setup(mockTask);
|
|
136
|
+
|
|
137
|
+
await waitFor(() => {
|
|
138
|
+
expect(screen.getByText('in-progress')).toBeInTheDocument();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const updatedTask: Task = {
|
|
142
|
+
...mockTask,
|
|
143
|
+
status: 'completed',
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
rerender(
|
|
147
|
+
<MedplumProvider medplum={medplum}>
|
|
148
|
+
<MantineProvider>
|
|
149
|
+
<TaskProperties task={updatedTask} onTaskChange={vi.fn()} />
|
|
150
|
+
</MantineProvider>
|
|
151
|
+
</MedplumProvider>
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
await waitFor(() => {
|
|
155
|
+
expect(screen.getByText('completed')).toBeInTheDocument();
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('handles task with owner reference and displays owner', async () => {
|
|
160
|
+
const practitioner: Practitioner = {
|
|
161
|
+
resourceType: 'Practitioner',
|
|
162
|
+
id: 'prac-123',
|
|
163
|
+
name: [{ given: ['John'], family: 'Doe' }],
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
await medplum.createResource(practitioner);
|
|
167
|
+
|
|
168
|
+
const taskWithOwner: Task = {
|
|
169
|
+
...mockTask,
|
|
170
|
+
owner: { reference: 'Practitioner/prac-123', display: 'John Doe' },
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
setup(taskWithOwner);
|
|
174
|
+
|
|
175
|
+
await waitFor(() => {
|
|
176
|
+
expect(screen.getByText('John Doe')).toBeInTheDocument();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('handles task with organization owner and displays organization', async () => {
|
|
181
|
+
const organization: Organization = {
|
|
182
|
+
resourceType: 'Organization',
|
|
183
|
+
id: 'org-123',
|
|
184
|
+
name: 'Test Organization',
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
await medplum.createResource(organization);
|
|
188
|
+
|
|
189
|
+
const taskWithOrgOwner: Task = {
|
|
190
|
+
...mockTask,
|
|
191
|
+
owner: { reference: 'Organization/org-123', display: 'Test Organization' },
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
setup(taskWithOrgOwner);
|
|
195
|
+
|
|
196
|
+
await waitFor(() => {
|
|
197
|
+
expect(screen.getByText('Test Organization')).toBeInTheDocument();
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test('displays encounter reference when encounter is present', async () => {
|
|
202
|
+
const encounter: Encounter = {
|
|
203
|
+
resourceType: 'Encounter',
|
|
204
|
+
id: 'encounter-123',
|
|
205
|
+
status: 'finished',
|
|
206
|
+
class: { code: 'AMB', system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode' },
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
await medplum.createResource(encounter);
|
|
210
|
+
|
|
211
|
+
const taskWithEncounter: Task = {
|
|
212
|
+
...mockTask,
|
|
213
|
+
encounter: { reference: 'Encounter/encounter-123' },
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
setup(taskWithEncounter);
|
|
217
|
+
|
|
218
|
+
await waitFor(() => {
|
|
219
|
+
expect(screen.getByText('Encounter')).toBeInTheDocument();
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
test('calls onTaskChange when patient is changed', async () => {
|
|
224
|
+
const onTaskChange = vi.fn();
|
|
225
|
+
|
|
226
|
+
const mockPatient1: Patient = {
|
|
227
|
+
resourceType: 'Patient',
|
|
228
|
+
id: 'patient-1',
|
|
229
|
+
name: [{ given: ['John'], family: 'Doe' }],
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const mockPatient2: Patient = {
|
|
233
|
+
resourceType: 'Patient',
|
|
234
|
+
id: 'patient-2',
|
|
235
|
+
name: [{ given: ['Jane'], family: 'Smith' }],
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
await medplum.createResource(mockPatient1);
|
|
239
|
+
await medplum.createResource(mockPatient2);
|
|
240
|
+
|
|
241
|
+
vi.spyOn(medplum, 'searchResources').mockResolvedValue([mockPatient1, mockPatient2] as any);
|
|
242
|
+
|
|
243
|
+
const taskWithoutPatient: Task = {
|
|
244
|
+
...mockTask,
|
|
245
|
+
for: undefined,
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
setup(taskWithoutPatient, { onTaskChange });
|
|
249
|
+
|
|
250
|
+
await waitFor(() => {
|
|
251
|
+
expect(screen.getByText('Patient')).toBeInTheDocument();
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
const patientInput = screen.queryByPlaceholderText('Search for patient') as HTMLInputElement;
|
|
255
|
+
expect(patientInput).toBeDefined();
|
|
256
|
+
|
|
257
|
+
await act(async () => {
|
|
258
|
+
fireEvent.change(patientInput, { target: { value: 'Smith' } });
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
await waitFor(
|
|
262
|
+
() => {
|
|
263
|
+
expect(medplum.searchResources).toHaveBeenCalledWith(
|
|
264
|
+
'Patient',
|
|
265
|
+
expect.any(URLSearchParams),
|
|
266
|
+
expect.any(Object)
|
|
267
|
+
);
|
|
268
|
+
},
|
|
269
|
+
{ timeout: 3000 }
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
await waitFor(
|
|
273
|
+
() => {
|
|
274
|
+
const smithOption = screen.queryByText(/Smith/i);
|
|
275
|
+
expect(smithOption).toBeInTheDocument();
|
|
276
|
+
},
|
|
277
|
+
{ timeout: 3000 }
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
await act(async () => {
|
|
281
|
+
const smithOption = screen.getByText(/Smith/i);
|
|
282
|
+
fireEvent.click(smithOption);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
await waitFor(
|
|
286
|
+
() => {
|
|
287
|
+
expect(onTaskChange).toHaveBeenCalled();
|
|
288
|
+
const call = onTaskChange.mock.calls[onTaskChange.mock.calls.length - 1];
|
|
289
|
+
const updatedTask = call[0] as Task;
|
|
290
|
+
expect(updatedTask.for?.reference).toBe('Patient/patient-2');
|
|
291
|
+
},
|
|
292
|
+
{ timeout: 5000 }
|
|
293
|
+
);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test('calls onTaskChange when patient is changed from existing patient', async () => {
|
|
297
|
+
const onTaskChange = vi.fn();
|
|
298
|
+
|
|
299
|
+
const mockPatient1: Patient = {
|
|
300
|
+
resourceType: 'Patient',
|
|
301
|
+
id: 'patient-1',
|
|
302
|
+
name: [{ given: ['John'], family: 'Doe' }],
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const mockPatient2: Patient = {
|
|
306
|
+
resourceType: 'Patient',
|
|
307
|
+
id: 'patient-2',
|
|
308
|
+
name: [{ given: ['Jane'], family: 'Smith' }],
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
await medplum.createResource(mockPatient1);
|
|
312
|
+
await medplum.createResource(mockPatient2);
|
|
313
|
+
|
|
314
|
+
vi.spyOn(medplum, 'searchResources').mockResolvedValue([mockPatient1, mockPatient2] as any);
|
|
315
|
+
vi.spyOn(medplum, 'readReference').mockResolvedValue(mockPatient1 as any);
|
|
316
|
+
|
|
317
|
+
const taskWithPatient: Task = {
|
|
318
|
+
...mockTask,
|
|
319
|
+
for: { reference: 'Patient/patient-1' },
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
setup(taskWithPatient, { onTaskChange });
|
|
323
|
+
|
|
324
|
+
await waitFor(() => {
|
|
325
|
+
expect(screen.getByText('Patient')).toBeInTheDocument();
|
|
326
|
+
expect(screen.getByText(/John Doe/i)).toBeInTheDocument();
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
const patientText = screen.getByText(/John Doe/i);
|
|
330
|
+
const patientContainer = patientText.closest('[data-testid]') || patientText.closest('div');
|
|
331
|
+
const clickableElement = patientContainer?.querySelector('button') || patientText.closest('button') || patientText;
|
|
332
|
+
|
|
333
|
+
await act(async () => {
|
|
334
|
+
fireEvent.click(clickableElement);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
await waitFor(
|
|
338
|
+
() => {
|
|
339
|
+
const patientInput = screen.queryByPlaceholderText('Search for patient') as HTMLInputElement;
|
|
340
|
+
expect(patientInput).toBeInTheDocument();
|
|
341
|
+
},
|
|
342
|
+
{ timeout: 3000 }
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
const patientInput = screen.getByPlaceholderText('Search for patient');
|
|
346
|
+
await act(async () => {
|
|
347
|
+
fireEvent.change(patientInput, { target: { value: 'Smith' } });
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
await waitFor(
|
|
351
|
+
() => {
|
|
352
|
+
const smithOption = screen.queryByText(/Smith/i);
|
|
353
|
+
expect(smithOption).toBeInTheDocument();
|
|
354
|
+
},
|
|
355
|
+
{ timeout: 3000 }
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
await act(async () => {
|
|
359
|
+
const smithOption = screen.getByText(/Smith/i);
|
|
360
|
+
fireEvent.click(smithOption);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
await waitFor(
|
|
364
|
+
() => {
|
|
365
|
+
expect(onTaskChange).toHaveBeenCalled();
|
|
366
|
+
const call = onTaskChange.mock.calls[onTaskChange.mock.calls.length - 1];
|
|
367
|
+
const updatedTask = call[0] as Task;
|
|
368
|
+
expect(updatedTask.for?.reference).toBe('Patient/patient-2');
|
|
369
|
+
},
|
|
370
|
+
{ timeout: 5000 }
|
|
371
|
+
);
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
test('calls onTaskChange when due date is changed', async () => {
|
|
375
|
+
const user = userEvent.setup();
|
|
376
|
+
const onTaskChange = vi.fn();
|
|
377
|
+
|
|
378
|
+
setup(mockTask, { onTaskChange });
|
|
379
|
+
|
|
380
|
+
await waitFor(() => {
|
|
381
|
+
expect(screen.getByLabelText('Due Date')).toBeInTheDocument();
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
const dueDateInput = screen.getByLabelText('Due Date');
|
|
385
|
+
|
|
386
|
+
await user.clear(dueDateInput);
|
|
387
|
+
await user.type(dueDateInput, '2024-12-31T23:59');
|
|
388
|
+
|
|
389
|
+
await waitFor(
|
|
390
|
+
() => {
|
|
391
|
+
expect(onTaskChange).toHaveBeenCalled();
|
|
392
|
+
const call = onTaskChange.mock.calls[onTaskChange.mock.calls.length - 1];
|
|
393
|
+
const updatedTask = call[0] as Task;
|
|
394
|
+
expect(updatedTask.restriction?.period?.end).toBeDefined();
|
|
395
|
+
},
|
|
396
|
+
{ timeout: 3000 }
|
|
397
|
+
);
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
test('renders status CodeInput with current value and correct binding', async () => {
|
|
401
|
+
setup(mockTask);
|
|
402
|
+
|
|
403
|
+
await waitFor(() => {
|
|
404
|
+
expect(screen.getByText('Status')).toBeInTheDocument();
|
|
405
|
+
expect(screen.getByText('in-progress')).toBeInTheDocument();
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
const allSearchboxes = screen.getAllByRole('searchbox');
|
|
409
|
+
expect(allSearchboxes.length).toBeGreaterThan(0);
|
|
410
|
+
|
|
411
|
+
expect(screen.getByText('in-progress')).toBeInTheDocument();
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
test('renders priority CodeInput with current value and correct binding', async () => {
|
|
415
|
+
setup(mockTask);
|
|
416
|
+
|
|
417
|
+
await waitFor(() => {
|
|
418
|
+
expect(screen.getByText('Priority')).toBeInTheDocument();
|
|
419
|
+
expect(screen.getByText('routine')).toBeInTheDocument();
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
const allSearchboxes = screen.getAllByRole('searchbox');
|
|
423
|
+
expect(allSearchboxes.length).toBeGreaterThan(0);
|
|
424
|
+
|
|
425
|
+
expect(screen.getByText('routine')).toBeInTheDocument();
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
test('calls onTaskChange when owner is changed', async () => {
|
|
429
|
+
const onTaskChange = vi.fn();
|
|
430
|
+
|
|
431
|
+
const practitioner: Practitioner = {
|
|
432
|
+
resourceType: 'Practitioner',
|
|
433
|
+
id: 'prac-456',
|
|
434
|
+
name: [{ given: ['Alice'], family: 'Johnson' }],
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
await medplum.createResource(practitioner);
|
|
438
|
+
vi.spyOn(medplum, 'searchResources').mockResolvedValue([practitioner] as any);
|
|
439
|
+
|
|
440
|
+
const taskWithoutOwner: Task = {
|
|
441
|
+
...mockTask,
|
|
442
|
+
owner: undefined,
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
setup(taskWithoutOwner, { onTaskChange });
|
|
446
|
+
|
|
447
|
+
await waitFor(() => {
|
|
448
|
+
expect(screen.getByText('Assignee')).toBeInTheDocument();
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
const allSearchboxes = screen.getAllByRole('searchbox');
|
|
452
|
+
let ownerInput: HTMLInputElement | undefined;
|
|
453
|
+
for (const input of allSearchboxes) {
|
|
454
|
+
const stack = input.closest('.mantine-Stack-root');
|
|
455
|
+
if (stack?.querySelector('.mantine-Text-root')?.textContent === 'Assignee') {
|
|
456
|
+
ownerInput = input as HTMLInputElement;
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (!ownerInput) {
|
|
462
|
+
expect(screen.getByText('Assignee')).toBeInTheDocument();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
await act(async () => {
|
|
467
|
+
fireEvent.change(ownerInput, { target: { value: 'Johnson' } });
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
await waitFor(
|
|
471
|
+
() => {
|
|
472
|
+
expect(screen.getByText(/Alice Johnson/i)).toBeInTheDocument();
|
|
473
|
+
},
|
|
474
|
+
{ timeout: 3000 }
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
await act(async () => {
|
|
478
|
+
const johnsonOption = screen.getByText(/Alice Johnson/i);
|
|
479
|
+
fireEvent.click(johnsonOption);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
await waitFor(
|
|
483
|
+
() => {
|
|
484
|
+
expect(onTaskChange).toHaveBeenCalled();
|
|
485
|
+
const call = onTaskChange.mock.calls[onTaskChange.mock.calls.length - 1];
|
|
486
|
+
const updatedTask = call[0] as Task;
|
|
487
|
+
expect(updatedTask.owner?.reference).toBe('Practitioner/prac-456');
|
|
488
|
+
},
|
|
489
|
+
{ timeout: 5000 }
|
|
490
|
+
);
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
test('calls onTaskChange when basedOn is added', async () => {
|
|
494
|
+
const onTaskChange = vi.fn();
|
|
495
|
+
|
|
496
|
+
const serviceRequest = await medplum.createResource({
|
|
497
|
+
resourceType: 'ServiceRequest',
|
|
498
|
+
id: 'sr-123',
|
|
499
|
+
status: 'active',
|
|
500
|
+
intent: 'order',
|
|
501
|
+
subject: { reference: 'Patient/patient-123' },
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
vi.spyOn(medplum, 'searchResources').mockResolvedValue([serviceRequest] as any);
|
|
505
|
+
|
|
506
|
+
const taskWithoutBasedOn: Task = {
|
|
507
|
+
...mockTask,
|
|
508
|
+
basedOn: undefined,
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
setup(taskWithoutBasedOn, { onTaskChange });
|
|
512
|
+
|
|
513
|
+
await waitFor(() => {
|
|
514
|
+
expect(screen.getByText('Based On')).toBeInTheDocument();
|
|
515
|
+
expect(screen.getByPlaceholderText('Select any resource...')).toBeInTheDocument();
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
const basedOnInput = screen.getByPlaceholderText('Select any resource...');
|
|
519
|
+
|
|
520
|
+
await act(async () => {
|
|
521
|
+
fireEvent.change(basedOnInput, { target: { value: 'ServiceRequest' } });
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
await waitFor(
|
|
525
|
+
() => {
|
|
526
|
+
expect(medplum.searchResources).toHaveBeenCalled();
|
|
527
|
+
},
|
|
528
|
+
{ timeout: 3000 }
|
|
529
|
+
);
|
|
530
|
+
|
|
531
|
+
await waitFor(
|
|
532
|
+
() => {
|
|
533
|
+
const srOption = screen.queryByText(/ServiceRequest/i);
|
|
534
|
+
expect(srOption).toBeInTheDocument();
|
|
535
|
+
},
|
|
536
|
+
{ timeout: 3000 }
|
|
537
|
+
);
|
|
538
|
+
|
|
539
|
+
await act(async () => {
|
|
540
|
+
const srOption = screen.getByText(/ServiceRequest/i);
|
|
541
|
+
fireEvent.click(srOption);
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
await waitFor(
|
|
545
|
+
() => {
|
|
546
|
+
expect(onTaskChange).toHaveBeenCalled();
|
|
547
|
+
const call = onTaskChange.mock.calls[onTaskChange.mock.calls.length - 1];
|
|
548
|
+
const updatedTask = call[0] as Task;
|
|
549
|
+
expect(updatedTask.basedOn).toBeDefined();
|
|
550
|
+
expect(updatedTask.basedOn?.length).toBeGreaterThan(0);
|
|
551
|
+
},
|
|
552
|
+
{ timeout: 5000 }
|
|
553
|
+
);
|
|
554
|
+
});
|
|
555
|
+
});
|