@factorialco/fcode-react-forms 3.4.1 → 3.5.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,22 +1,20 @@
1
- import { FormData, EmbedFormOptions, GenericObjectType } from '../../types';
1
+ import { FormData, EmbedFormOptions, FormTransport, GenericObjectType } from '../../types';
2
2
  import { Options as ReactMarkdownOptions } from 'react-markdown';
3
3
  import { FcodeJsonSchemaFormProps } from '../json-schema-form';
4
4
  export type FcodeFormOptions = EmbedFormOptions;
5
- export interface FcodeFormProps extends Omit<FcodeJsonSchemaFormProps, 'onError' | 'schema'> {
5
+ interface FcodeFormBaseProps extends Omit<FcodeJsonSchemaFormProps, 'onError' | 'schema'> {
6
6
  /**
7
- * The host URL for Factorial Code (optional).
7
+ * The host URL for Factorial Code (optional). Ignored with a `transport`.
8
8
  */
9
9
  hostUrl?: string;
10
10
  /**
11
- * Headers to be added to form fetch and submit requests.
11
+ * Headers to be added to form fetch and submit requests. Ignored with a
12
+ * `transport`.
12
13
  */
13
14
  headers?: GenericObjectType;
14
15
  /**
15
- * The Factorial Code team slug.
16
- */
17
- team: string;
18
- /**
19
- * The Factorial Code process ID.
16
+ * The Factorial Code process ID. With a `transport`, whatever id the
17
+ * transport understands; the SDK passes it through as it is.
20
18
  */
21
19
  processId: string;
22
20
  /**
@@ -25,6 +23,7 @@ export interface FcodeFormProps extends Omit<FcodeJsonSchemaFormProps, 'onError'
25
23
  * result names the next process but not its version, so the version the
26
24
  * embedder pinned is the only intent available. A step whose process has no
27
25
  * such version runs its current version — the API warns rather than failing.
26
+ * Ignored with a `transport`.
28
27
  */
29
28
  processVersion?: string;
30
29
  /**
@@ -80,6 +79,22 @@ export interface FcodeFormProps extends Omit<FcodeJsonSchemaFormProps, 'onError'
80
79
  */
81
80
  options: FcodeFormOptions;
82
81
  }
82
+ export type FcodeFormProps = FcodeFormBaseProps & ({
83
+ /**
84
+ * Fetches the schema and submits the form instead of the SDK's own
85
+ * requests to the platform, e.g. through the host app's backend.
86
+ * Without it the form talks to `hostUrl` directly, as always.
87
+ */
88
+ transport?: undefined;
89
+ /**
90
+ * The Factorial Code team slug.
91
+ */
92
+ team: string;
93
+ } | {
94
+ transport: FormTransport;
95
+ /** Ignored with a `transport`. */
96
+ team?: string;
97
+ });
83
98
  export interface FcodeFormStep {
84
99
  processId: string;
85
100
  data: FormData;
@@ -91,7 +106,7 @@ export interface FcodeFormState {
91
106
  variables: GenericObjectType;
92
107
  }
93
108
  declare const FcodeForm: {
94
- ({ hostUrl, headers, team, processId, processVersion, onNextStep, onSuccess, keepSuccessView, onError, markdownComponents, defaultValues, async, disabled, readonly, options, ...rest }: FcodeFormProps): import("react").JSX.Element;
109
+ ({ hostUrl, headers, team, transport, processId, processVersion, onNextStep, onSuccess, keepSuccessView, onError, markdownComponents, defaultValues, async, disabled, readonly, options, ...rest }: FcodeFormProps): import("react").JSX.Element;
95
110
  displayName: string;
96
111
  };
97
112
  export default FcodeForm;