@burdenoff/website-sdk 2026.1003.1 → 2026.1003.3

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,
@@ -17073,7 +17098,7 @@ function ProductCard({ product, onClick, href }) {
17073
17098
  /* @__PURE__ */ jsx(
17074
17099
  "span",
17075
17100
  {
17076
- className: `text-xs font-semibold ${priceLabel === "Free" ? "text-emerald-700" : "text-foreground"}`,
17101
+ className: `text-xs font-semibold ${priceLabel === "Free" ? "text-emerald-700 dark:text-emerald-400" : "text-foreground"}`,
17077
17102
  children: priceLabel
17078
17103
  }
17079
17104
  )
@@ -17325,7 +17350,7 @@ function FeaturedHeroCard({
17325
17350
  /* @__PURE__ */ jsx(
17326
17351
  "span",
17327
17352
  {
17328
- className: `text-sm font-bold flex-shrink-0 ${priceLabel === "Free" ? "text-emerald-700" : "text-foreground"}`,
17353
+ className: `text-sm font-bold flex-shrink-0 ${priceLabel === "Free" ? "text-emerald-700 dark:text-emerald-400" : "text-foreground"}`,
17329
17354
  children: priceLabel
17330
17355
  }
17331
17356
  )
@@ -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
@@ -18198,6 +18223,7 @@ function StoreBrowsePage({
18198
18223
  {
18199
18224
  ref: searchRef,
18200
18225
  type: "search",
18226
+ "aria-label": "Search store items",
18201
18227
  value: inputValue,
18202
18228
  onChange: (e) => setInputValue(e.target.value),
18203
18229
  placeholder: "Search\u2026",
@@ -18217,6 +18243,7 @@ function StoreBrowsePage({
18217
18243
  /* @__PURE__ */ jsx(
18218
18244
  "select",
18219
18245
  {
18246
+ "aria-label": "Sort store items",
18220
18247
  value: sortBy,
18221
18248
  onChange: (e) => setSortBy(e.target.value),
18222
18249
  className: "h-10 rounded-lg border border-border bg-background px-3 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/50",
@@ -18295,6 +18322,7 @@ function StoreBrowsePage({
18295
18322
  }
18296
18323
  )
18297
18324
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
18325
+ /* @__PURE__ */ jsx("h2", { className: "sr-only", children: "Store items" }),
18298
18326
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4", children: allProducts.map((product) => /* @__PURE__ */ jsx(
18299
18327
  ProductCard,
18300
18328
  {
@@ -18880,7 +18908,7 @@ function StoreProductDetailPage({
18880
18908
  children: [
18881
18909
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 mb-2", children: [
18882
18910
  /* @__PURE__ */ jsx(StarRating, { rating: review.rating }),
18883
- review.verifiedPurchase && /* @__PURE__ */ jsx("span", { className: "text-xs text-emerald-700 font-medium", children: "Verified" })
18911
+ review.verifiedPurchase && /* @__PURE__ */ jsx("span", { className: "text-xs text-emerald-700 dark:text-emerald-400 font-medium", children: "Verified" })
18884
18912
  ] }),
18885
18913
  review.title && /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm text-foreground mb-1", children: review.title }),
18886
18914
  review.comment && /* @__PURE__ */ jsx(Markdown, { className: "text-sm text-muted-foreground leading-relaxed", children: review.comment }),
@@ -18914,7 +18942,7 @@ function StoreProductDetailPage({
18914
18942
  /* @__PURE__ */ jsx(
18915
18943
  "div",
18916
18944
  {
18917
- className: `text-3xl font-extrabold ${priceLabel === "Free" ? "text-emerald-700" : "text-foreground"}`,
18945
+ className: `text-3xl font-extrabold ${priceLabel === "Free" ? "text-emerald-700 dark:text-emerald-400" : "text-foreground"}`,
18918
18946
  children: priceLabel
18919
18947
  }
18920
18948
  ),