@usefillo/react 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +9 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/FilloForm.tsx
4
4
  import { useEffect as useEffect6, useMemo, useRef as useRef4, useState as useState5 } from "react";
5
- import { FilloError as FilloError2 } from "@usefillo/core";
5
+ import { FilloError as FilloError2, createClient } from "@usefillo/core";
6
6
 
7
7
  // src/context.ts
8
8
  import { allFields } from "@usefillo/core";
@@ -892,7 +892,11 @@ function themeStyle(theme) {
892
892
  return style;
893
893
  }
894
894
  function FilloForm(props) {
895
- const { form, client, formId } = props;
895
+ const { form, formId } = props;
896
+ const client = useMemo(
897
+ () => props.client ?? (formId ? createClient() : void 0),
898
+ [props.client, formId]
899
+ );
896
900
  const [fetched, setFetched] = useState5(null);
897
901
  const [fetchedTheme, setFetchedTheme] = useState5(null);
898
902
  const [loadError, setLoadError] = useState5(null);
@@ -949,7 +953,7 @@ function FilloForm(props) {
949
953
  }
950
954
  );
951
955
  }
952
- return /* @__PURE__ */ jsx4(ResolvedForm, { ...props, schema, theme, formId: syncedFormId ?? formId });
956
+ return /* @__PURE__ */ jsx4(ResolvedForm, { ...props, client, schema, theme, formId: syncedFormId ?? formId });
953
957
  }
954
958
  function ResolvedForm(props) {
955
959
  const { schema, theme } = props;
@@ -1074,7 +1078,7 @@ function FilloProvider({ children, form, formId, client, ...options }) {
1074
1078
 
1075
1079
  // src/index.ts
1076
1080
  import {
1077
- createClient,
1081
+ createClient as createClient2,
1078
1082
  FilloClient,
1079
1083
  FilloError as FilloError3
1080
1084
  } from "@usefillo/core";
@@ -1086,7 +1090,7 @@ export {
1086
1090
  FilloForm,
1087
1091
  FilloProvider,
1088
1092
  FormField,
1089
- createClient,
1093
+ createClient2 as createClient,
1090
1094
  defineForm,
1091
1095
  useField,
1092
1096
  useFillo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/react",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Headless React components for embedding Fillo forms natively in your product.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "@usefillo/core": "^0.2.0"
39
+ "@usefillo/core": "^0.2.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18.0.0 || ^19.0.0",