@factorialco/fcode-react-forms 3.4.0 → 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;
@@ -3,6 +3,7 @@ import { OauthSuccess, OauthValueKind } from './types';
3
3
  * The value an `oauth` field takes after a successful flow, by property type:
4
4
  * a boolean is simply `true`; a string takes the callback page's `value`
5
5
  * (an opaque handle such as a connection id); an object takes every parameter
6
- * the callback page received, minus the ones that describe the outcome.
6
+ * the callback page received, minus the ones that describe the outcome
7
+ * (`status`, `message`) or correlate the flow (the echoed `state`).
7
8
  */
8
9
  export declare const resolveOauthValue: (kind: OauthValueKind, result: OauthSuccess) => true | string | Record<string, string>;
@@ -39,6 +39,14 @@ export type OauthSuccess = OauthOutcome & {
39
39
  };
40
40
  export type OauthResult = OauthOutcome | {
41
41
  status: 'cancelled';
42
+ /**
43
+ * The popup reported closed within seconds of opening while a
44
+ * BroadcastChannel is available — the signature of a
45
+ * `Cross-Origin-Opener-Policy` severance, where the flow is most likely
46
+ * still running and its completion can still arrive over the channel.
47
+ * Set only when true.
48
+ */
49
+ possiblySevered?: boolean;
42
50
  } | {
43
51
  status: 'blocked';
44
52
  };
@@ -73,6 +81,9 @@ export interface FcodeFormContext {
73
81
  * server can mint a fresh authorization URL. `FcodeForm` provides it; an
74
82
  * embedder rendering `FcodeJsonSchemaForm` itself can set its own.
75
83
  */
76
- reloadFormSpecs?: () => void;
84
+ reloadFormSpecs?: (options?: {
85
+ /** Skip the loading overlay: a background refresh. */
86
+ silent?: boolean;
87
+ }) => void;
77
88
  };
78
89
  }