@factorialco/fcode-react-forms 1.0.0 → 2.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.
@@ -1,5 +1,5 @@
1
1
  import { FormOptions, FormSpecs } from '../types';
2
- declare const useFormSpecs: ({ hostUrl, headers, team, processId, processVersion, }: FormOptions) => {
2
+ declare const useFormSpecs: ({ hostUrl, headers, team, processId, processVersion, locale, }: FormOptions) => {
3
3
  loading: boolean;
4
4
  formSpecs: FormSpecs | undefined;
5
5
  error: unknown;
@@ -1,5 +1,5 @@
1
1
  import { FormOptions, SubmitFormResults, FormData } from '../types';
2
- declare const useSubmitForm: ({ hostUrl, headers, team, processId, processVersion, async, }: FormOptions) => [(data: FormData) => Promise<any>, {
2
+ declare const useSubmitForm: ({ hostUrl, headers, team, processId, processVersion, locale, async, }: FormOptions) => [(data: FormData) => Promise<any>, {
3
3
  loading: boolean;
4
4
  results: SubmitFormResults | undefined;
5
5
  error: string | undefined;
@@ -1,3 +1,3 @@
1
1
  import { SubmitFormParams, SubmitFormResults, FetchFormSpecsParams } from '../types';
2
- export declare const fetchFormSpecs: ({ hostUrl, headers, team, processId, processVersion, }: FetchFormSpecsParams) => Promise<any>;
3
- export declare const submitForm: ({ hostUrl, headers, team, processId, processVersion, async, formData, }: SubmitFormParams) => Promise<SubmitFormResults>;
2
+ export declare const fetchFormSpecs: ({ hostUrl, headers, team, processId, processVersion, locale, }: FetchFormSpecsParams) => Promise<any>;
3
+ export declare const submitForm: ({ hostUrl, headers, team, processId, processVersion, async, locale, formData, }: SubmitFormParams) => Promise<SubmitFormResults>;
package/dist/types.d.ts CHANGED
@@ -12,6 +12,7 @@ export interface FormOptions {
12
12
  processId: string;
13
13
  processVersion?: string;
14
14
  async?: boolean;
15
+ locale?: string;
15
16
  }
16
17
  export type GenericObjectType = {
17
18
  [name: string]: any;
@@ -39,10 +40,19 @@ export interface EmbedFormOptions {
39
40
  * loaded. Defaults to 'Loading form...'.
40
41
  */
41
42
  loadingContent?: string;
43
+ /**
44
+ * Which locale the form is rendered in. Sent to the platform, which resolves every
45
+ * `fcode.i18n("key")` in the schema before returning it, so translations never reach the
46
+ * browser. Omitted means the workspace's primary locale.
47
+ */
42
48
  locale: string;
49
+ /**
50
+ * Locale for rjsf's built-in validation messages when `locale` is not one it ships. Only
51
+ * affects those messages — the schema's own text is translated by the platform, which falls
52
+ * back to the workspace's primary locale on its own.
53
+ */
43
54
  fallbackLocale?: string;
44
55
  variables?: GenericObjectType;
45
- i18nVariables?: GenericObjectType;
46
56
  }
47
57
  export interface FormSpecsSchema extends RJSFSchema {
48
58
  ui: UiSchema;
@@ -63,6 +73,7 @@ export interface FetchFormSpecsParams {
63
73
  team: string;
64
74
  processId: string;
65
75
  processVersion?: string;
76
+ locale?: string;
66
77
  }
67
78
  export interface SubmitFormParams {
68
79
  hostUrl: string;
@@ -71,5 +82,6 @@ export interface SubmitFormParams {
71
82
  processId: string;
72
83
  processVersion?: string;
73
84
  async?: boolean;
85
+ locale?: string;
74
86
  formData: FormData;
75
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/fcode-react-forms",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Factorial Code allows start process executions from any webpage embedding process input parameters forms. This allows each form submission to start one execution with the information filled in the form, and also allows to manage the execution result into that webpage.",
5
5
  "type": "module",
6
6
  "homepage": "https://code.factorialhr.com/docs/forms/",
@@ -1,3 +0,0 @@
1
- import { EmbedFormOptions } from '../types';
2
- declare const embedFormOptions: EmbedFormOptions;
3
- export default embedFormOptions;
@@ -1,3 +0,0 @@
1
- import { FormSpecs } from '../types';
2
- declare const fcodeFormSpecs: FormSpecs;
3
- export default fcodeFormSpecs;
@@ -1,3 +0,0 @@
1
- import { JSONSchema7 } from 'json-schema';
2
- declare const schema: JSONSchema7;
3
- export default schema;