@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.js CHANGED
@@ -20076,6 +20076,7 @@ var OrderState$3;
20076
20076
  OrderState2["Error"] = "ERROR";
20077
20077
  OrderState2["Pending"] = "PENDING";
20078
20078
  OrderState2["Placed"] = "PLACED";
20079
+ OrderState2["Routing"] = "ROUTING";
20079
20080
  })(OrderState$3 || (OrderState$3 = {}));
20080
20081
  var OrgType$2;
20081
20082
  (function(OrgType2) {
@@ -20114,6 +20115,16 @@ var SexType$2;
20114
20115
  SexType2["Male"] = "MALE";
20115
20116
  SexType2["Unknown"] = "UNKNOWN";
20116
20117
  })(SexType$2 || (SexType$2 = {}));
20118
+ var SortByDirection$1;
20119
+ (function(SortByDirection2) {
20120
+ SortByDirection2["Asc"] = "ASC";
20121
+ SortByDirection2["Desc"] = "DESC";
20122
+ })(SortByDirection$1 || (SortByDirection$1 = {}));
20123
+ var SortByOption$1;
20124
+ (function(SortByOption2) {
20125
+ SortByOption2["OrderCreatedAt"] = "ORDER_CREATED_AT";
20126
+ SortByOption2["OrderReadyByTime"] = "ORDER_READY_BY_TIME";
20127
+ })(SortByOption$1 || (SortByOption$1 = {}));
20117
20128
  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" } }] } }] };
20118
20129
  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" } }] } }] };
20119
20130
  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" } }] } }] } }] };
@@ -51823,11 +51834,11 @@ if (globalThis.__DEV__ !== false) {
51823
51834
  ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;
51824
51835
  }
51825
51836
 
51826
- function formatDate(dateString) {
51827
- if (!dateString) {
51828
- return "";
51829
- }
51830
- return new Date(dateString).toLocaleDateString("en-US", { timeZone: "UTC" });
51837
+ function formatDate(date) {
51838
+ return date ? new Date(date)?.toLocaleDateString("en-US") : "";
51839
+ }
51840
+ function formatDateUTC(date) {
51841
+ return date ? new Date(date)?.toLocaleDateString("en-US", { timeZone: "UTC" }) : "";
51831
51842
  }
51832
51843
  const CALENDAR_DATE_FORMAT = "yyyy-MM-dd";
51833
51844
 
@@ -52138,7 +52149,7 @@ function RecentOrdersDuplicateDialog() {
52138
52149
  size: "sm",
52139
52150
  color: "gray",
52140
52151
  get children() {
52141
- return ["Written by ", memo$1(() => state?.duplicateFill?.prescription?.prescriber?.name?.full), " on", " ", memo$1(() => new Date(state?.duplicateFill?.prescription?.writtenAt).toLocaleDateString())];
52152
+ return ["Written by ", memo$1(() => state?.duplicateFill?.prescription?.prescriber?.name?.full), " on", " ", memo$1(() => formatDate(state?.duplicateFill?.prescription?.writtenAt))];
52142
52153
  }
52143
52154
  }), null);
52144
52155
  insert(_el$6, createComponent(Button, {
@@ -53266,6 +53277,8 @@ const ListPharmaciesQuery = gql`
53266
53277
  }
53267
53278
  `;
53268
53279
 
53280
+ const formatPatientWeight = (weight, weightUnit = "lb") => `Patient weight: ${weight} ${weightUnit}`;
53281
+
53269
53282
  const DraftPrescriptionsContext = createContext();
53270
53283
  const transformPrescriptionFormData = (prescription, patientId) => ({
53271
53284
  externalId: prescription.externalId,
@@ -53286,16 +53299,24 @@ function isTreatmentInDraftPrescriptions(treatmentId, draftedPrescriptions) {
53286
53299
  }
53287
53300
  const createPrefillPrescriptionsOnApi = async ({
53288
53301
  client,
53289
- props
53302
+ props,
53303
+ rxNotesPrefill
53290
53304
  }) => {
53291
53305
  let rxToCreate = [];
53292
53306
  if (props.templateIdsPrefill.length > 0) {
53293
53307
  const dedupedTemplateIds = Array.from(new Set(props.templateIdsPrefill));
53294
- const templatedCreateRxList = dedupedTemplateIds.map((templateId) => ({
53295
- ...props.templateOverrides?.[templateId],
53296
- patientId: props.patientId,
53297
- templateId
53298
- }));
53308
+ const templatedCreateRxList = dedupedTemplateIds.map((templateId) => {
53309
+ const templateOverrideNotes = props.templateOverrides?.[templateId]?.notes;
53310
+ const notes = templateOverrideNotes ? `${templateOverrideNotes}
53311
+
53312
+ ${rxNotesPrefill}` : rxNotesPrefill;
53313
+ return {
53314
+ ...props.templateOverrides?.[templateId],
53315
+ patientId: props.patientId,
53316
+ templateId,
53317
+ notes
53318
+ };
53319
+ });
53299
53320
  rxToCreate = rxToCreate.concat(templatedCreateRxList);
53300
53321
  }
53301
53322
  if (props.prescriptionIdsPrefill.length > 0) {
@@ -53335,6 +53356,14 @@ const DraftPrescriptionsProvider = (props) => {
53335
53356
  const [isLoadingPrefills, setIsLoadingPrefills] = createSignal(false);
53336
53357
  const [draftPrescriptions, setDraftPrescriptions] = createSignal([]);
53337
53358
  const prescriptionIds = createMemo(() => draftPrescriptions().map((prescription) => prescription.id));
53359
+ const rxNotesPrefill = createMemo(() => {
53360
+ let notesPrefill = "";
53361
+ if (props.additionalNotes) notesPrefill = `${props.additionalNotes}
53362
+
53363
+ `;
53364
+ if (props.weight) notesPrefill = `${notesPrefill}${formatPatientWeight(props.weight, props.weightUnit)}`;
53365
+ return notesPrefill || void 0;
53366
+ });
53338
53367
  createEffect(async () => {
53339
53368
  if (
53340
53369
  // must have templateIds or prescriptionIds to create prescriptions
@@ -53347,7 +53376,8 @@ const DraftPrescriptionsProvider = (props) => {
53347
53376
  try {
53348
53377
  const newRxs = await createPrefillPrescriptionsOnApi({
53349
53378
  client,
53350
- props
53379
+ props,
53380
+ rxNotesPrefill: rxNotesPrefill()
53351
53381
  });
53352
53382
  if (newRxs) {
53353
53383
  setDraftPrescriptions((prev) => [...prev, ...newRxs]);
@@ -53486,6 +53516,7 @@ const DraftPrescriptionsProvider = (props) => {
53486
53516
  draftPrescriptions,
53487
53517
  prescriptionIds,
53488
53518
  isLoadingPrefills,
53519
+ rxNotesPrefill,
53489
53520
  // actions
53490
53521
  setDraftPrescriptions,
53491
53522
  tryCreatePrescription,
@@ -54368,7 +54399,7 @@ function PatientInfo(props) {
54368
54399
  },
54369
54400
  sampleLoadingText: "female",
54370
54401
  get children() {
54371
- return formatDate(patient()?.dateOfBirth || "N/A");
54402
+ return memo$1(() => !!patient()?.dateOfBirth)() ? formatDateUTC(patient()?.dateOfBirth) : "N/A";
54372
54403
  }
54373
54404
  });
54374
54405
  }
@@ -55877,6 +55908,7 @@ var OrderState;
55877
55908
  OrderState2["Error"] = "ERROR";
55878
55909
  OrderState2["Pending"] = "PENDING";
55879
55910
  OrderState2["Placed"] = "PLACED";
55911
+ OrderState2["Routing"] = "ROUTING";
55880
55912
  })(OrderState || (OrderState = {}));
55881
55913
  var OrgType;
55882
55914
  (function(OrgType2) {
@@ -55915,6 +55947,16 @@ var SexType;
55915
55947
  SexType2["Male"] = "MALE";
55916
55948
  SexType2["Unknown"] = "UNKNOWN";
55917
55949
  })(SexType || (SexType = {}));
55950
+ var SortByDirection;
55951
+ (function(SortByDirection2) {
55952
+ SortByDirection2["Asc"] = "ASC";
55953
+ SortByDirection2["Desc"] = "DESC";
55954
+ })(SortByDirection || (SortByDirection = {}));
55955
+ var SortByOption;
55956
+ (function(SortByOption2) {
55957
+ SortByOption2["OrderCreatedAt"] = "ORDER_CREATED_AT";
55958
+ SortByOption2["OrderReadyByTime"] = "ORDER_READY_BY_TIME";
55959
+ })(SortByOption || (SortByOption = {}));
55918
55960
  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" } }] } }] };
55919
55961
  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" } }] } }] };
55920
55962
  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" } }] } }] } }] };
@@ -57627,7 +57669,7 @@ const PatientSelect = (props) => {
57627
57669
  const PatientOption = (props) => (() => {
57628
57670
  var _el$ = _tmpl$$13(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
57629
57671
  insert(_el$2, () => props.value.name.full);
57630
- insert(_el$3, () => formatDate(props.value.dateOfBirth));
57672
+ insert(_el$3, () => formatDateUTC(props.value.dateOfBirth));
57631
57673
  createRenderEffect(() => className(_el$3, clsx("shrink-0", props.active ? "text-white" : "text-gray-500")));
57632
57674
  return _el$;
57633
57675
  })();
@@ -58384,7 +58426,7 @@ function checkHasPermission(subset, superset) {
58384
58426
  return subset.every((permission) => superset.includes(permission));
58385
58427
  }
58386
58428
 
58387
- const version$1 = "0.23.1";
58429
+ const version$1 = "0.23.3";
58388
58430
  const pkg = {
58389
58431
  version: version$1};
58390
58432
 
@@ -67101,8 +67143,6 @@ const clearForm = (actions, overrides) => {
67101
67143
  });
67102
67144
  };
67103
67145
 
67104
- const formatPatientWeight = (weight, weightUnit = "lb") => `Patient weight: ${weight} ${weightUnit}`;
67105
-
67106
67146
  var PrescriptionState = /* @__PURE__ */ ((PrescriptionState2) => {
67107
67147
  PrescriptionState2["Draft"] = "DRAFT";
67108
67148
  PrescriptionState2["Active"] = "ACTIVE";
@@ -76638,7 +76678,8 @@ function PrescribeWorkflow(props) {
76638
76678
  draftPrescriptions,
76639
76679
  prescriptionIds,
76640
76680
  tryUpdatePrescriptionStates,
76641
- isLoadingPrefills
76681
+ isLoadingPrefills,
76682
+ rxNotesPrefill
76642
76683
  } = useDraftPrescriptions();
76643
76684
  const pharmacySelectionContext = usePharmacySelectionContext();
76644
76685
  const {
@@ -76673,15 +76714,6 @@ function PrescribeWorkflow(props) {
76673
76714
  return fulfillmentNeedsAddress$1(pharmacySelectionContext.fulfillmentType()) && !hasPatientAddress();
76674
76715
  });
76675
76716
  const [isScreeningAlertWarningOpen, setIsScreeningAlertWarningOpen] = createSignal(false);
76676
- let prefillNotes = "";
76677
- if (props.additionalNotes) {
76678
- prefillNotes = `${props.additionalNotes}
76679
-
76680
- `;
76681
- }
76682
- if (props.weight) {
76683
- prefillNotes = `${prefillNotes}${formatPatientWeight(props.weight, props.weightUnit)}`;
76684
- }
76685
76717
  onMount(async () => {
76686
76718
  if (props.address) {
76687
76719
  props.formActions.updateFormValue({
@@ -76691,7 +76723,7 @@ function PrescribeWorkflow(props) {
76691
76723
  }
76692
76724
  ref.addEventListener("photon-ticket-created-duplicate", () => {
76693
76725
  clearForm(props.formActions, {
76694
- notes: prefillNotes
76726
+ notes: rxNotesPrefill()
76695
76727
  });
76696
76728
  pharmacySelectionContext.setFulfillmentType(void 0);
76697
76729
  pharmacySelectionContext.setPharmacyId(void 0);
@@ -77123,7 +77155,9 @@ function PrescribeWorkflow(props) {
77123
77155
  get weightUnit() {
77124
77156
  return props.weightUnit;
77125
77157
  },
77126
- prefillNotes,
77158
+ get prefillNotes() {
77159
+ return rxNotesPrefill();
77160
+ },
77127
77161
  screenDraftedPrescriptions,
77128
77162
  get screeningAlerts() {
77129
77163
  return screeningAlerts();
@@ -78074,6 +78108,15 @@ const PhotonPrescribeWorkflowComponent = (props) => {
78074
78108
  get enableCombineAndDuplicate() {
78075
78109
  return props.enableCombineAndDuplicate;
78076
78110
  },
78111
+ get additionalNotes() {
78112
+ return props.additionalNotes;
78113
+ },
78114
+ get weight() {
78115
+ return props.weight;
78116
+ },
78117
+ get weightUnit() {
78118
+ return props.weightUnit;
78119
+ },
78077
78120
  get children() {
78078
78121
  return createComponent(PharmacySelectionProvider, {
78079
78122
  get pharmacyIdProp() {