@burdenoff/website-sdk 2026.513.3 → 2026.513.4
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/components/contact.js +15 -2
- package/dist/components/contact.js.map +1 -1
- package/dist/components/contact.mjs +15 -2
- package/dist/components/contact.mjs.map +1 -1
- package/dist/index.js +103 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { createContext, useMemo, useContext,
|
|
2
|
+
import { createContext, useMemo, useContext, useState, useCallback, useLayoutEffect, useRef, useEffect } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { Mail, Phone, MapPin, Clock, Send } from 'lucide-react';
|
|
5
5
|
import ReCAPTCHA2 from 'react-google-recaptcha';
|
|
@@ -253,6 +253,105 @@ function useWebSDKConfig() {
|
|
|
253
253
|
const client = useWebSDK();
|
|
254
254
|
return client.getConfig();
|
|
255
255
|
}
|
|
256
|
+
var PUBLIC_PRODUCT_QUERY = `
|
|
257
|
+
query PublicProduct($slug: String!) {
|
|
258
|
+
publicProduct(slug: $slug) {
|
|
259
|
+
id
|
|
260
|
+
name
|
|
261
|
+
slug
|
|
262
|
+
description
|
|
263
|
+
status
|
|
264
|
+
logoUrl
|
|
265
|
+
website
|
|
266
|
+
appUrl
|
|
267
|
+
docsUrl
|
|
268
|
+
contactEmail
|
|
269
|
+
supportEmail
|
|
270
|
+
contactPhone
|
|
271
|
+
contactAddress
|
|
272
|
+
seoTitle
|
|
273
|
+
seoDescription
|
|
274
|
+
seoKeywords
|
|
275
|
+
ogImage
|
|
276
|
+
socialLinks
|
|
277
|
+
recaptchaSiteKey
|
|
278
|
+
rybbitSiteId
|
|
279
|
+
notificationEmail
|
|
280
|
+
metadata
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
`;
|
|
284
|
+
var ProductContext = createContext({
|
|
285
|
+
product: null,
|
|
286
|
+
loading: true,
|
|
287
|
+
error: null,
|
|
288
|
+
hasProvider: false,
|
|
289
|
+
refetch: () => {
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
function ProductProvider({ children, fallback }) {
|
|
293
|
+
const client = useWebSDK();
|
|
294
|
+
const config = useWebSDKConfig();
|
|
295
|
+
const [product, setProduct] = useState(
|
|
296
|
+
fallback ? fallback : null
|
|
297
|
+
);
|
|
298
|
+
const [loading, setLoading] = useState(true);
|
|
299
|
+
const [error, setError] = useState(null);
|
|
300
|
+
const fetchProduct = useCallback(async () => {
|
|
301
|
+
if (!config.productSlug) {
|
|
302
|
+
setLoading(false);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
setLoading(true);
|
|
306
|
+
setError(null);
|
|
307
|
+
try {
|
|
308
|
+
const result = await client.query(
|
|
309
|
+
PUBLIC_PRODUCT_QUERY,
|
|
310
|
+
{ slug: config.productSlug }
|
|
311
|
+
);
|
|
312
|
+
if (result.errors?.length) {
|
|
313
|
+
setError(result.errors[0]?.message ?? "Unknown error");
|
|
314
|
+
} else if (result.data?.publicProduct) {
|
|
315
|
+
setProduct(result.data.publicProduct);
|
|
316
|
+
}
|
|
317
|
+
} catch (err) {
|
|
318
|
+
setError(err instanceof Error ? err.message : "Failed to fetch product");
|
|
319
|
+
} finally {
|
|
320
|
+
setLoading(false);
|
|
321
|
+
}
|
|
322
|
+
}, [client, config.productSlug]);
|
|
323
|
+
useLayoutEffect(() => {
|
|
324
|
+
fetchProduct();
|
|
325
|
+
}, [fetchProduct]);
|
|
326
|
+
const value = useMemo(
|
|
327
|
+
() => ({
|
|
328
|
+
product,
|
|
329
|
+
loading,
|
|
330
|
+
error,
|
|
331
|
+
hasProvider: true,
|
|
332
|
+
refetch: fetchProduct
|
|
333
|
+
}),
|
|
334
|
+
[product, loading, error, fetchProduct]
|
|
335
|
+
);
|
|
336
|
+
return /* @__PURE__ */ jsx(ProductContext.Provider, { value, children });
|
|
337
|
+
}
|
|
338
|
+
function useProduct() {
|
|
339
|
+
return useContext(ProductContext);
|
|
340
|
+
}
|
|
341
|
+
function useProductConfig() {
|
|
342
|
+
const { product } = useProduct();
|
|
343
|
+
const config = useWebSDKConfig();
|
|
344
|
+
return {
|
|
345
|
+
// Prefer product-level config, fall back to SDK config
|
|
346
|
+
recaptchaSiteKey: product?.recaptchaSiteKey ?? config.recaptchaSiteKey ?? null,
|
|
347
|
+
rybbitSiteId: product?.rybbitSiteId ?? config.rybbitSiteId ?? null,
|
|
348
|
+
contactEmail: product?.contactEmail ?? null,
|
|
349
|
+
supportEmail: product?.supportEmail ?? null,
|
|
350
|
+
notificationEmail: product?.notificationEmail ?? product?.contactEmail ?? null,
|
|
351
|
+
productName: product?.name ?? null,
|
|
352
|
+
logoUrl: product?.logoUrl ?? null
|
|
353
|
+
};
|
|
354
|
+
}
|
|
256
355
|
function PageHead({
|
|
257
356
|
title,
|
|
258
357
|
description,
|
|
@@ -473,7 +572,9 @@ function ContactPage({
|
|
|
473
572
|
}) {
|
|
474
573
|
const client = useWebSDK();
|
|
475
574
|
const config = useWebSDKConfig();
|
|
476
|
-
const
|
|
575
|
+
const { product } = useProduct();
|
|
576
|
+
const resolvedProductId = product?.id || config.productId;
|
|
577
|
+
const displayName = productName ?? product?.name ?? config.productId;
|
|
477
578
|
const effectiveRecaptchaSiteKey = recaptchaSiteKey ?? config.recaptchaSiteKey ?? "";
|
|
478
579
|
const recaptchaRef = useRef(null);
|
|
479
580
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
@@ -502,7 +603,7 @@ function ContactPage({
|
|
|
502
603
|
const result = await submitContactForm(
|
|
503
604
|
client,
|
|
504
605
|
contactData,
|
|
505
|
-
|
|
606
|
+
resolvedProductId
|
|
506
607
|
);
|
|
507
608
|
if (result.success) {
|
|
508
609
|
setSubmitStatus("success");
|
|
@@ -762,105 +863,6 @@ function ContactPage({
|
|
|
762
863
|
] }) })
|
|
763
864
|
] });
|
|
764
865
|
}
|
|
765
|
-
var PUBLIC_PRODUCT_QUERY = `
|
|
766
|
-
query PublicProduct($slug: String!) {
|
|
767
|
-
publicProduct(slug: $slug) {
|
|
768
|
-
id
|
|
769
|
-
name
|
|
770
|
-
slug
|
|
771
|
-
description
|
|
772
|
-
status
|
|
773
|
-
logoUrl
|
|
774
|
-
website
|
|
775
|
-
appUrl
|
|
776
|
-
docsUrl
|
|
777
|
-
contactEmail
|
|
778
|
-
supportEmail
|
|
779
|
-
contactPhone
|
|
780
|
-
contactAddress
|
|
781
|
-
seoTitle
|
|
782
|
-
seoDescription
|
|
783
|
-
seoKeywords
|
|
784
|
-
ogImage
|
|
785
|
-
socialLinks
|
|
786
|
-
recaptchaSiteKey
|
|
787
|
-
rybbitSiteId
|
|
788
|
-
notificationEmail
|
|
789
|
-
metadata
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
`;
|
|
793
|
-
var ProductContext = createContext({
|
|
794
|
-
product: null,
|
|
795
|
-
loading: true,
|
|
796
|
-
error: null,
|
|
797
|
-
hasProvider: false,
|
|
798
|
-
refetch: () => {
|
|
799
|
-
}
|
|
800
|
-
});
|
|
801
|
-
function ProductProvider({ children, fallback }) {
|
|
802
|
-
const client = useWebSDK();
|
|
803
|
-
const config = useWebSDKConfig();
|
|
804
|
-
const [product, setProduct] = useState(
|
|
805
|
-
fallback ? fallback : null
|
|
806
|
-
);
|
|
807
|
-
const [loading, setLoading] = useState(true);
|
|
808
|
-
const [error, setError] = useState(null);
|
|
809
|
-
const fetchProduct = useCallback(async () => {
|
|
810
|
-
if (!config.productSlug) {
|
|
811
|
-
setLoading(false);
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
setLoading(true);
|
|
815
|
-
setError(null);
|
|
816
|
-
try {
|
|
817
|
-
const result = await client.query(
|
|
818
|
-
PUBLIC_PRODUCT_QUERY,
|
|
819
|
-
{ slug: config.productSlug }
|
|
820
|
-
);
|
|
821
|
-
if (result.errors?.length) {
|
|
822
|
-
setError(result.errors[0]?.message ?? "Unknown error");
|
|
823
|
-
} else if (result.data?.publicProduct) {
|
|
824
|
-
setProduct(result.data.publicProduct);
|
|
825
|
-
}
|
|
826
|
-
} catch (err) {
|
|
827
|
-
setError(err instanceof Error ? err.message : "Failed to fetch product");
|
|
828
|
-
} finally {
|
|
829
|
-
setLoading(false);
|
|
830
|
-
}
|
|
831
|
-
}, [client, config.productSlug]);
|
|
832
|
-
useLayoutEffect(() => {
|
|
833
|
-
fetchProduct();
|
|
834
|
-
}, [fetchProduct]);
|
|
835
|
-
const value = useMemo(
|
|
836
|
-
() => ({
|
|
837
|
-
product,
|
|
838
|
-
loading,
|
|
839
|
-
error,
|
|
840
|
-
hasProvider: true,
|
|
841
|
-
refetch: fetchProduct
|
|
842
|
-
}),
|
|
843
|
-
[product, loading, error, fetchProduct]
|
|
844
|
-
);
|
|
845
|
-
return /* @__PURE__ */ jsx(ProductContext.Provider, { value, children });
|
|
846
|
-
}
|
|
847
|
-
function useProduct() {
|
|
848
|
-
return useContext(ProductContext);
|
|
849
|
-
}
|
|
850
|
-
function useProductConfig() {
|
|
851
|
-
const { product } = useProduct();
|
|
852
|
-
const config = useWebSDKConfig();
|
|
853
|
-
return {
|
|
854
|
-
// Prefer product-level config, fall back to SDK config
|
|
855
|
-
recaptchaSiteKey: product?.recaptchaSiteKey ?? config.recaptchaSiteKey ?? null,
|
|
856
|
-
rybbitSiteId: product?.rybbitSiteId ?? config.rybbitSiteId ?? null,
|
|
857
|
-
contactEmail: product?.contactEmail ?? null,
|
|
858
|
-
supportEmail: product?.supportEmail ?? null,
|
|
859
|
-
notificationEmail: product?.notificationEmail ?? product?.contactEmail ?? null,
|
|
860
|
-
productName: product?.name ?? null,
|
|
861
|
-
logoUrl: product?.logoUrl ?? null
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
866
|
var newsletterSchema = z.object({
|
|
865
867
|
email: z.string().email("Please enter a valid email address")
|
|
866
868
|
});
|