formanitor 0.0.23 → 0.0.24

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.d.cts CHANGED
@@ -719,6 +719,38 @@ type AIMedication = {
719
719
  reason?: string;
720
720
  };
721
721
 
722
+ declare const BEFORE_AFTER_OPTIONS: readonly [{
723
+ readonly label: "Blank";
724
+ readonly value: "";
725
+ }, {
726
+ readonly label: "AFTER FOOD";
727
+ readonly value: "AFTER FOOD";
728
+ }, {
729
+ readonly label: "BEFORE FOOD";
730
+ readonly value: "BEFORE FOOD";
731
+ }, {
732
+ readonly label: "WITH FOOD";
733
+ readonly value: "WITH FOOD";
734
+ }, {
735
+ readonly label: "SINGLE DOSE";
736
+ readonly value: "SINGLE DOSE";
737
+ }, {
738
+ readonly label: "BED TIME";
739
+ readonly value: "BED TIME";
740
+ }, {
741
+ readonly label: "EMPTY STOMACH";
742
+ readonly value: "EMPTY STOMACH";
743
+ }, {
744
+ readonly label: "LOCAL APPLICATION";
745
+ readonly value: "LOCAL APPLICATION";
746
+ }, {
747
+ readonly label: "STAT";
748
+ readonly value: "STAT";
749
+ }, {
750
+ readonly label: "INHALATION";
751
+ readonly value: "INHALATION";
752
+ }];
753
+ type BeforeAfterOption = (typeof BEFORE_AFTER_OPTIONS)[number]['value'];
722
754
  type MedicationSearchResult = {
723
755
  id: string;
724
756
  name: string;
@@ -734,7 +766,7 @@ type Medication = {
734
766
  is_custom: boolean;
735
767
  duration_value: string;
736
768
  duration_unit: 'days' | 'weeks' | 'months';
737
- before_after: 'AFTER FOOD' | 'BEFORE FOOD';
769
+ before_after: BeforeAfterOption;
738
770
  morning: string;
739
771
  afternoon: string;
740
772
  night: string;
package/dist/index.d.ts CHANGED
@@ -719,6 +719,38 @@ type AIMedication = {
719
719
  reason?: string;
720
720
  };
721
721
 
722
+ declare const BEFORE_AFTER_OPTIONS: readonly [{
723
+ readonly label: "Blank";
724
+ readonly value: "";
725
+ }, {
726
+ readonly label: "AFTER FOOD";
727
+ readonly value: "AFTER FOOD";
728
+ }, {
729
+ readonly label: "BEFORE FOOD";
730
+ readonly value: "BEFORE FOOD";
731
+ }, {
732
+ readonly label: "WITH FOOD";
733
+ readonly value: "WITH FOOD";
734
+ }, {
735
+ readonly label: "SINGLE DOSE";
736
+ readonly value: "SINGLE DOSE";
737
+ }, {
738
+ readonly label: "BED TIME";
739
+ readonly value: "BED TIME";
740
+ }, {
741
+ readonly label: "EMPTY STOMACH";
742
+ readonly value: "EMPTY STOMACH";
743
+ }, {
744
+ readonly label: "LOCAL APPLICATION";
745
+ readonly value: "LOCAL APPLICATION";
746
+ }, {
747
+ readonly label: "STAT";
748
+ readonly value: "STAT";
749
+ }, {
750
+ readonly label: "INHALATION";
751
+ readonly value: "INHALATION";
752
+ }];
753
+ type BeforeAfterOption = (typeof BEFORE_AFTER_OPTIONS)[number]['value'];
722
754
  type MedicationSearchResult = {
723
755
  id: string;
724
756
  name: string;
@@ -734,7 +766,7 @@ type Medication = {
734
766
  is_custom: boolean;
735
767
  duration_value: string;
736
768
  duration_unit: 'days' | 'weeks' | 'months';
737
- before_after: 'AFTER FOOD' | 'BEFORE FOOD';
769
+ before_after: BeforeAfterOption;
738
770
  morning: string;
739
771
  afternoon: string;
740
772
  night: string;
package/dist/index.mjs CHANGED
@@ -2778,6 +2778,22 @@ var AddEntityDialog = ({
2778
2778
  actionSlot != null && /* @__PURE__ */ jsx("div", { className: "px-6 py-4 flex justify-end shrink-0 border-t border-border bg-background", children: actionSlot })
2779
2779
  ] }) });
2780
2780
  };
2781
+ var BEFORE_AFTER_OPTIONS = [
2782
+ { label: "Blank", value: "" },
2783
+ { label: "AFTER FOOD", value: "AFTER FOOD" },
2784
+ { label: "BEFORE FOOD", value: "BEFORE FOOD" },
2785
+ { label: "WITH FOOD", value: "WITH FOOD" },
2786
+ { label: "SINGLE DOSE", value: "SINGLE DOSE" },
2787
+ { label: "BED TIME", value: "BED TIME" },
2788
+ { label: "EMPTY STOMACH", value: "EMPTY STOMACH" },
2789
+ { label: "LOCAL APPLICATION", value: "LOCAL APPLICATION" },
2790
+ { label: "STAT", value: "STAT" },
2791
+ { label: "INHALATION", value: "INHALATION" }
2792
+ ];
2793
+ var BEFORE_AFTER_NORMALIZATION_MAP = {
2794
+ AF: "AFTER FOOD",
2795
+ BF: "BEFORE FOOD"
2796
+ };
2781
2797
  function mapToMedication(result) {
2782
2798
  return {
2783
2799
  id: result.id,
@@ -2841,7 +2857,7 @@ function mapFrequentItemToMedication(item) {
2841
2857
  const parsed = parseDuration(item.duration);
2842
2858
  const duration_value = item.duration_value ?? parsed.value;
2843
2859
  const duration_unit = item.duration_unit ?? parsed.unit;
2844
- const before_after = item.before_after === "BEFORE FOOD" ? "BEFORE FOOD" : "AFTER FOOD";
2860
+ const before_after = normalizeBeforeAfter(item.before_after);
2845
2861
  const routeNote = item.route ? `Route: ${item.route}` : "";
2846
2862
  const baseNotes = item.notes?.trim() || "";
2847
2863
  const combinedNotes = [baseNotes, routeNote.trim()].filter((part) => part.length > 0).join(" \u2014 ");
@@ -2860,6 +2876,13 @@ function mapFrequentItemToMedication(item) {
2860
2876
  notes: combinedNotes
2861
2877
  };
2862
2878
  }
2879
+ function normalizeBeforeAfter(value) {
2880
+ if (value == null) return "AFTER FOOD";
2881
+ const mapped = BEFORE_AFTER_NORMALIZATION_MAP[value];
2882
+ if (mapped) return mapped;
2883
+ const validValues = BEFORE_AFTER_OPTIONS.map((option) => option.value);
2884
+ return validValues.includes(value) ? value : "AFTER FOOD";
2885
+ }
2863
2886
  function Spinner({
2864
2887
  value,
2865
2888
  onChange
@@ -2967,16 +2990,13 @@ function MedicationCard({
2967
2990
  )
2968
2991
  ] }),
2969
2992
  /* @__PURE__ */ jsx("div", { className: "flex gap-2 items-center flex-1 min-w-0 justify-end", children: ["morning", "afternoon", "night"].map((slot) => /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-0.5", children: /* @__PURE__ */ jsx(Spinner, { value: med[slot], onChange: (v) => set(slot, v) }) }, slot)) }),
2970
- /* @__PURE__ */ jsxs(
2993
+ /* @__PURE__ */ jsx(
2971
2994
  "select",
2972
2995
  {
2973
2996
  className: "text-xs border border-border rounded px-2 py-1 bg-white shrink-0",
2974
- value: med.before_after === "AFTER FOOD" ? "AF" : "BF",
2975
- onChange: (e) => set("before_after", e.target.value === "AF" ? "AFTER FOOD" : "BEFORE FOOD"),
2976
- children: [
2977
- /* @__PURE__ */ jsx("option", { value: "AF", children: "AF" }),
2978
- /* @__PURE__ */ jsx("option", { value: "BF", children: "BF" })
2979
- ]
2997
+ value: normalizeBeforeAfter(med.before_after),
2998
+ onChange: (e) => set("before_after", e.target.value),
2999
+ children: BEFORE_AFTER_OPTIONS.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.label))
2980
3000
  }
2981
3001
  )
2982
3002
  ] }),