@openmrs/esm-framework 6.3.1-pre.2965 → 6.3.1-pre.2997
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/.turbo/turbo-build.log +3 -25
- package/dist/index.d.ts +17 -0
- package/dist/internal.d.ts +17 -0
- package/dist/openmrs-esm-framework.js +1 -2
- package/dist/openmrs-esm-framework.js.map +1 -1
- package/docs/API.md +356 -280
- package/docs/classes/OpenmrsFetchError.md +10 -10
- package/docs/enums/VisitMode.md +3 -3
- package/docs/enums/VisitStatus.md +2 -2
- package/docs/interfaces/AssignedExtension.md +1 -1
- package/docs/interfaces/Attachment.md +7 -7
- package/docs/interfaces/AttachmentResponse.md +6 -6
- package/docs/interfaces/CloseWorkspaceOptions.md +3 -3
- package/docs/interfaces/ConfigurableLinkProps.md +474 -317
- package/docs/interfaces/ConnectedExtension.md +1 -1
- package/docs/interfaces/ConnectivityChangedEvent.md +1 -1
- package/docs/interfaces/CurrentPatientOptions.md +1 -1
- package/docs/interfaces/DefaultWorkspaceProps.md +4 -4
- package/docs/interfaces/Diagnosis.md +25 -25
- package/docs/interfaces/EmrApiConfigurationResponse.md +596 -0
- package/docs/interfaces/Encounter.md +24 -24
- package/docs/interfaces/EncounterProvider.md +16 -16
- package/docs/interfaces/EncounterRole.md +16 -16
- package/docs/interfaces/EncounterType.md +16 -16
- package/docs/interfaces/ExtensionSlotBaseProps.md +3 -3
- package/docs/interfaces/FHIRCode.md +3 -3
- package/docs/interfaces/FHIRLocationResource.md +30 -0
- package/docs/interfaces/FHIRResource.md +1 -1
- package/docs/interfaces/FeatureFlagDefinition.md +3 -3
- package/docs/interfaces/FetchConfig.md +13 -13
- package/docs/interfaces/FetchError.md +2 -2
- package/docs/interfaces/FetchResponse.md +15 -15
- package/docs/interfaces/ImportMap.md +1 -1
- package/docs/interfaces/Location.md +370 -3
- package/docs/interfaces/LoggedInUserFetchResponse.md +15 -15
- package/docs/interfaces/NewVisitPayload.md +7 -7
- package/docs/interfaces/NotificationDescriptor.md +20 -2
- package/docs/interfaces/Obs.md +36 -36
- package/docs/interfaces/OldExtensionSlotBaseProps.md +3 -3
- package/docs/interfaces/OnlyThePatient.md +1 -1
- package/docs/interfaces/OpenWorkspace.md +29 -29
- package/docs/interfaces/OpenmrsAppRoutes.md +9 -9
- package/docs/interfaces/OpenmrsDatePickerProps.md +1 -1
- package/docs/interfaces/OpenmrsResource.md +0 -12
- package/docs/interfaces/OpenmrsResourceStrict.md +0 -6
- package/docs/interfaces/Patient.md +17 -17
- package/docs/interfaces/PatientIdentifier.md +18 -18
- package/docs/interfaces/PatientIdentifierType.md +22 -22
- package/docs/interfaces/PatientPhotoProps.md +0 -11
- package/docs/interfaces/PatientWithFullResponse.md +1 -1
- package/docs/interfaces/Prompt.md +5 -5
- package/docs/interfaces/ResourceLoader.md +1 -1
- package/docs/interfaces/RetryOptions.md +3 -3
- package/docs/interfaces/ShowActionableNotificationEvent.md +6 -6
- package/docs/interfaces/ShowNotificationEvent.md +5 -5
- package/docs/interfaces/ShowSnackbarEvent.md +8 -8
- package/docs/interfaces/ShowToastEvent.md +5 -5
- package/docs/interfaces/SpaConfig.md +5 -5
- package/docs/interfaces/StyleguideConfigObject.md +2 -2
- package/docs/interfaces/UploadedFile.md +7 -7
- package/docs/interfaces/UseConfigOptions.md +22 -0
- package/docs/interfaces/UseServerFetchAllOptions.md +5 -5
- package/docs/interfaces/UseServerInfiniteOptions.md +5 -5
- package/docs/interfaces/UseServerPaginationOptions.md +2 -2
- package/docs/interfaces/Visit.md +11 -11
- package/docs/interfaces/VisitItem.md +4 -4
- package/docs/interfaces/VisitReturnType.md +2 -2
- package/docs/interfaces/VisitStoreState.md +3 -3
- package/docs/interfaces/VisitType.md +3 -3
- package/docs/interfaces/WorkspaceGroupDefinition.md +2 -2
- package/docs/interfaces/WorkspaceRegistration.md +0 -6
- package/docs/interfaces/WorkspacesInfo.md +5 -5
- package/mock-jest.tsx +125 -0
- package/mock.tsx +44 -42
- package/package.json +58 -31
- package/rspack.config.cjs +96 -0
- package/{src/integration-tests/setup-tests.ts → setup-tests.ts} +6 -1
- package/src/declarations.d.ts +0 -1
- package/src/index.ts +2 -3
- package/src/integration-tests/extension-config.test.tsx +14 -12
- package/src/internal.ts +2 -3
- package/src/mock-test.test.ts +2 -2
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +3 -24
- package/typedoc.json +1 -0
- package/vitest.config.ts +9 -0
- package/dist/278.openmrs-esm-framework.js +0 -2
- package/dist/278.openmrs-esm-framework.js.map +0 -1
- package/dist/530.openmrs-esm-framework.js +0 -2
- package/dist/530.openmrs-esm-framework.js.map +0 -1
- package/dist/588.openmrs-esm-framework.js +0 -2
- package/dist/588.openmrs-esm-framework.js.map +0 -1
- package/dist/619.openmrs-esm-framework.js +0 -2
- package/dist/619.openmrs-esm-framework.js.map +0 -1
- package/dist/645.openmrs-esm-framework.js +0 -2
- package/dist/645.openmrs-esm-framework.js.map +0 -1
- package/dist/735.openmrs-esm-framework.js +0 -3
- package/dist/735.openmrs-esm-framework.js.LICENSE.txt +0 -9
- package/dist/735.openmrs-esm-framework.js.map +0 -1
- package/dist/746.openmrs-esm-framework.js +0 -2
- package/dist/746.openmrs-esm-framework.js.map +0 -1
- package/dist/788.openmrs-esm-framework.js +0 -3
- package/dist/788.openmrs-esm-framework.js.LICENSE.txt +0 -19
- package/dist/788.openmrs-esm-framework.js.map +0 -1
- package/dist/openmrs-esm-framework.js.LICENSE.txt +0 -68
- package/jest.config.js +0 -22
- package/webpack.config.js +0 -80
@@ -37,7 +37,7 @@ This should be the counterpart of using useSWRImmutable` for `useSWRInfinite`
|
|
37
37
|
|
38
38
|
#### Defined in
|
39
39
|
|
40
|
-
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:
|
40
|
+
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:25](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts#L25)
|
41
41
|
|
42
42
|
___
|
43
43
|
|
@@ -47,13 +47,13 @@ ___
|
|
47
47
|
|
48
48
|
#### Defined in
|
49
49
|
|
50
|
-
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:
|
50
|
+
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:27](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts#L27)
|
51
51
|
|
52
52
|
## UI Methods
|
53
53
|
|
54
54
|
### fetcher
|
55
55
|
|
56
|
-
▸ `Optional` **fetcher**(`key`): `Promise
|
56
|
+
▸ `Optional` **fetcher**(`key`): `Promise`<`FetchResponse`<`R`\>\>
|
57
57
|
|
58
58
|
The fetcher to use. Defaults to openmrsFetch
|
59
59
|
|
@@ -65,8 +65,8 @@ The fetcher to use. Defaults to openmrsFetch
|
|
65
65
|
|
66
66
|
#### Returns
|
67
67
|
|
68
|
-
`Promise
|
68
|
+
`Promise`<`FetchResponse`<`R`\>\>
|
69
69
|
|
70
70
|
#### Defined in
|
71
71
|
|
72
|
-
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:
|
72
|
+
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:18](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts#L18)
|
@@ -47,7 +47,7 @@ The configuration object for useSWR or useSWRInfinite
|
|
47
47
|
|
48
48
|
### fetcher
|
49
49
|
|
50
|
-
▸ `Optional` **fetcher**(`key`): `Promise
|
50
|
+
▸ `Optional` **fetcher**(`key`): `Promise`<`FetchResponse`<`R`\>\>
|
51
51
|
|
52
52
|
The fetcher to use. Defaults to openmrsFetch
|
53
53
|
|
@@ -59,7 +59,7 @@ The fetcher to use. Defaults to openmrsFetch
|
|
59
59
|
|
60
60
|
#### Returns
|
61
61
|
|
62
|
-
`Promise
|
62
|
+
`Promise`<`FetchResponse`<`R`\>\>
|
63
63
|
|
64
64
|
#### Defined in
|
65
65
|
|
package/docs/interfaces/Visit.md
CHANGED
@@ -24,11 +24,11 @@
|
|
24
24
|
|
25
25
|
### attributes
|
26
26
|
|
27
|
-
• `Optional` **attributes**:
|
27
|
+
• `Optional` **attributes**: `OpenmrsResource`[]
|
28
28
|
|
29
29
|
#### Defined in
|
30
30
|
|
31
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:29](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L29)
|
31
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:29](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L29)
|
32
32
|
|
33
33
|
___
|
34
34
|
|
@@ -38,7 +38,7 @@ ___
|
|
38
38
|
|
39
39
|
#### Defined in
|
40
40
|
|
41
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:22](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L22)
|
41
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:22](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L22)
|
42
42
|
|
43
43
|
___
|
44
44
|
|
@@ -48,17 +48,17 @@ ___
|
|
48
48
|
|
49
49
|
#### Defined in
|
50
50
|
|
51
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:23](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L23)
|
51
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:23](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L23)
|
52
52
|
|
53
53
|
___
|
54
54
|
|
55
55
|
### location
|
56
56
|
|
57
|
-
• `Optional` **location**:
|
57
|
+
• `Optional` **location**: `Location`
|
58
58
|
|
59
59
|
#### Defined in
|
60
60
|
|
61
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:26](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L26)
|
61
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:26](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L26)
|
62
62
|
|
63
63
|
___
|
64
64
|
|
@@ -68,7 +68,7 @@ ___
|
|
68
68
|
|
69
69
|
#### Defined in
|
70
70
|
|
71
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:24](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L24)
|
71
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:24](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L24)
|
72
72
|
|
73
73
|
___
|
74
74
|
|
@@ -78,7 +78,7 @@ ___
|
|
78
78
|
|
79
79
|
#### Defined in
|
80
80
|
|
81
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:27](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L27)
|
81
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:27](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L27)
|
82
82
|
|
83
83
|
___
|
84
84
|
|
@@ -88,7 +88,7 @@ ___
|
|
88
88
|
|
89
89
|
#### Defined in
|
90
90
|
|
91
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:28](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L28)
|
91
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:28](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L28)
|
92
92
|
|
93
93
|
___
|
94
94
|
|
@@ -98,7 +98,7 @@ ___
|
|
98
98
|
|
99
99
|
#### Defined in
|
100
100
|
|
101
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:21](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L21)
|
101
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:21](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L21)
|
102
102
|
|
103
103
|
___
|
104
104
|
|
@@ -108,4 +108,4 @@ ___
|
|
108
108
|
|
109
109
|
#### Defined in
|
110
110
|
|
111
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:25](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L25)
|
111
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:25](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L25)
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
#### Defined in
|
21
21
|
|
22
|
-
[packages/framework/esm-api/src/
|
22
|
+
[packages/framework/esm-emr-api/src/visit-utils.ts:11](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/visit-utils.ts#L11)
|
23
23
|
|
24
24
|
___
|
25
25
|
|
@@ -29,7 +29,7 @@ ___
|
|
29
29
|
|
30
30
|
#### Defined in
|
31
31
|
|
32
|
-
[packages/framework/esm-api/src/
|
32
|
+
[packages/framework/esm-emr-api/src/visit-utils.ts:8](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/visit-utils.ts#L8)
|
33
33
|
|
34
34
|
___
|
35
35
|
|
@@ -39,7 +39,7 @@ ___
|
|
39
39
|
|
40
40
|
#### Defined in
|
41
41
|
|
42
|
-
[packages/framework/esm-api/src/
|
42
|
+
[packages/framework/esm-emr-api/src/visit-utils.ts:10](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/visit-utils.ts#L10)
|
43
43
|
|
44
44
|
___
|
45
45
|
|
@@ -49,4 +49,4 @@ ___
|
|
49
49
|
|
50
50
|
#### Defined in
|
51
51
|
|
52
|
-
[packages/framework/esm-api/src/
|
52
|
+
[packages/framework/esm-emr-api/src/visit-utils.ts:9](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/visit-utils.ts#L9)
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
### activeVisit
|
23
23
|
|
24
|
-
• **activeVisit**: ``null`` \|
|
24
|
+
• **activeVisit**: ``null`` \| `Visit`
|
25
25
|
|
26
26
|
#### Defined in
|
27
27
|
|
@@ -31,7 +31,7 @@ ___
|
|
31
31
|
|
32
32
|
### currentVisit
|
33
33
|
|
34
|
-
• **currentVisit**: ``null`` \|
|
34
|
+
• **currentVisit**: ``null`` \| `Visit`
|
35
35
|
|
36
36
|
#### Defined in
|
37
37
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#### Defined in
|
20
20
|
|
21
|
-
[packages/framework/esm-api/src/
|
21
|
+
[packages/framework/esm-emr-api/src/visit-utils.ts:27](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/visit-utils.ts#L27)
|
22
22
|
|
23
23
|
___
|
24
24
|
|
@@ -36,7 +36,7 @@ by unique component IDs.
|
|
36
36
|
|
37
37
|
#### Defined in
|
38
38
|
|
39
|
-
[packages/framework/esm-api/src/
|
39
|
+
[packages/framework/esm-emr-api/src/visit-utils.ts:34](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/visit-utils.ts#L34)
|
40
40
|
|
41
41
|
___
|
42
42
|
|
@@ -46,4 +46,4 @@ ___
|
|
46
46
|
|
47
47
|
#### Defined in
|
48
48
|
|
49
|
-
[packages/framework/esm-api/src/
|
49
|
+
[packages/framework/esm-emr-api/src/visit-utils.ts:26](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/visit-utils.ts#L26)
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#### Defined in
|
20
20
|
|
21
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:41](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L41)
|
21
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:41](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L41)
|
22
22
|
|
23
23
|
___
|
24
24
|
|
@@ -28,7 +28,7 @@ ___
|
|
28
28
|
|
29
29
|
#### Defined in
|
30
30
|
|
31
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:42](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L42)
|
31
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:42](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L42)
|
32
32
|
|
33
33
|
___
|
34
34
|
|
@@ -38,4 +38,4 @@ ___
|
|
38
38
|
|
39
39
|
#### Defined in
|
40
40
|
|
41
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:40](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/types/visit-resource.ts#L40)
|
41
|
+
[packages/framework/esm-emr-api/src/types/visit-resource.ts:40](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-emr-api/src/types/visit-resource.ts#L40)
|
@@ -19,7 +19,7 @@ List of workspace names which are part of the workspace group.
|
|
19
19
|
|
20
20
|
#### Defined in
|
21
21
|
|
22
|
-
|
22
|
+
packages/framework/esm-globals/dist/types.d.ts:342
|
23
23
|
|
24
24
|
___
|
25
25
|
|
@@ -31,4 +31,4 @@ Name of the workspace group. This is used to launch the workspace group
|
|
31
31
|
|
32
32
|
#### Defined in
|
33
33
|
|
34
|
-
|
34
|
+
packages/framework/esm-globals/dist/types.d.ts:338
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
#### Defined in
|
22
22
|
|
23
|
-
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:
|
23
|
+
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:536](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/workspaces.ts#L536)
|
24
24
|
|
25
25
|
___
|
26
26
|
|
@@ -30,7 +30,7 @@ ___
|
|
30
30
|
|
31
31
|
#### Defined in
|
32
32
|
|
33
|
-
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:
|
33
|
+
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:537](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/workspaces.ts#L537)
|
34
34
|
|
35
35
|
___
|
36
36
|
|
@@ -48,7 +48,7 @@ ___
|
|
48
48
|
|
49
49
|
#### Defined in
|
50
50
|
|
51
|
-
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:
|
51
|
+
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:540](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/workspaces.ts#L540)
|
52
52
|
|
53
53
|
___
|
54
54
|
|
@@ -58,7 +58,7 @@ ___
|
|
58
58
|
|
59
59
|
#### Defined in
|
60
60
|
|
61
|
-
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:
|
61
|
+
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:538](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/workspaces.ts#L538)
|
62
62
|
|
63
63
|
___
|
64
64
|
|
@@ -68,4 +68,4 @@ ___
|
|
68
68
|
|
69
69
|
#### Defined in
|
70
70
|
|
71
|
-
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:
|
71
|
+
[packages/framework/esm-styleguide/src/workspaces/workspaces.ts:539](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/workspaces.ts#L539)
|
package/mock-jest.tsx
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { NEVER } from 'rxjs';
|
3
|
+
import type {} from '@openmrs/esm-globals';
|
4
|
+
import * as utils from '@openmrs/esm-utils';
|
5
|
+
import dayjs from 'dayjs';
|
6
|
+
|
7
|
+
window.i18next = { ...window.i18next, language: 'en' };
|
8
|
+
|
9
|
+
export * from '@openmrs/esm-api/mock';
|
10
|
+
export * from '@openmrs/esm-emr-api/mock';
|
11
|
+
export * from '@openmrs/esm-config/mock';
|
12
|
+
export * from '@openmrs/esm-context';
|
13
|
+
export * from '@openmrs/esm-expression-evaluator/src/public';
|
14
|
+
export * from '@openmrs/esm-extensions/mock';
|
15
|
+
export * from '@openmrs/esm-react-utils/mock';
|
16
|
+
export * from '@openmrs/esm-state/mock';
|
17
|
+
export * from '@openmrs/esm-styleguide/mock';
|
18
|
+
export * from '@openmrs/esm-translations/mock';
|
19
|
+
|
20
|
+
export { parseDate, formatDate, formatDatetime, formatTime } from '@openmrs/esm-utils';
|
21
|
+
|
22
|
+
/* esm-globals */
|
23
|
+
|
24
|
+
export function setupPaths(config: any) {
|
25
|
+
window.openmrsBase = config.apiUrl;
|
26
|
+
window.spaBase = config.spaPath;
|
27
|
+
window.spaEnv = config.env || 'production';
|
28
|
+
window.spaVersion = process.env.BUILD_VERSION ?? 'local';
|
29
|
+
window.getOpenmrsSpaBase = () => `${window.spaBase}/`;
|
30
|
+
}
|
31
|
+
|
32
|
+
/* esm-dynamic-loading */
|
33
|
+
export const importDynamic = jest.fn();
|
34
|
+
|
35
|
+
/* esm-error-handling */
|
36
|
+
export const createErrorHandler = () => jest.fn().mockReturnValue(NEVER);
|
37
|
+
|
38
|
+
export const reportError = jest.fn().mockImplementation((error) => {
|
39
|
+
throw error;
|
40
|
+
});
|
41
|
+
|
42
|
+
/* esm-feature-flags */
|
43
|
+
export const registerFeatureFlags = jest.fn();
|
44
|
+
export const getFeatureFlag = jest.fn().mockReturnValue(true);
|
45
|
+
export const subscribeToFeatureFlag = jest.fn((name: string, callback) => callback(true));
|
46
|
+
|
47
|
+
/* esm-navigation */
|
48
|
+
export { interpolateUrl, interpolateString } from '@openmrs/esm-navigation';
|
49
|
+
export const navigate = jest.fn();
|
50
|
+
export const getHistory = jest.fn(() => ['https://o3.openmrs.org/home']);
|
51
|
+
export const clearHistory = jest.fn();
|
52
|
+
export const goBackInHistory = jest.fn();
|
53
|
+
|
54
|
+
/* esm-offline */
|
55
|
+
export const useConnectivity = jest.fn().mockReturnValue(true);
|
56
|
+
export const subscribeConnectivity = jest.fn();
|
57
|
+
|
58
|
+
/* esm-styleguide */
|
59
|
+
export const showNotification = jest.fn();
|
60
|
+
export const showActionableNotification = jest.fn();
|
61
|
+
export const showToast = jest.fn();
|
62
|
+
export const showSnackbar = jest.fn();
|
63
|
+
export const showModal = jest.fn();
|
64
|
+
|
65
|
+
export const LeftNavMenu = jest.fn(() => <div>Left Nav Menu</div>);
|
66
|
+
export const setLeftNav = jest.fn();
|
67
|
+
export const unsetLeftNav = jest.fn();
|
68
|
+
export const ResponsiveWrapper = jest.fn(({ children }) => <>{children}</>);
|
69
|
+
export const ErrorState = jest.fn(() => <div>Error State</div>);
|
70
|
+
|
71
|
+
export const CustomOverflowMenu = jest.fn(({ menuTitle, children }) => (
|
72
|
+
<div>
|
73
|
+
<button>{menuTitle}</button>
|
74
|
+
{children}
|
75
|
+
</div>
|
76
|
+
));
|
77
|
+
export const PatientBannerActionsMenu = jest.fn(() => <div>Patient Banner Actions Menu</div>);
|
78
|
+
export const PatientBannerContactDetails = jest.fn(() => <div>Patient Banner Contact Details</div>);
|
79
|
+
export const PatientBannerPatientInfo = jest.fn(() => <div>Patient Banner Patient Info</div>);
|
80
|
+
export const PatientBannerPatientIdentifiers = jest.fn(() => <div>Patient Banner Patient Identifier</div>);
|
81
|
+
export const PatientBannerToggleContactDetailsButton = jest.fn(() => (
|
82
|
+
<div>Patient Banner Toggle Contact Details Button</div>
|
83
|
+
));
|
84
|
+
export const PatientPhoto = jest.fn(() => <div>Patient Photo</div>);
|
85
|
+
export const usePatientPhoto = jest.fn(() => ({
|
86
|
+
isLoading: true,
|
87
|
+
data: null,
|
88
|
+
error: null,
|
89
|
+
}));
|
90
|
+
|
91
|
+
export const ActionMenuButton = jest.fn(({ handler }) => <button onClick={handler}>Action Menu Button</button>);
|
92
|
+
export const ActionMenu = jest.fn(() => <div>Action Menu</div>);
|
93
|
+
export const WorkspaceContainer = jest.fn(() => <div>Workspace Container</div>);
|
94
|
+
export const closeWorkspace = jest.fn();
|
95
|
+
export const launchWorkspace = jest.fn();
|
96
|
+
export const launchWorkspaceGroup = jest.fn();
|
97
|
+
export const navigateAndLaunchWorkspace = jest.fn();
|
98
|
+
export const useWorkspaces = jest.fn();
|
99
|
+
|
100
|
+
export const OpenmrsDatePicker = jest.fn(({ id, labelText, value, onChange, isInvalid, invalidText }) => (
|
101
|
+
<>
|
102
|
+
<label htmlFor={id}>{labelText}</label>
|
103
|
+
<input
|
104
|
+
id={id}
|
105
|
+
type="text"
|
106
|
+
value={value ? dayjs(value).format('DD/MM/YYYY') : ''}
|
107
|
+
onChange={(evt) => onChange?.(dayjs(evt.target.value).toDate())}
|
108
|
+
/>
|
109
|
+
{isInvalid && <span>{invalidText}</span>}
|
110
|
+
</>
|
111
|
+
));
|
112
|
+
|
113
|
+
/* esm-utils */
|
114
|
+
export {
|
115
|
+
getDefaultsFromConfigSchema,
|
116
|
+
getPatientName,
|
117
|
+
formatPatientName,
|
118
|
+
selectPreferredName,
|
119
|
+
} from '@openmrs/esm-utils';
|
120
|
+
|
121
|
+
export const age = jest.fn((arg) => utils.age(arg));
|
122
|
+
|
123
|
+
export function isVersionSatisfied() {
|
124
|
+
return true;
|
125
|
+
}
|
package/mock.tsx
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { vi } from 'vitest';
|
2
3
|
import { NEVER } from 'rxjs';
|
3
4
|
import type {} from '@openmrs/esm-globals';
|
4
5
|
import * as utils from '@openmrs/esm-utils';
|
@@ -7,6 +8,7 @@ import dayjs from 'dayjs';
|
|
7
8
|
window.i18next = { ...window.i18next, language: 'en' };
|
8
9
|
|
9
10
|
export * from '@openmrs/esm-api/mock';
|
11
|
+
export * from '@openmrs/esm-emr-api/mock';
|
10
12
|
export * from '@openmrs/esm-config/mock';
|
11
13
|
export * from '@openmrs/esm-context';
|
12
14
|
export * from '@openmrs/esm-expression-evaluator/src/public';
|
@@ -29,74 +31,74 @@ export function setupPaths(config: any) {
|
|
29
31
|
}
|
30
32
|
|
31
33
|
/* esm-dynamic-loading */
|
32
|
-
export const importDynamic =
|
34
|
+
export const importDynamic = vi.fn();
|
33
35
|
|
34
36
|
/* esm-error-handling */
|
35
|
-
export const createErrorHandler = () =>
|
37
|
+
export const createErrorHandler = () => vi.fn().mockReturnValue(NEVER);
|
36
38
|
|
37
|
-
export const reportError =
|
39
|
+
export const reportError = vi.fn().mockImplementation((error) => {
|
38
40
|
throw error;
|
39
41
|
});
|
40
42
|
|
41
43
|
/* esm-feature-flags */
|
42
|
-
export const registerFeatureFlags =
|
43
|
-
export const getFeatureFlag =
|
44
|
-
export const subscribeToFeatureFlag =
|
44
|
+
export const registerFeatureFlags = vi.fn();
|
45
|
+
export const getFeatureFlag = vi.fn().mockReturnValue(true);
|
46
|
+
export const subscribeToFeatureFlag = vi.fn((name: string, callback) => callback(true));
|
45
47
|
|
46
48
|
/* esm-navigation */
|
47
49
|
export { interpolateUrl, interpolateString } from '@openmrs/esm-navigation';
|
48
|
-
export const navigate =
|
49
|
-
export const getHistory =
|
50
|
-
export const clearHistory =
|
51
|
-
export const goBackInHistory =
|
50
|
+
export const navigate = vi.fn();
|
51
|
+
export const getHistory = vi.fn(() => ['https://o3.openmrs.org/home']);
|
52
|
+
export const clearHistory = vi.fn();
|
53
|
+
export const goBackInHistory = vi.fn();
|
52
54
|
|
53
55
|
/* esm-offline */
|
54
|
-
export const useConnectivity =
|
55
|
-
export const subscribeConnectivity =
|
56
|
+
export const useConnectivity = vi.fn().mockReturnValue(true);
|
57
|
+
export const subscribeConnectivity = vi.fn();
|
56
58
|
|
57
59
|
/* esm-styleguide */
|
58
|
-
export const showNotification =
|
59
|
-
export const showActionableNotification =
|
60
|
-
export const showToast =
|
61
|
-
export const showSnackbar =
|
62
|
-
export const showModal =
|
63
|
-
|
64
|
-
export const LeftNavMenu =
|
65
|
-
export const setLeftNav =
|
66
|
-
export const unsetLeftNav =
|
67
|
-
export const ResponsiveWrapper =
|
68
|
-
export const ErrorState =
|
69
|
-
|
70
|
-
export const CustomOverflowMenu =
|
60
|
+
export const showNotification = vi.fn();
|
61
|
+
export const showActionableNotification = vi.fn();
|
62
|
+
export const showToast = vi.fn();
|
63
|
+
export const showSnackbar = vi.fn();
|
64
|
+
export const showModal = vi.fn();
|
65
|
+
|
66
|
+
export const LeftNavMenu = vi.fn(() => <div>Left Nav Menu</div>);
|
67
|
+
export const setLeftNav = vi.fn();
|
68
|
+
export const unsetLeftNav = vi.fn();
|
69
|
+
export const ResponsiveWrapper = vi.fn(({ children }) => <>{children}</>);
|
70
|
+
export const ErrorState = vi.fn(() => <div>Error State</div>);
|
71
|
+
|
72
|
+
export const CustomOverflowMenu = vi.fn(({ menuTitle, children }) => (
|
71
73
|
<div>
|
72
74
|
<button>{menuTitle}</button>
|
73
75
|
{children}
|
74
76
|
</div>
|
75
77
|
));
|
76
|
-
export const PatientBannerActionsMenu =
|
77
|
-
export const PatientBannerContactDetails =
|
78
|
-
export const PatientBannerPatientInfo =
|
79
|
-
export const PatientBannerPatientIdentifiers =
|
80
|
-
export const PatientBannerToggleContactDetailsButton =
|
78
|
+
export const PatientBannerActionsMenu = vi.fn(() => <div>Patient Banner Actions Menu</div>);
|
79
|
+
export const PatientBannerContactDetails = vi.fn(() => <div>Patient Banner Contact Details</div>);
|
80
|
+
export const PatientBannerPatientInfo = vi.fn(() => <div>Patient Banner Patient Info</div>);
|
81
|
+
export const PatientBannerPatientIdentifiers = vi.fn(() => <div>Patient Banner Patient Identifier</div>);
|
82
|
+
export const PatientBannerToggleContactDetailsButton = vi.fn(() => (
|
81
83
|
<div>Patient Banner Toggle Contact Details Button</div>
|
82
84
|
));
|
83
|
-
export const PatientPhoto =
|
84
|
-
export const usePatientPhoto =
|
85
|
+
export const PatientPhoto = vi.fn(() => <div>Patient Photo</div>);
|
86
|
+
export const usePatientPhoto = vi.fn(() => ({
|
85
87
|
isLoading: true,
|
86
88
|
data: null,
|
87
89
|
error: null,
|
88
90
|
}));
|
89
91
|
|
90
|
-
export const ActionMenuButton =
|
91
|
-
export const ActionMenu =
|
92
|
-
export const WorkspaceContainer =
|
93
|
-
export const closeWorkspace =
|
94
|
-
export const launchWorkspace =
|
95
|
-
export const launchWorkspaceGroup =
|
96
|
-
export const navigateAndLaunchWorkspace =
|
97
|
-
export const useWorkspaces =
|
92
|
+
export const ActionMenuButton = vi.fn(({ handler }) => <button onClick={handler}>Action Menu Button</button>);
|
93
|
+
export const ActionMenu = vi.fn(() => <div>Action Menu</div>);
|
94
|
+
export const WorkspaceContainer = vi.fn(() => <div>Workspace Container</div>);
|
95
|
+
export const closeWorkspace = vi.fn();
|
96
|
+
export const launchWorkspace = vi.fn();
|
97
|
+
export const launchWorkspaceGroup = vi.fn();
|
98
|
+
export const navigateAndLaunchWorkspace = vi.fn();
|
99
|
+
export const useWorkspaces = vi.fn();
|
98
100
|
|
99
|
-
export const OpenmrsDatePicker =
|
101
|
+
export const OpenmrsDatePicker = vi.fn(({ id, labelText, value, onChange, isInvalid, invalidText }) => (
|
100
102
|
<>
|
101
103
|
<label htmlFor={id}>{labelText}</label>
|
102
104
|
<input
|
@@ -117,7 +119,7 @@ export {
|
|
117
119
|
selectPreferredName,
|
118
120
|
} from '@openmrs/esm-utils';
|
119
121
|
|
120
|
-
export const age =
|
122
|
+
export const age = vi.fn((arg) => utils.age(arg));
|
121
123
|
|
122
124
|
export function isVersionSatisfied() {
|
123
125
|
return true;
|