@usefillo/react 0.3.1 → 0.3.2

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 +12 -17
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -899,7 +899,7 @@ function FilloForm(props) {
899
899
  const [fetchedTheme, setFetchedTheme] = useState5(null);
900
900
  const [loadError, setLoadError] = useState5(null);
901
901
  const [closed, setClosed] = useState5(false);
902
- const [fetchedPoweredBy, setFetchedPoweredBy] = useState5(null);
902
+ const [fetchedBranding, setFetchedBranding] = useState5(null);
903
903
  const codeForm = isCodeForm2(form) ? form : null;
904
904
  const inlineSchema = codeForm ? codeForm.schema : form;
905
905
  const onError = props.onError;
@@ -915,7 +915,7 @@ function FilloForm(props) {
915
915
  setFetched(published.schema);
916
916
  setFetchedTheme(published.theme);
917
917
  setClosed(Boolean(published.closed));
918
- setFetchedPoweredBy(published.branding?.poweredBy ?? null);
918
+ setFetchedBranding(published.branding ?? null);
919
919
  }).catch((err) => {
920
920
  if (cancelled) return;
921
921
  const error = err instanceof FilloError2 ? err : new FilloError2("This form could not be loaded.", 0);
@@ -953,7 +953,7 @@ function FilloForm(props) {
953
953
  }
954
954
  );
955
955
  }
956
- const poweredBy = props.skipValidation ? false : props.poweredBy ?? fetchedPoweredBy ?? true;
956
+ const poweredBy = props.skipValidation ? false : props.poweredBy ?? fetchedBranding?.poweredBy ?? true;
957
957
  return /* @__PURE__ */ jsx4(
958
958
  ResolvedForm,
959
959
  {
@@ -962,21 +962,16 @@ function FilloForm(props) {
962
962
  schema,
963
963
  theme,
964
964
  formId: syncedFormId ?? formId,
965
- poweredBy
965
+ poweredBy,
966
+ brandLabel: fetchedBranding?.label,
967
+ brandHref: fetchedBranding?.href
966
968
  }
967
969
  );
968
970
  }
969
- function PoweredBy() {
970
- return /* @__PURE__ */ jsx4(
971
- "a",
972
- {
973
- className: "fillo-powered",
974
- href: "https://fillo.so?utm_source=form_badge",
975
- target: "_blank",
976
- rel: "noopener",
977
- children: "Powered by Fillo"
978
- }
979
- );
971
+ function PoweredBy({ label, href }) {
972
+ const base = href ?? "https://fillo.so";
973
+ const url = `${base}${base.includes("?") ? "&" : "?"}utm_source=form_badge`;
974
+ return /* @__PURE__ */ jsx4("a", { className: "fillo-powered", href: url, target: "_blank", rel: "noopener", children: label ?? "Powered by Fillo" });
980
975
  }
981
976
  function isDevEnv() {
982
977
  return typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
@@ -1018,7 +1013,7 @@ function ResolvedForm(props) {
1018
1013
  /* @__PURE__ */ jsx4("h2", { className: "fillo-success-title", children: settings.successTitle ?? "Thanks!" }),
1019
1014
  /* @__PURE__ */ jsx4("p", { className: "fillo-success-message", children: settings.successMessage ?? "Your response has been recorded." })
1020
1015
  ] }),
1021
- props.poweredBy && /* @__PURE__ */ jsx4(PoweredBy, {})
1016
+ props.poweredBy && /* @__PURE__ */ jsx4(PoweredBy, { label: props.brandLabel, href: props.brandHref })
1022
1017
  ] });
1023
1018
  }
1024
1019
  const multiPage = api.pageCount > 1;
@@ -1094,7 +1089,7 @@ function ResolvedForm(props) {
1094
1089
  }
1095
1090
  )
1096
1091
  ] }),
1097
- props.poweredBy && /* @__PURE__ */ jsx4(PoweredBy, {})
1092
+ props.poweredBy && /* @__PURE__ */ jsx4(PoweredBy, { label: props.brandLabel, href: props.brandHref })
1098
1093
  ]
1099
1094
  }
1100
1095
  ) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/react",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Headless React components for embedding Fillo forms natively in your product.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -32,7 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@usefillo/core": "^0.3.1"
35
+ "@usefillo/core": "^0.3.2"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": "^18.0.0 || ^19.0.0",