@openmrs/esm-form-engine-lib 3.1.2-pre.1718 → 3.1.2-pre.1725
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@openmrs/esm-form-engine-lib",
|
3
|
-
"version": "3.1.2-pre.
|
3
|
+
"version": "3.1.2-pre.1725",
|
4
4
|
"description": "React Form Engine for O3",
|
5
5
|
"browser": "dist/openmrs-esm-form-engine-lib.js",
|
6
6
|
"main": "src/index.ts",
|
@@ -90,7 +90,7 @@
|
|
90
90
|
"sass": "^1.77.2",
|
91
91
|
"swc-loader": "^0.2.6",
|
92
92
|
"swr": "^2.2.5",
|
93
|
-
"turbo": "^2.2
|
93
|
+
"turbo": "^2.4.2",
|
94
94
|
"typescript": "^4.9.5",
|
95
95
|
"webpack": "^5.91.0",
|
96
96
|
"webpack-bundle-analyzer": "^4.10.2",
|
@@ -101,6 +101,6 @@
|
|
101
101
|
"*.{ts,tsx}": "eslint --cache --fix --max-warnings 0",
|
102
102
|
"*.{css,scss,ts,tsx}": "prettier --write --list-different"
|
103
103
|
},
|
104
|
-
"packageManager": "yarn@4.
|
104
|
+
"packageManager": "yarn@4.6.0",
|
105
105
|
"stableVersion": "3.1.1"
|
106
106
|
}
|
package/src/hooks/useFormJson.ts
CHANGED
@@ -4,7 +4,7 @@ import { isTrue } from '../utils/boolean-utils';
|
|
4
4
|
import { applyFormIntent } from '../utils/forms-loader';
|
5
5
|
import { fetchOpenMRSForm, fetchClobData } from '../api';
|
6
6
|
import { getRegisteredFormSchemaTransformers } from '../registry/registry';
|
7
|
-
import {
|
7
|
+
import { formEngineAppName } from '../globals';
|
8
8
|
|
9
9
|
export function useFormJson(formUuid: string, rawFormJson: any, encounterUuid: string, formSessionIntent: string) {
|
10
10
|
const [formJson, setFormJson] = useState<FormSchema>(null);
|
@@ -16,7 +16,7 @@ export function useFormJson(formUuid: string, rawFormJson: any, encounterUuid: s
|
|
16
16
|
const setFormJsonWithTranslations = (formJson: FormSchema) => {
|
17
17
|
if (formJson?.translations) {
|
18
18
|
const language = window.i18next.language;
|
19
|
-
window.i18next.addResourceBundle(language,
|
19
|
+
window.i18next.addResourceBundle(language, formEngineAppName, formJson.translations, true, true);
|
20
20
|
}
|
21
21
|
setFormJson(formJson);
|
22
22
|
};
|
@@ -2,14 +2,14 @@ import dayjs from 'dayjs';
|
|
2
2
|
import { showSnackbar, translateFrom } from '@openmrs/esm-framework';
|
3
3
|
import { getPatientEnrolledPrograms, saveProgramEnrollment } from '../api';
|
4
4
|
import { type PostSubmissionAction, type PatientProgramPayload } from '../types';
|
5
|
-
import {
|
5
|
+
import { formEngineAppName } from '../globals';
|
6
6
|
import { extractErrorMessagesFromResponse } from '../utils/error-utils';
|
7
7
|
|
8
8
|
export const ProgramEnrollmentSubmissionAction: PostSubmissionAction = {
|
9
9
|
applyAction: async function ({ patient, encounters, sessionMode }, config) {
|
10
10
|
const encounter = encounters[0];
|
11
11
|
const encounterLocation = encounter.location['uuid'];
|
12
|
-
const translateFn = (key, defaultValue?) => translateFrom(
|
12
|
+
const translateFn = (key, defaultValue?) => translateFrom(formEngineAppName, key, defaultValue);
|
13
13
|
const programUuid = config.programUuid;
|
14
14
|
|
15
15
|
if (sessionMode === 'view') {
|
@@ -26,7 +26,7 @@ import { FormProcessor } from '../form-processor';
|
|
26
26
|
import { getPreviousEncounter, saveEncounter } from '../../api';
|
27
27
|
import { hasRendering } from '../../utils/common-utils';
|
28
28
|
import { isEmpty } from '../../validators/form-validator';
|
29
|
-
import {
|
29
|
+
import { formEngineAppName } from '../../globals';
|
30
30
|
import { type FormContextProps } from '../../provider/form-provider';
|
31
31
|
import { useEncounter } from '../../hooks/useEncounter';
|
32
32
|
import { useEncounterRole } from '../../hooks/useEncounterRole';
|
@@ -110,7 +110,7 @@ export class EncounterFormProcessor extends FormProcessor {
|
|
110
110
|
|
111
111
|
async processSubmission(context: FormContextProps, abortController: AbortController) {
|
112
112
|
const { encounterRole, encounterProvider, encounterDate, encounterLocation } = getMutableSessionProps(context);
|
113
|
-
const translateFn = (key, defaultValue?) => translateFrom(
|
113
|
+
const translateFn = (key, defaultValue?) => translateFrom(formEngineAppName, key, defaultValue);
|
114
114
|
const patientIdentifiers = preparePatientIdentifiers(context.formFields, encounterLocation);
|
115
115
|
const encounter = prepareEncounter(context, encounterDate, encounterRole, encounterProvider, encounterLocation);
|
116
116
|
|