@crowdin/app-project-module 0.28.0-2 → 0.28.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.
package/README.md CHANGED
@@ -978,7 +978,15 @@ configuration.projectMenu = {
978
978
  "title": "Last name"
979
979
  },
980
980
  }
981
- }
981
+ },
982
+ formUiSchema: {
983
+ "ui:submitButtonOptions": {
984
+ "submitText": "Confirm Details",
985
+ },
986
+ "lastName": {
987
+ "ui:help": "Hint: Choose cool lastname!"
988
+ }
989
+ },
982
990
  };
983
991
  ```
984
992
  By default, form data will be stored in app metadata. To retrieve data you can use this code:
@@ -986,7 +994,19 @@ By default, form data will be stored in app metadata. To retrieve data you can u
986
994
  crowdinApp.getMetadata(`${organizationId}-${projectId}`);
987
995
  ```
988
996
  To customize this behavior you can provide `formDataUrl` property that will contain URL to custom action in your app. This action should support both GET request for fetching data and POST request to save new data.
989
-
997
+ Response structure for GET request example:
998
+ ```js
999
+ res.status(200).send({
1000
+ formData: {
1001
+ firstName: 'Norris',
1002
+ },
1003
+ }).end();
1004
+ ```
1005
+ Also, you can provide next properties:
1006
+ - formScheme - new schema to replace active schema;
1007
+ - formUiScheme - new uiSchema to replace current;
1008
+ - message - custom message that will be displayed in toasts;
1009
+ - redirect - url for redirect (useful for files download).
990
1010
  ## Contributing
991
1011
 
992
1012
  If you want to contribute please read the [Contributing](/CONTRIBUTING.md) guidelines.
@@ -35,7 +35,7 @@ function handle() {
35
35
  const id = req.query.id;
36
36
  const data = (yield storage.getStorage().getMetadata(id)) || {};
37
37
  return res.send({
38
- data,
38
+ formData: data,
39
39
  });
40
40
  }));
41
41
  }
@@ -20,6 +20,7 @@ function handle(config, moduleConfig) {
20
20
  return res.render('form', {
21
21
  formDataUrl: moduleConfig.formDataUrl ? moduleConfig.formDataUrl : '/api/form-data',
22
22
  formSchema: JSON.stringify(moduleConfig.formSchema),
23
+ formUiSchema: moduleConfig.formUiSchema ? JSON.stringify(moduleConfig.formUiSchema) : '{}',
23
24
  });
24
25
  }
25
26
  if (moduleConfig.uiPath) {
@@ -606,6 +606,10 @@ export interface UiModule {
606
606
  * Endpoint should accept both POST requests for data saving and GET requests for data retrieving.
607
607
  */
608
608
  formDataUrl?: string;
609
+ /**
610
+ * Additional attributes for react-jsonschema-doc
611
+ */
612
+ formUiSchema?: object;
609
613
  /**
610
614
  * path to ui folder (e.g. {@example join(__dirname, 'public')})
611
615
  */