@photonhealth/react 2.0.0-rc.2 → 2.0.0-rc.4
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 +17 -1
- package/dist/analytics/PhotonAnalyticsProvider.d.ts +5 -2
- package/dist/analytics/PhotonAnalyticsProvider.d.ts.map +1 -1
- package/dist/analytics/PhotonAnalyticsProvider.js +34 -15
- package/dist/analytics/PhotonAnalyticsProvider.js.map +1 -1
- package/dist/analytics/cardLifecycle.d.ts +10 -0
- package/dist/analytics/cardLifecycle.d.ts.map +1 -0
- package/dist/analytics/cardLifecycle.js +43 -0
- package/dist/analytics/cardLifecycle.js.map +1 -0
- package/dist/analytics/lifecycleOutcomes.d.ts +8 -0
- package/dist/analytics/lifecycleOutcomes.d.ts.map +1 -0
- package/dist/analytics/lifecycleOutcomes.js +16 -0
- package/dist/analytics/lifecycleOutcomes.js.map +1 -0
- package/dist/analytics/tracker.d.ts +5 -3
- package/dist/analytics/tracker.d.ts.map +1 -1
- package/dist/analytics/tracker.js +10 -5
- package/dist/analytics/tracker.js.map +1 -1
- package/dist/components/PhotonOrder.d.ts +18 -18
- package/dist/components/PhotonOrder.d.ts.map +1 -1
- package/dist/components/PhotonOrder.js +17 -6
- package/dist/components/PhotonOrder.js.map +1 -1
- package/dist/components/PhotonPatient.d.ts +7 -35
- package/dist/components/PhotonPatient.d.ts.map +1 -1
- package/dist/components/PhotonPatient.js +3 -77
- package/dist/components/PhotonPatient.js.map +1 -1
- package/dist/components/PhotonPrescription.d.ts +14 -14
- package/dist/components/PhotonPrescription.d.ts.map +1 -1
- package/dist/components/PhotonPrescription.js +0 -1
- package/dist/components/PhotonPrescription.js.map +1 -1
- package/dist/components/open.d.ts +11 -13
- package/dist/components/open.d.ts.map +1 -1
- package/dist/components/open.js +7 -2
- package/dist/components/open.js.map +1 -1
- package/dist/components/patient/PatientCard/PatientCard.d.ts +30 -0
- package/dist/components/patient/PatientCard/PatientCard.d.ts.map +1 -0
- package/dist/components/patient/PatientCard/PatientCard.js +101 -0
- package/dist/components/patient/PatientCard/PatientCard.js.map +1 -0
- package/dist/components/patient/PatientCard/usePatientToShow.d.ts +22 -0
- package/dist/components/patient/PatientCard/usePatientToShow.d.ts.map +1 -0
- package/dist/components/patient/PatientCard/usePatientToShow.js +40 -0
- package/dist/components/patient/PatientCard/usePatientToShow.js.map +1 -0
- package/dist/components/patient/PatientIntakeForm.d.ts +16 -0
- package/dist/components/patient/PatientIntakeForm.d.ts.map +1 -0
- package/dist/components/patient/PatientIntakeForm.js +114 -0
- package/dist/components/patient/PatientIntakeForm.js.map +1 -0
- package/dist/components/patient/PatientSearch.d.ts +12 -0
- package/dist/components/patient/PatientSearch.d.ts.map +1 -0
- package/dist/components/patient/PatientSearch.js +148 -0
- package/dist/components/patient/PatientSearch.js.map +1 -0
- package/dist/components/patient/{Benefits.d.ts → PatientSummary/BenefitsInputForm.d.ts} +2 -2
- package/dist/components/patient/PatientSummary/BenefitsInputForm.d.ts.map +1 -0
- package/dist/components/patient/{Benefits.js → PatientSummary/BenefitsInputForm.js} +5 -5
- package/dist/components/patient/PatientSummary/BenefitsInputForm.js.map +1 -0
- package/dist/components/patient/{Clinical.d.ts → PatientSummary/ClinicalInputForm.d.ts} +13 -15
- package/dist/components/patient/PatientSummary/ClinicalInputForm.d.ts.map +1 -0
- package/dist/components/patient/{Clinical.js → PatientSummary/ClinicalInputForm.js} +11 -11
- package/dist/components/patient/PatientSummary/ClinicalInputForm.js.map +1 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.d.ts +5 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.js +30 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.js.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.d.ts +10 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.js +65 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.js.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.d.ts +53 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.js +78 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.js.map +1 -0
- package/dist/components/patient/PatientSummary/PatientSummary.d.ts +46 -0
- package/dist/components/patient/PatientSummary/PatientSummary.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/PatientSummary.js +57 -0
- package/dist/components/patient/PatientSummary/PatientSummary.js.map +1 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.d.ts +19 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.js +22 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.js.map +1 -0
- package/dist/components/patient/fields.d.ts +7 -25
- package/dist/components/patient/fields.d.ts.map +1 -1
- package/dist/components/patient/fields.js +11 -53
- package/dist/components/patient/fields.js.map +1 -1
- package/dist/components/patient/parsePatientSearchQuery.d.ts +16 -0
- package/dist/components/patient/parsePatientSearchQuery.d.ts.map +1 -0
- package/dist/components/patient/{query.js → parsePatientSearchQuery.js} +3 -15
- package/dist/components/patient/parsePatientSearchQuery.js.map +1 -0
- package/dist/components/prescription/PrescriptionCard.d.ts +14 -8
- package/dist/components/prescription/PrescriptionCard.d.ts.map +1 -1
- package/dist/components/prescription/PrescriptionCard.js +10 -3
- package/dist/components/prescription/PrescriptionCard.js.map +1 -1
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts +6 -6
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts.map +1 -1
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js +16 -8
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js.map +1 -1
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts +14 -1
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts.map +1 -1
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js +25 -7
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js.map +1 -1
- package/dist/components/schemaErrors.d.ts +3 -2
- package/dist/components/schemaErrors.d.ts.map +1 -1
- package/dist/components/schemaErrors.js +2 -1
- package/dist/components/schemaErrors.js.map +1 -1
- package/dist/components/search.d.ts +1 -1
- package/dist/components/search.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/meta/version.js +1 -1
- package/package.json +5 -2
- package/src/analytics/PhotonAnalyticsProvider.test.tsx +0 -1
- package/src/analytics/PhotonAnalyticsProvider.tsx +75 -20
- package/src/analytics/cardLifecycle.test.tsx +272 -0
- package/src/analytics/cardLifecycle.ts +44 -0
- package/src/analytics/fieldInteraction.test.tsx +11 -9
- package/src/analytics/lifecycleOutcomes.test.ts +78 -0
- package/src/analytics/lifecycleOutcomes.ts +29 -0
- package/src/analytics/tracker.test.ts +1 -1
- package/src/analytics/tracker.ts +13 -6
- package/src/analytics/usePhotonAnalytics.test.tsx +106 -0
- package/src/components/PhotonOrder.test.tsx +146 -8
- package/src/components/PhotonOrder.tsx +37 -26
- package/src/components/PhotonPatient.tsx +8 -163
- package/src/components/PhotonPrescription.test.tsx +22 -18
- package/src/components/PhotonPrescription.tsx +14 -14
- package/src/components/ScreeningAlerts.test.tsx +81 -0
- package/src/components/open.ts +13 -16
- package/src/components/order/DraftOrderPrompt.test.tsx +3 -6
- package/src/components/patient/PatientCard/PatientCard.test.tsx +255 -0
- package/src/components/patient/PatientCard/PatientCard.tsx +177 -0
- package/src/components/patient/PatientCard/usePatientToShow.ts +44 -0
- package/src/components/patient/PatientIntakeForm.test.tsx +262 -0
- package/src/components/patient/PatientIntakeForm.tsx +222 -0
- package/src/components/patient/PatientSearch.test.tsx +204 -0
- package/src/components/patient/PatientSearch.tsx +221 -0
- package/src/components/patient/PatientSummary/BenefitsInputForm.test.tsx +164 -0
- package/src/components/patient/{Benefits.tsx → PatientSummary/BenefitsInputForm.tsx} +4 -4
- package/src/components/patient/PatientSummary/ClinicalInputForm.test.tsx +247 -0
- package/src/components/patient/{Clinical.tsx → PatientSummary/ClinicalInputForm.tsx} +23 -23
- package/src/components/patient/PatientSummary/CollapsedSummary.test.tsx +90 -0
- package/src/components/patient/PatientSummary/CollapsedSummary.tsx +46 -0
- package/src/components/patient/PatientSummary/PatientDetailsForm.test.tsx +201 -0
- package/src/components/patient/PatientSummary/PatientDetailsForm.tsx +320 -0
- package/src/components/patient/PatientSummary/PatientDetailsSchema.test.ts +296 -0
- package/src/components/patient/PatientSummary/PatientDetailsSchema.ts +95 -0
- package/src/components/patient/PatientSummary/PatientSummary.test.tsx +194 -0
- package/src/components/patient/PatientSummary/PatientSummary.tsx +225 -0
- package/src/components/patient/PatientSummary/SummaryHeader.test.tsx +183 -0
- package/src/components/patient/PatientSummary/SummaryHeader.tsx +85 -0
- package/src/components/patient/fields.tsx +12 -138
- package/src/components/patient/parsePatientSearchQuery.test.ts +107 -0
- package/src/components/patient/{query.ts → parsePatientSearchQuery.ts} +4 -21
- package/src/components/prescription/PrescriptionCard.test.tsx +175 -12
- package/src/components/prescription/PrescriptionCard.tsx +28 -14
- package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.test.tsx +2 -5
- package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.test.tsx +3 -6
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.test.tsx +34 -37
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx +24 -16
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.test.ts +166 -41
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.ts +41 -9
- package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.test.tsx +2 -5
- package/src/components/prescription/TreatmentSearch/TreatmentSearch.test.tsx +3 -7
- package/src/components/schemaErrors.ts +3 -2
- package/src/components/search.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/meta/version.test.ts +1 -0
- package/src/meta/version.ts +1 -1
- package/dist/components/patient/Benefits.d.ts.map +0 -1
- package/dist/components/patient/Benefits.js.map +0 -1
- package/dist/components/patient/Clinical.d.ts.map +0 -1
- package/dist/components/patient/Clinical.js.map +0 -1
- package/dist/components/patient/IntakeForm.d.ts +0 -10
- package/dist/components/patient/IntakeForm.d.ts.map +0 -1
- package/dist/components/patient/IntakeForm.js +0 -333
- package/dist/components/patient/IntakeForm.js.map +0 -1
- package/dist/components/patient/Summary.d.ts +0 -48
- package/dist/components/patient/Summary.d.ts.map +0 -1
- package/dist/components/patient/Summary.js +0 -90
- package/dist/components/patient/Summary.js.map +0 -1
- package/dist/components/patient/query.d.ts +0 -37
- package/dist/components/patient/query.d.ts.map +0 -1
- package/dist/components/patient/query.js.map +0 -1
- package/src/components/patient/IntakeForm.test.tsx +0 -89
- package/src/components/patient/IntakeForm.tsx +0 -564
- package/src/components/patient/Summary.test.tsx +0 -106
- package/src/components/patient/Summary.tsx +0 -330
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface ParsedQuery {
|
|
2
|
-
name?: {
|
|
3
|
-
first?: string;
|
|
4
|
-
last?: string;
|
|
5
|
-
};
|
|
6
|
-
dateOfBirth?: string;
|
|
7
|
-
phone?: string;
|
|
8
|
-
email?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* What was typed, as the server takes it. Anything that reads as a date, a phone or an email is taken as
|
|
12
|
-
* one; what's left is the name, first word first. A single word is a first name — `searchBoth` says when
|
|
13
|
-
* it's worth trying as a last name too.
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseQuery(text: string): ParsedQuery;
|
|
16
|
-
/** query as patient input */
|
|
17
|
-
export declare const toSearchInput: ({ phone, email, ...demographic }: ParsedQuery) => {
|
|
18
|
-
demographic: {
|
|
19
|
-
name?: {
|
|
20
|
-
first?: string;
|
|
21
|
-
last?: string;
|
|
22
|
-
};
|
|
23
|
-
dateOfBirth?: string;
|
|
24
|
-
};
|
|
25
|
-
contact: {
|
|
26
|
-
email?: string | undefined;
|
|
27
|
-
phone?: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
/** Whether a query says anything the server can match on. */
|
|
31
|
-
export declare const isSearchable: (q: ParsedQuery) => boolean;
|
|
32
|
-
/**
|
|
33
|
-
* One word could be either name. It goes as a first name; if nothing comes back, it's worth asking again
|
|
34
|
-
* as a last name — "Lovelace" is as likely as "Ada".
|
|
35
|
-
*/
|
|
36
|
-
export declare const searchBoth: (q: ParsedQuery) => ParsedQuery | null;
|
|
37
|
-
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/components/patient/query.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAoBD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAuBpD;AAED,6BAA6B;AAC7B,eAAO,MAAM,aAAa,GAAI,kCAAkC,WAAW;;eAvDlE;YAAE,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE;sBAC1B,MAAM;;;;;;CAyDpB,CAAC;AAEH,6DAA6D;AA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,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;CACtE,CAAC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAc,EAAE,EAAE,CAC7C,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAc,EAAsB,EAAE,CAC/D,CAAC,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { fireEvent, render, screen } from "@testing-library/react";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
5
|
-
import { fakeNetworkApiClient, noMatch } from "@photonhealth/client/testing";
|
|
6
|
-
import { PhotonPatient } from "../../index.ts";
|
|
7
|
-
import {
|
|
8
|
-
edited,
|
|
9
|
-
leaveField,
|
|
10
|
-
meAsPrescriber,
|
|
11
|
-
recordAnalytics,
|
|
12
|
-
type RecordedAnalytics,
|
|
13
|
-
typeInto,
|
|
14
|
-
unmountAndRestoreFetch,
|
|
15
|
-
visitedWithoutEditing,
|
|
16
|
-
withAnalytics,
|
|
17
|
-
} from "../../../test/analytics.fixtures.tsx";
|
|
18
|
-
|
|
19
|
-
let analytics: RecordedAnalytics;
|
|
20
|
-
beforeEach(() => {
|
|
21
|
-
analytics = recordAnalytics();
|
|
22
|
-
});
|
|
23
|
-
afterEach(unmountAndRestoreFetch);
|
|
24
|
-
|
|
25
|
-
const renderPatientCard = () =>
|
|
26
|
-
render(<PhotonPatient />, {
|
|
27
|
-
wrapper: withAnalytics(fakeNetworkApiClient({ ...meAsPrescriber, SyncPatient: noMatch }).client),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe("PatientIntakeForm: Field Interaction", () => {
|
|
31
|
-
it("Find patient is find_patient's patientSearch: focus, one change, blur, and nothing typed", async () => {
|
|
32
|
-
renderPatientCard();
|
|
33
|
-
await typeInto("Find patient", "Zqxfirst Zqxlast");
|
|
34
|
-
|
|
35
|
-
await analytics.expectEventLog([
|
|
36
|
-
"Field Interaction patientSearch focus",
|
|
37
|
-
"Prescribe Workflow Viewed",
|
|
38
|
-
"Field Interaction patientSearch change",
|
|
39
|
-
"Field Interaction patientSearch blur",
|
|
40
|
-
]);
|
|
41
|
-
expect(analytics.sentFor("patientSearch")).toEqual([
|
|
42
|
-
expect.objectContaining({ formName: "find_patient", hasValue: false, isOptional: false }),
|
|
43
|
-
expect.objectContaining({ hasValue: true }),
|
|
44
|
-
expect.objectContaining({ hasValue: true, changed: true, durationMs: expect.any(Number) }),
|
|
45
|
-
]);
|
|
46
|
-
for (const body of analytics.bodies()) expect(body).not.toMatch(/Zqx/i);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("adding a patient: each field visited sends focus, one change and blur as new_patient_form", async () => {
|
|
50
|
-
renderPatientCard();
|
|
51
|
-
await typeInto("Find patient", "Zqxfirst Zqxlast");
|
|
52
|
-
await userEvent.click(await screen.findByRole("option", { name: /Add new patient/ }));
|
|
53
|
-
await typeInto("First name", "Zqxa");
|
|
54
|
-
await typeInto("Last name", "Zqxb");
|
|
55
|
-
await userEvent.click(screen.getByLabelText("Date of birth"));
|
|
56
|
-
fireEvent.change(screen.getByLabelText("Date of birth"), { target: { value: "1990-01-01" } });
|
|
57
|
-
leaveField();
|
|
58
|
-
await userEvent.selectOptions(screen.getByRole("combobox", { name: "Sex" }), "FEMALE");
|
|
59
|
-
leaveField();
|
|
60
|
-
await typeInto("Phone", "5555550100");
|
|
61
|
-
await typeInto("Email", "zqx@example.com");
|
|
62
|
-
|
|
63
|
-
await analytics.expectEventLog([
|
|
64
|
-
"Field Interaction patientSearch focus",
|
|
65
|
-
"Prescribe Workflow Viewed",
|
|
66
|
-
"Field Interaction patientSearch change",
|
|
67
|
-
"Field Interaction patientSearch blur",
|
|
68
|
-
...visitedWithoutEditing("firstName"),
|
|
69
|
-
...visitedWithoutEditing("sex"),
|
|
70
|
-
...edited("firstName"),
|
|
71
|
-
...edited("lastName"),
|
|
72
|
-
...edited("dateOfBirth"),
|
|
73
|
-
...edited("sex"),
|
|
74
|
-
...edited("phone"),
|
|
75
|
-
...edited("email"),
|
|
76
|
-
]);
|
|
77
|
-
const sent = analytics.fieldInteractions().filter((s) => s.fieldName !== "patientSearch");
|
|
78
|
-
expect(new Set(sent.map((s) => s.formName))).toEqual(new Set(["new_patient_form"]));
|
|
79
|
-
expect(Object.fromEntries(sent.map((s) => [s.fieldName, s.isOptional]))).toEqual({
|
|
80
|
-
firstName: false,
|
|
81
|
-
lastName: false,
|
|
82
|
-
dateOfBirth: false,
|
|
83
|
-
sex: false,
|
|
84
|
-
phone: true,
|
|
85
|
-
email: true,
|
|
86
|
-
});
|
|
87
|
-
for (const body of analytics.bodies()) expect(body).not.toMatch(/Zqx|1990|5555550100|FEMALE/i);
|
|
88
|
-
});
|
|
89
|
-
});
|