@burdenoff/website-sdk 2026.1003.2 → 2026.1004.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/index.mjs CHANGED
@@ -345,6 +345,17 @@ function useWebSDKConfig() {
345
345
  const client = useWebSDK();
346
346
  return client.getConfig();
347
347
  }
348
+ var RECAPTCHA_WIDGET_HEIGHT = 78;
349
+ function useDeferredRecaptcha(siteKey) {
350
+ const [engaged, setEngaged] = useState(false);
351
+ const arm = useCallback(() => setEngaged(true), []);
352
+ const enabled = siteKey.length > 0;
353
+ return {
354
+ armed: enabled && engaged,
355
+ arm,
356
+ formProps: enabled && !engaged ? { onFocus: arm, onPointerDown: arm } : {}
357
+ };
358
+ }
348
359
 
349
360
  // src/utils/product-slug.ts
350
361
  var PRODUCT_SLUG_RENAMES = Object.freeze(
@@ -808,12 +819,14 @@ function ContactPage({
808
819
  const displayName = productName ?? product?.name ?? config.productId;
809
820
  const effectiveRecaptchaSiteKey = recaptchaSiteKey ?? product?.recaptchaSiteKey ?? config.recaptchaSiteKey ?? "";
810
821
  const recaptchaRef = useRef(null);
822
+ const recaptchaGate = useDeferredRecaptcha(effectiveRecaptchaSiteKey);
811
823
  const [isSubmitting, setIsSubmitting] = useState(false);
812
824
  const [submitStatus, setSubmitStatus] = useState("idle");
813
825
  const handleSubmit = async (e) => {
814
826
  e.preventDefault();
815
827
  const recaptchaToken = recaptchaRef.current?.getValue() ?? "";
816
828
  if (effectiveRecaptchaSiteKey && !recaptchaToken) {
829
+ recaptchaGate.arm();
817
830
  toast.error("Please complete the reCAPTCHA verification");
818
831
  return;
819
832
  }
@@ -940,6 +953,7 @@ function ContactPage({
940
953
  {
941
954
  onSubmit: handleSubmit,
942
955
  className: "space-y-4 sm:space-y-6",
956
+ ...recaptchaGate.formProps,
943
957
  children: [
944
958
  /* @__PURE__ */ jsxs("div", { className: "grid sm:grid-cols-2 gap-4 sm:gap-6", children: [
945
959
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
@@ -1064,13 +1078,20 @@ function ContactPage({
1064
1078
  )
1065
1079
  ] }),
1066
1080
  /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1067
- effectiveRecaptchaSiteKey && /* @__PURE__ */ jsx("div", { className: "flex justify-center sm:justify-start", children: /* @__PURE__ */ jsx(
1068
- ReCAPTCHA4,
1081
+ effectiveRecaptchaSiteKey && /* @__PURE__ */ jsx(
1082
+ "div",
1069
1083
  {
1070
- ref: recaptchaRef,
1071
- sitekey: effectiveRecaptchaSiteKey
1084
+ className: "flex justify-center sm:justify-start",
1085
+ style: { minHeight: RECAPTCHA_WIDGET_HEIGHT },
1086
+ children: recaptchaGate.armed && /* @__PURE__ */ jsx(
1087
+ ReCAPTCHA4,
1088
+ {
1089
+ ref: recaptchaRef,
1090
+ sitekey: effectiveRecaptchaSiteKey
1091
+ }
1092
+ )
1072
1093
  }
1073
- ) }),
1094
+ ),
1074
1095
  /* @__PURE__ */ jsx(
1075
1096
  Button,
1076
1097
  {
@@ -2791,6 +2812,7 @@ function NewsletterForm({
2791
2812
  const effectiveProductId = product?.id || config.productId;
2792
2813
  const effectiveRecaptchaSiteKey = recaptchaSiteKey ?? productConfig.recaptchaSiteKey ?? config.recaptchaSiteKey ?? "";
2793
2814
  const recaptchaRef = useRef(null);
2815
+ const recaptchaGate = useDeferredRecaptcha(effectiveRecaptchaSiteKey);
2794
2816
  const [email, setEmail] = useState("");
2795
2817
  const [isLoading, setIsLoading] = useState(false);
2796
2818
  const handleSubmit = async (e) => {
@@ -2801,6 +2823,7 @@ function NewsletterForm({
2801
2823
  }
2802
2824
  const recaptchaToken = recaptchaRef.current?.getValue() ?? "";
2803
2825
  if (effectiveRecaptchaSiteKey && !recaptchaToken) {
2826
+ recaptchaGate.arm();
2804
2827
  toast.error("Please complete the reCAPTCHA verification");
2805
2828
  return;
2806
2829
  }
@@ -2839,6 +2862,7 @@ function NewsletterForm({
2839
2862
  onSubmit: handleSubmit,
2840
2863
  className: isInline ? "flex flex-col gap-2" : "flex flex-col gap-2",
2841
2864
  style: { overflow: "visible" },
2865
+ ...recaptchaGate.formProps,
2842
2866
  children: [
2843
2867
  /* @__PURE__ */ jsxs(
2844
2868
  "div",
@@ -2909,9 +2933,10 @@ function NewsletterForm({
2909
2933
  position: "relative",
2910
2934
  zIndex: 50,
2911
2935
  display: "flex",
2912
- justifyContent: "flex-start"
2936
+ justifyContent: "flex-start",
2937
+ minHeight: RECAPTCHA_WIDGET_HEIGHT
2913
2938
  },
2914
- children: /* @__PURE__ */ jsx(
2939
+ children: recaptchaGate.armed && /* @__PURE__ */ jsx(
2915
2940
  ReCAPTCHA4,
2916
2941
  {
2917
2942
  ref: recaptchaRef,
@@ -6019,7 +6044,7 @@ function ConceptDetail({
6019
6044
  {
6020
6045
  "aria-label": "Previous and next concepts",
6021
6046
  "data-concepts": "pager",
6022
- className: "mt-16 grid gap-4 sm:grid-cols-2",
6047
+ className: "mt-16 grid grid-cols-1 gap-4 sm:grid-cols-2",
6023
6048
  children: [
6024
6049
  previous ? /* @__PURE__ */ jsxs(
6025
6050
  Link,
@@ -6068,7 +6093,7 @@ function ConceptDetail({
6068
6093
  Link,
6069
6094
  {
6070
6095
  href: CONCEPTS_PATH,
6071
- className: "inline-flex items-center gap-2 rounded text-sm font-medium text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
6096
+ className: "inline-flex items-center gap-2 rounded text-sm font-medium text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
6072
6097
  children: [
6073
6098
  /* @__PURE__ */ jsx(ArrowLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
6074
6099
  "All ",
@@ -17967,7 +17992,7 @@ function FacetList({
17967
17992
  className: `w-full text-left text-sm px-2 py-1 rounded flex items-center justify-between gap-2 transition-colors ${selected === f.value ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
17968
17993
  children: [
17969
17994
  /* @__PURE__ */ jsx("span", { className: "truncate", children: f.value }),
17970
- /* @__PURE__ */ jsx("span", { className: "text-xs opacity-60 flex-shrink-0", children: f.count })
17995
+ /* @__PURE__ */ jsx("span", { className: "text-xs flex-shrink-0", children: f.count })
17971
17996
  ]
17972
17997
  }
17973
17998
  ) }, f.value)) })
@@ -18150,7 +18175,7 @@ function StoreBrowsePage({
18150
18175
  className: `w-full text-left text-sm px-2 py-1.5 rounded flex items-center justify-between gap-2 transition-colors ${category === f.value ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
18151
18176
  children: [
18152
18177
  /* @__PURE__ */ jsx("span", { className: "truncate", children: cat?.name ?? f.value }),
18153
- f.count > 0 && /* @__PURE__ */ jsx("span", { className: "text-xs opacity-60 flex-shrink-0", children: f.count })
18178
+ f.count > 0 && /* @__PURE__ */ jsx("span", { className: "text-xs flex-shrink-0", children: f.count })
18154
18179
  ]
18155
18180
  },
18156
18181
  f.value