@kenyaemr/esm-patient-registration-app 6.0.1-pre.1.0.1 → 6.0.1-pre.1.0.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.
Files changed (51) hide show
  1. package/dist/130.js +1 -1
  2. package/dist/130.js.map +1 -1
  3. package/dist/481.js +1 -0
  4. package/dist/481.js.map +1 -0
  5. package/dist/574.js +1 -1
  6. package/dist/59.js +1 -1
  7. package/dist/59.js.map +1 -1
  8. package/dist/676.js +1 -0
  9. package/dist/676.js.map +1 -0
  10. package/dist/762.js +2 -0
  11. package/dist/{895.js.LICENSE.txt → 762.js.LICENSE.txt} +0 -7
  12. package/dist/762.js.map +1 -0
  13. package/dist/788.js +1 -1
  14. package/dist/816.js +1 -0
  15. package/dist/816.js.map +1 -0
  16. package/dist/kenyaemr-esm-patient-registration-app.js +1 -1
  17. package/dist/kenyaemr-esm-patient-registration-app.js.buildmanifest.json +95 -95
  18. package/dist/kenyaemr-esm-patient-registration-app.js.map +1 -1
  19. package/dist/main.js +1 -1
  20. package/dist/main.js.LICENSE.txt +0 -7
  21. package/dist/main.js.map +1 -1
  22. package/dist/routes.json +1 -1
  23. package/package.json +1 -4
  24. package/src/config-schema.ts +2 -11
  25. package/src/index.ts +2 -2
  26. package/src/patient-photo.extension.tsx +9 -0
  27. package/src/patient-registration/field/address/custom-address-field.component.tsx +1 -1
  28. package/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx +3 -0
  29. package/src/patient-registration/field/person-attributes/person-attribute-field.component.tsx +1 -0
  30. package/src/patient-registration/field/phone/phone-field.component.tsx +1 -1
  31. package/src/patient-registration/form-manager.ts +4 -2
  32. package/src/patient-registration/patient-registration.component.tsx +8 -2
  33. package/src/patient-registration/patient-registration.resource.ts +1 -47
  34. package/src/patient-registration/patient-registration.test.tsx +0 -9
  35. package/src/patient-verification/patient-verification-hook.tsx +5 -5
  36. package/src/patient-verification/patient-verification-utils.ts +4 -4
  37. package/src/patient-verification/patient-verification.component.tsx +14 -7
  38. package/src/patient-verification/verification-modal/confirm-prompt.component.tsx +2 -2
  39. package/src/routes.json +1 -1
  40. package/translations/en.json +2 -2
  41. package/dist/619.js +0 -1
  42. package/dist/619.js.map +0 -1
  43. package/dist/62.js +0 -1
  44. package/dist/62.js.map +0 -1
  45. package/dist/840.js +0 -1
  46. package/dist/840.js.map +0 -1
  47. package/dist/895.js +0 -2
  48. package/dist/895.js.map +0 -1
  49. package/src/patient-registration/field/person-attributes/coded-attributes.component.tsx +0 -60
  50. package/src/widgets/display-photo.component.tsx +0 -30
  51. package/src/widgets/display-photo.test.tsx +0 -37
@@ -1,60 +0,0 @@
1
- import React from 'react';
2
- import classNames from 'classnames';
3
- import { Layer, Select, SelectItem } from '@carbon/react';
4
- import { useConfig } from '@openmrs/esm-framework';
5
- import { Input } from '../../input/basic-input/input/input.component';
6
- import { type CodedPersonAttributeConfig } from '../../patient-registration.types';
7
- import { useConceptAnswers } from '../field.resource';
8
- import { usePersonAttributeType } from './person-attributes.resource';
9
- import styles from './../field.scss';
10
-
11
- export interface CodedAttributesFieldProps {}
12
-
13
- export const CodedAttributesField: React.FC<CodedAttributesFieldProps> = () => {
14
- const { codedPersonAttributes } = useConfig();
15
-
16
- return codedPersonAttributes?.length ? (
17
- <div>
18
- {codedPersonAttributes.map((personAttributeType: CodedPersonAttributeConfig, ind) => (
19
- <PersonAttributeField
20
- key={ind}
21
- personAttributeTypeUuid={personAttributeType.personAttributeUuid}
22
- conceptUuid={personAttributeType.conceptUuid}
23
- />
24
- ))}
25
- </div>
26
- ) : null;
27
- };
28
-
29
- interface PersonAttributeFieldProps {
30
- personAttributeTypeUuid: string;
31
- conceptUuid: string;
32
- }
33
-
34
- const PersonAttributeField: React.FC<PersonAttributeFieldProps> = ({ personAttributeTypeUuid, conceptUuid }) => {
35
- const { data: personAttributeType, isLoading } = usePersonAttributeType(personAttributeTypeUuid);
36
- const { data: conceptAnswers, isLoading: isLoadingConceptAnswers } = useConceptAnswers(conceptUuid);
37
-
38
- return !isLoading ? (
39
- <div className={classNames(styles.attributeField, styles.halfWidthInDesktopView)}>
40
- {!isLoadingConceptAnswers && conceptAnswers?.length ? (
41
- <Layer>
42
- <Select
43
- id={`person-attribute-${personAttributeTypeUuid}`}
44
- name={`attributes.${personAttributeTypeUuid}`}
45
- labelText={personAttributeType?.display}>
46
- {conceptAnswers.map((answer) => (
47
- <SelectItem key={answer.uuid} value={answer.uuid} text={answer.display} />
48
- ))}
49
- </Select>
50
- </Layer>
51
- ) : (
52
- <Input
53
- id={`person-attribute-${personAttributeTypeUuid}`}
54
- labelText={personAttributeType?.display}
55
- name={`attributes.${personAttributeTypeUuid}`}
56
- />
57
- )}
58
- </div>
59
- ) : null;
60
- };
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import Avatar from 'react-avatar';
3
- import GeoPattern from 'geopattern';
4
- import { usePatientPhoto } from '../patient-registration/patient-registration.resource';
5
-
6
- interface DisplayPatientPhotoProps {
7
- patientName: string;
8
- patientUuid: string;
9
- size?: string;
10
- }
11
-
12
- export default function DisplayPatientPhoto({ patientUuid, patientName, size }: DisplayPatientPhotoProps) {
13
- const { data: photo } = usePatientPhoto(patientUuid);
14
- const patternUrl: string = GeoPattern.generate(patientUuid).toDataUri();
15
-
16
- return (
17
- <Avatar
18
- alt={`${patientName ? `${patientName}'s avatar` : 'Patient avatar'}`}
19
- color="rgba(0,0,0,0)"
20
- name={patientName}
21
- src={photo?.imageSrc}
22
- size={size === 'small' ? '48' : '80'}
23
- textSizeRatio={size === 'small' ? 1 : 2}
24
- style={{
25
- backgroundImage: `url(${patternUrl})`,
26
- backgroundRepeat: 'round',
27
- }}
28
- />
29
- );
30
- }
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import { mockPatient } from '__mocks__';
4
- import DisplayPatientPhoto from './display-photo.component';
5
-
6
- jest.mock('../patient-registration/patient-registration.resource', () => ({
7
- usePatientPhoto: jest.fn().mockReturnValue({ data: { imageSrc: 'test-image-src' } }),
8
- }));
9
-
10
- jest.mock('geopattern', () => ({
11
- generate: jest.fn().mockReturnValue({
12
- toDataUri: jest.fn().mockReturnValue('https://example.com'),
13
- }),
14
- }));
15
-
16
- const patientUuid = mockPatient.uuid;
17
- const patientName = mockPatient.name;
18
-
19
- describe('DisplayPatientPhoto Component', () => {
20
- it('should render the component with the patient photo and size should not be small', () => {
21
- render(<DisplayPatientPhoto patientUuid={patientUuid} patientName={patientName} />);
22
-
23
- const avatarImage = screen.getByTitle(`${patientName}`);
24
-
25
- expect(avatarImage).toBeInTheDocument();
26
- expect(avatarImage).toHaveAttribute('style', expect.stringContaining('width: 80px; height: 80px'));
27
- });
28
-
29
- it('should render the component with the patient photo and size should be small i.e. 48px', () => {
30
- render(<DisplayPatientPhoto patientUuid={patientUuid} patientName={patientName} size="small" />);
31
-
32
- const avatarImage = screen.getByTitle(`${patientName}`);
33
-
34
- expect(avatarImage).toBeInTheDocument();
35
- expect(avatarImage).toHaveAttribute('style', expect.stringContaining('width: 48px; height: 48px'));
36
- });
37
- });