@factorialco/fcode-react-forms 1.0.0 → 2.0.1
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/dist/data/index.d.ts +0 -3
- package/dist/fcode-form.cjs.js +57 -57
- package/dist/fcode-form.cjs.js.map +1 -1
- package/dist/fcode-form.es.js +3070 -3045
- package/dist/fcode-form.es.js.map +1 -1
- package/dist/fcode-form.umd.js +67 -67
- package/dist/fcode-form.umd.js.map +1 -1
- package/dist/hooks/use-form-specs.d.ts +1 -1
- package/dist/hooks/use-submit-form.d.ts +1 -1
- package/dist/services/fcode.d.ts +3 -3
- package/dist/types.d.ts +25 -1
- package/package.json +1 -1
- package/dist/data/embed-form-options-with-i18n.d.ts +0 -3
- package/dist/data/fcode-form-specs-with-i18n.d.ts +0 -3
- package/dist/data/schema-with-i18n.d.ts +0 -3
|
@@ -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;
|
package/dist/services/fcode.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SubmitFormParams,
|
|
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<
|
|
1
|
+
import { SubmitFormParams, SubmitFormResponse, FetchFormSpecsParams } from '../types';
|
|
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<SubmitFormResponse>;
|
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;
|
|
@@ -57,12 +67,25 @@ export interface RedirectConfig {
|
|
|
57
67
|
timeout?: number;
|
|
58
68
|
}
|
|
59
69
|
export type SubmitFormResults = GenericObjectType;
|
|
70
|
+
export interface SubmitFormResponse {
|
|
71
|
+
/** The process execution result, i.e. the response body. */
|
|
72
|
+
results: SubmitFormResults;
|
|
73
|
+
/**
|
|
74
|
+
* The file fields the platform stored during this submit, as
|
|
75
|
+
* `fcode.storage://` paths keyed by field name (from the
|
|
76
|
+
* `Fcode-Resolved-Files` response header). Multi-step forms keep these in
|
|
77
|
+
* the step data instead of the submitted `data:` URL, so later steps carry
|
|
78
|
+
* the path the step's process saw rather than re-sending the file's base64.
|
|
79
|
+
*/
|
|
80
|
+
resolvedFiles?: Record<string, string>;
|
|
81
|
+
}
|
|
60
82
|
export interface FetchFormSpecsParams {
|
|
61
83
|
hostUrl: string;
|
|
62
84
|
headers?: GenericObjectType;
|
|
63
85
|
team: string;
|
|
64
86
|
processId: string;
|
|
65
87
|
processVersion?: string;
|
|
88
|
+
locale?: string;
|
|
66
89
|
}
|
|
67
90
|
export interface SubmitFormParams {
|
|
68
91
|
hostUrl: string;
|
|
@@ -71,5 +94,6 @@ export interface SubmitFormParams {
|
|
|
71
94
|
processId: string;
|
|
72
95
|
processVersion?: string;
|
|
73
96
|
async?: boolean;
|
|
97
|
+
locale?: string;
|
|
74
98
|
formData: FormData;
|
|
75
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorialco/fcode-react-forms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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/",
|