@photonhealth/elements 0.23.1 → 0.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -20074,6 +20074,7 @@ var OrderState$3;
20074
20074
  OrderState2["Error"] = "ERROR";
20075
20075
  OrderState2["Pending"] = "PENDING";
20076
20076
  OrderState2["Placed"] = "PLACED";
20077
+ OrderState2["Routing"] = "ROUTING";
20077
20078
  })(OrderState$3 || (OrderState$3 = {}));
20078
20079
  var OrgType$2;
20079
20080
  (function(OrgType2) {
@@ -20112,6 +20113,16 @@ var SexType$2;
20112
20113
  SexType2["Male"] = "MALE";
20113
20114
  SexType2["Unknown"] = "UNKNOWN";
20114
20115
  })(SexType$2 || (SexType$2 = {}));
20116
+ var SortByDirection$1;
20117
+ (function(SortByDirection2) {
20118
+ SortByDirection2["Asc"] = "ASC";
20119
+ SortByDirection2["Desc"] = "DESC";
20120
+ })(SortByDirection$1 || (SortByDirection$1 = {}));
20121
+ var SortByOption$1;
20122
+ (function(SortByOption2) {
20123
+ SortByOption2["OrderCreatedAt"] = "ORDER_CREATED_AT";
20124
+ SortByOption2["OrderReadyByTime"] = "ORDER_READY_BY_TIME";
20125
+ })(SortByOption$1 || (SortByOption$1 = {}));
20115
20126
  const SupervisorCardFragmentDoc$1 = { "kind": "Document", "definitions": [{ "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "SupervisorCard" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Supervisor" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "firstName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "npi" } }] } }] };
20116
20127
  const CreateSupervisorMutationDocument$1 = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateSupervisorMutation" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "firstName" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "lastName" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "npi" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createSupervisor" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "firstName" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "firstName" } } }, { "kind": "ObjectField", "name": { "kind": "Name", "value": "lastName" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "lastName" } } }, { "kind": "ObjectField", "name": { "kind": "Name", "value": "npi" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "npi" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "SupervisorCard" } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "SupervisorCard" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Supervisor" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "firstName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "npi" } }] } }] };
20117
20128
  const SearchTreatmentsDocument$1 = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "SearchTreatments" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "filter" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "TreatmentFilter" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "treatments" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "filter" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "filter" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }] } }] } }] };
@@ -51821,11 +51832,11 @@ if (globalThis.__DEV__ !== false) {
51821
51832
  ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;
51822
51833
  }
51823
51834
 
51824
- function formatDate(dateString) {
51825
- if (!dateString) {
51826
- return "";
51827
- }
51828
- return new Date(dateString).toLocaleDateString("en-US", { timeZone: "UTC" });
51835
+ function formatDate(date) {
51836
+ return date ? new Date(date)?.toLocaleDateString("en-US") : "";
51837
+ }
51838
+ function formatDateUTC(date) {
51839
+ return date ? new Date(date)?.toLocaleDateString("en-US", { timeZone: "UTC" }) : "";
51829
51840
  }
51830
51841
  const CALENDAR_DATE_FORMAT = "yyyy-MM-dd";
51831
51842
 
@@ -52136,7 +52147,7 @@ function RecentOrdersDuplicateDialog() {
52136
52147
  size: "sm",
52137
52148
  color: "gray",
52138
52149
  get children() {
52139
- return ["Written by ", memo$1(() => state?.duplicateFill?.prescription?.prescriber?.name?.full), " on", " ", memo$1(() => new Date(state?.duplicateFill?.prescription?.writtenAt).toLocaleDateString())];
52150
+ return ["Written by ", memo$1(() => state?.duplicateFill?.prescription?.prescriber?.name?.full), " on", " ", memo$1(() => formatDate(state?.duplicateFill?.prescription?.writtenAt))];
52140
52151
  }
52141
52152
  }), null);
52142
52153
  insert(_el$6, createComponent(Button, {
@@ -53264,6 +53275,8 @@ const ListPharmaciesQuery = gql`
53264
53275
  }
53265
53276
  `;
53266
53277
 
53278
+ const formatPatientWeight = (weight, weightUnit = "lb") => `Patient weight: ${weight} ${weightUnit}`;
53279
+
53267
53280
  const DraftPrescriptionsContext = createContext();
53268
53281
  const transformPrescriptionFormData = (prescription, patientId) => ({
53269
53282
  externalId: prescription.externalId,
@@ -53284,16 +53297,24 @@ function isTreatmentInDraftPrescriptions(treatmentId, draftedPrescriptions) {
53284
53297
  }
53285
53298
  const createPrefillPrescriptionsOnApi = async ({
53286
53299
  client,
53287
- props
53300
+ props,
53301
+ rxNotesPrefill
53288
53302
  }) => {
53289
53303
  let rxToCreate = [];
53290
53304
  if (props.templateIdsPrefill.length > 0) {
53291
53305
  const dedupedTemplateIds = Array.from(new Set(props.templateIdsPrefill));
53292
- const templatedCreateRxList = dedupedTemplateIds.map((templateId) => ({
53293
- ...props.templateOverrides?.[templateId],
53294
- patientId: props.patientId,
53295
- templateId
53296
- }));
53306
+ const templatedCreateRxList = dedupedTemplateIds.map((templateId) => {
53307
+ const templateOverrideNotes = props.templateOverrides?.[templateId]?.notes;
53308
+ const notes = templateOverrideNotes ? `${templateOverrideNotes}
53309
+
53310
+ ${rxNotesPrefill}` : rxNotesPrefill;
53311
+ return {
53312
+ ...props.templateOverrides?.[templateId],
53313
+ patientId: props.patientId,
53314
+ templateId,
53315
+ notes
53316
+ };
53317
+ });
53297
53318
  rxToCreate = rxToCreate.concat(templatedCreateRxList);
53298
53319
  }
53299
53320
  if (props.prescriptionIdsPrefill.length > 0) {
@@ -53333,6 +53354,14 @@ const DraftPrescriptionsProvider = (props) => {
53333
53354
  const [isLoadingPrefills, setIsLoadingPrefills] = createSignal(false);
53334
53355
  const [draftPrescriptions, setDraftPrescriptions] = createSignal([]);
53335
53356
  const prescriptionIds = createMemo(() => draftPrescriptions().map((prescription) => prescription.id));
53357
+ const rxNotesPrefill = createMemo(() => {
53358
+ let notesPrefill = "";
53359
+ if (props.additionalNotes) notesPrefill = `${props.additionalNotes}
53360
+
53361
+ `;
53362
+ if (props.weight) notesPrefill = `${notesPrefill}${formatPatientWeight(props.weight, props.weightUnit)}`;
53363
+ return notesPrefill || void 0;
53364
+ });
53336
53365
  createEffect(async () => {
53337
53366
  if (
53338
53367
  // must have templateIds or prescriptionIds to create prescriptions
@@ -53345,7 +53374,8 @@ const DraftPrescriptionsProvider = (props) => {
53345
53374
  try {
53346
53375
  const newRxs = await createPrefillPrescriptionsOnApi({
53347
53376
  client,
53348
- props
53377
+ props,
53378
+ rxNotesPrefill: rxNotesPrefill()
53349
53379
  });
53350
53380
  if (newRxs) {
53351
53381
  setDraftPrescriptions((prev) => [...prev, ...newRxs]);
@@ -53484,6 +53514,7 @@ const DraftPrescriptionsProvider = (props) => {
53484
53514
  draftPrescriptions,
53485
53515
  prescriptionIds,
53486
53516
  isLoadingPrefills,
53517
+ rxNotesPrefill,
53487
53518
  // actions
53488
53519
  setDraftPrescriptions,
53489
53520
  tryCreatePrescription,
@@ -54366,7 +54397,7 @@ function PatientInfo(props) {
54366
54397
  },
54367
54398
  sampleLoadingText: "female",
54368
54399
  get children() {
54369
- return formatDate(patient()?.dateOfBirth || "N/A");
54400
+ return memo$1(() => !!patient()?.dateOfBirth)() ? formatDateUTC(patient()?.dateOfBirth) : "N/A";
54370
54401
  }
54371
54402
  });
54372
54403
  }
@@ -55875,6 +55906,7 @@ var OrderState;
55875
55906
  OrderState2["Error"] = "ERROR";
55876
55907
  OrderState2["Pending"] = "PENDING";
55877
55908
  OrderState2["Placed"] = "PLACED";
55909
+ OrderState2["Routing"] = "ROUTING";
55878
55910
  })(OrderState || (OrderState = {}));
55879
55911
  var OrgType;
55880
55912
  (function(OrgType2) {
@@ -55913,6 +55945,16 @@ var SexType;
55913
55945
  SexType2["Male"] = "MALE";
55914
55946
  SexType2["Unknown"] = "UNKNOWN";
55915
55947
  })(SexType || (SexType = {}));
55948
+ var SortByDirection;
55949
+ (function(SortByDirection2) {
55950
+ SortByDirection2["Asc"] = "ASC";
55951
+ SortByDirection2["Desc"] = "DESC";
55952
+ })(SortByDirection || (SortByDirection = {}));
55953
+ var SortByOption;
55954
+ (function(SortByOption2) {
55955
+ SortByOption2["OrderCreatedAt"] = "ORDER_CREATED_AT";
55956
+ SortByOption2["OrderReadyByTime"] = "ORDER_READY_BY_TIME";
55957
+ })(SortByOption || (SortByOption = {}));
55916
55958
  const SupervisorCardFragmentDoc = { "kind": "Document", "definitions": [{ "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "SupervisorCard" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Supervisor" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "firstName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "npi" } }] } }] };
55917
55959
  const CreateSupervisorMutationDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateSupervisorMutation" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "firstName" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "lastName" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "npi" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createSupervisor" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "firstName" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "firstName" } } }, { "kind": "ObjectField", "name": { "kind": "Name", "value": "lastName" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "lastName" } } }, { "kind": "ObjectField", "name": { "kind": "Name", "value": "npi" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "npi" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "SupervisorCard" } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "SupervisorCard" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Supervisor" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "firstName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "npi" } }] } }] };
55918
55960
  const SearchTreatmentsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "SearchTreatments" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "filter" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "TreatmentFilter" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "treatments" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "filter" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "filter" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }] } }] } }] };
@@ -57625,7 +57667,7 @@ const PatientSelect = (props) => {
57625
57667
  const PatientOption = (props) => (() => {
57626
57668
  var _el$ = _tmpl$$13(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
57627
57669
  insert(_el$2, () => props.value.name.full);
57628
- insert(_el$3, () => formatDate(props.value.dateOfBirth));
57670
+ insert(_el$3, () => formatDateUTC(props.value.dateOfBirth));
57629
57671
  createRenderEffect(() => className(_el$3, clsx("shrink-0", props.active ? "text-white" : "text-gray-500")));
57630
57672
  return _el$;
57631
57673
  })();
@@ -58382,7 +58424,7 @@ function checkHasPermission(subset, superset) {
58382
58424
  return subset.every((permission) => superset.includes(permission));
58383
58425
  }
58384
58426
 
58385
- const version$1 = "0.23.1";
58427
+ const version$1 = "0.23.3";
58386
58428
  const pkg = {
58387
58429
  version: version$1};
58388
58430
 
@@ -67099,8 +67141,6 @@ const clearForm = (actions, overrides) => {
67099
67141
  });
67100
67142
  };
67101
67143
 
67102
- const formatPatientWeight = (weight, weightUnit = "lb") => `Patient weight: ${weight} ${weightUnit}`;
67103
-
67104
67144
  var PrescriptionState = /* @__PURE__ */ ((PrescriptionState2) => {
67105
67145
  PrescriptionState2["Draft"] = "DRAFT";
67106
67146
  PrescriptionState2["Active"] = "ACTIVE";
@@ -76636,7 +76676,8 @@ function PrescribeWorkflow(props) {
76636
76676
  draftPrescriptions,
76637
76677
  prescriptionIds,
76638
76678
  tryUpdatePrescriptionStates,
76639
- isLoadingPrefills
76679
+ isLoadingPrefills,
76680
+ rxNotesPrefill
76640
76681
  } = useDraftPrescriptions();
76641
76682
  const pharmacySelectionContext = usePharmacySelectionContext();
76642
76683
  const {
@@ -76671,15 +76712,6 @@ function PrescribeWorkflow(props) {
76671
76712
  return fulfillmentNeedsAddress$1(pharmacySelectionContext.fulfillmentType()) && !hasPatientAddress();
76672
76713
  });
76673
76714
  const [isScreeningAlertWarningOpen, setIsScreeningAlertWarningOpen] = createSignal(false);
76674
- let prefillNotes = "";
76675
- if (props.additionalNotes) {
76676
- prefillNotes = `${props.additionalNotes}
76677
-
76678
- `;
76679
- }
76680
- if (props.weight) {
76681
- prefillNotes = `${prefillNotes}${formatPatientWeight(props.weight, props.weightUnit)}`;
76682
- }
76683
76715
  onMount(async () => {
76684
76716
  if (props.address) {
76685
76717
  props.formActions.updateFormValue({
@@ -76689,7 +76721,7 @@ function PrescribeWorkflow(props) {
76689
76721
  }
76690
76722
  ref.addEventListener("photon-ticket-created-duplicate", () => {
76691
76723
  clearForm(props.formActions, {
76692
- notes: prefillNotes
76724
+ notes: rxNotesPrefill()
76693
76725
  });
76694
76726
  pharmacySelectionContext.setFulfillmentType(void 0);
76695
76727
  pharmacySelectionContext.setPharmacyId(void 0);
@@ -77121,7 +77153,9 @@ function PrescribeWorkflow(props) {
77121
77153
  get weightUnit() {
77122
77154
  return props.weightUnit;
77123
77155
  },
77124
- prefillNotes,
77156
+ get prefillNotes() {
77157
+ return rxNotesPrefill();
77158
+ },
77125
77159
  screenDraftedPrescriptions,
77126
77160
  get screeningAlerts() {
77127
77161
  return screeningAlerts();
@@ -78072,6 +78106,15 @@ const PhotonPrescribeWorkflowComponent = (props) => {
78072
78106
  get enableCombineAndDuplicate() {
78073
78107
  return props.enableCombineAndDuplicate;
78074
78108
  },
78109
+ get additionalNotes() {
78110
+ return props.additionalNotes;
78111
+ },
78112
+ get weight() {
78113
+ return props.weight;
78114
+ },
78115
+ get weightUnit() {
78116
+ return props.weightUnit;
78117
+ },
78075
78118
  get children() {
78076
78119
  return createComponent(PharmacySelectionProvider, {
78077
78120
  get pharmacyIdProp() {