@openmrs/esm-patient-registration-app 4.5.1-pre.1799 → 5.0.0

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.
@@ -14,7 +14,7 @@ assets by path *.js 1.25 MiB
14
14
  + 17 assets
15
15
  assets by path *.json 14.3 KiB
16
16
  asset openmrs-esm-patient-registration-app.js.buildmanifest.json 13.3 KiB [emitted]
17
- asset routes.json 949 bytes [emitted] [from: src/routes.json] [copied]
17
+ asset routes.json 940 bytes [emitted] [from: src/routes.json] [copied]
18
18
  orphan modules 3.93 MiB [orphan] 634 modules
19
19
  runtime modules 38.7 KiB 28 modules
20
20
  built modules 4.43 MiB (javascript) 210 bytes (share-init) 210 bytes (consume-shared) [built]
@@ -35,4 +35,4 @@ This can impact web performance.
35
35
  Assets:
36
36
  130.js (497 KiB)
37
37
 
38
- webpack 5.86.0 compiled with 1 warning in 55026 ms
38
+ webpack 5.86.0 compiled with 1 warning in 191213 ms
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"cancelPatientEditModal","name":"cancel-patient-edit-modal","online":true,"offline":true},{"component":"patientPhoto","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true}],"version":"4.5.1-pre.1799"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"cancelPatientEditModal","name":"cancel-patient-edit-modal","online":true,"offline":true},{"component":"patientPhoto","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true}],"version":"5.0.0"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-patient-registration-app",
3
- "version": "4.5.1-pre.1799",
3
+ "version": "5.0.0",
4
4
  "description": "Patient registration microfrontend for the OpenMRS SPA",
5
5
  "browser": "dist/openmrs-esm-patient-registration-app.js",
6
6
  "main": "src/index.ts",
@@ -52,5 +52,5 @@
52
52
  "devDependencies": {
53
53
  "webpack": "^5.74.0"
54
54
  },
55
- "gitHead": "69add63b6752571c2a8e6946fc0ce498bb7b07c3"
55
+ "gitHead": "2234a566ef6ae492e872a5e0a063f03e349d68ff"
56
56
  }
@@ -0,0 +1,81 @@
1
+ import { isUniqueIdentifierTypeForOffline, shouldBlockPatientIdentifierInOfflineMode } from './utils';
2
+
3
+ interface IdentifierTypeOptions {
4
+ uniquenessBehavior?: 'UNIQUE' | 'LOCATION' | 'NON_UNIQUE';
5
+ manualEntryEnabled?: boolean;
6
+ automaticGenerationEnabled?: boolean;
7
+ }
8
+
9
+ function createIdentifierType(options: IdentifierTypeOptions) {
10
+ return {
11
+ uniquenessBehavior: options.uniquenessBehavior,
12
+ identifierSources: [
13
+ {
14
+ uuid: 'identifier-source-uuid',
15
+ name: 'Identifier Source Name',
16
+ autoGenerationOption: {
17
+ manualEntryEnabled: options.manualEntryEnabled,
18
+ automaticGenerationEnabled: options.automaticGenerationEnabled,
19
+ },
20
+ },
21
+ ],
22
+ name: 'Identifier Type Name',
23
+ required: true,
24
+ uuid: 'identifier-type-uuid',
25
+ fieldName: 'identifierFieldName',
26
+ format: 'identifierFormat',
27
+ isPrimary: true,
28
+ };
29
+ }
30
+
31
+ describe('shouldBlockPatientIdentifierInOfflineMode function', () => {
32
+ it('should return false if identifierType is not unique', () => {
33
+ const identifierType = createIdentifierType({ uniquenessBehavior: null });
34
+
35
+ const result = shouldBlockPatientIdentifierInOfflineMode(identifierType);
36
+
37
+ expect(result).toBe(false);
38
+ });
39
+
40
+ it('should return false if identifierType is unique and no manual entry is enabled', () => {
41
+ const identifierType = createIdentifierType({ uniquenessBehavior: null });
42
+
43
+ const result = shouldBlockPatientIdentifierInOfflineMode(identifierType);
44
+
45
+ expect(result).toBe(false);
46
+ });
47
+
48
+ it('should return true if identifierType is unique and manual entry is enabled', () => {
49
+ const identifierType = createIdentifierType({ manualEntryEnabled: true, uniquenessBehavior: 'UNIQUE' });
50
+
51
+ const result = shouldBlockPatientIdentifierInOfflineMode(identifierType);
52
+
53
+ expect(result).toBe(true);
54
+ });
55
+ });
56
+
57
+ describe('isUniqueIdentifierTypeForOffline function', () => {
58
+ it('should return true if uniquenessBehavior is UNIQUE', () => {
59
+ const identifierType = createIdentifierType({ uniquenessBehavior: 'UNIQUE' });
60
+
61
+ const result = isUniqueIdentifierTypeForOffline(identifierType);
62
+
63
+ expect(result).toBe(true);
64
+ });
65
+
66
+ it('should return true if uniquenessBehavior is LOCATION', () => {
67
+ const identifierType = createIdentifierType({ uniquenessBehavior: 'LOCATION' });
68
+
69
+ const result = isUniqueIdentifierTypeForOffline(identifierType);
70
+
71
+ expect(result).toBe(true);
72
+ });
73
+
74
+ it('should return false for other uniqueness behaviors', () => {
75
+ const identifierType = createIdentifierType({ uniquenessBehavior: null });
76
+
77
+ const result = isUniqueIdentifierTypeForOffline(identifierType);
78
+
79
+ expect(result).toBe(false);
80
+ });
81
+ });