BYCC JavaScript Files

This is the repository of JavaScript files for the BYCC website. These files are loaded dynamically on the Webflow site.

Available Files

How to Use

Add the following script to your Webflow site's head section:

<!-- BYCC JavaScript Loader - REPLICA v1.0.0 MINIFIED -->
<script>
// BYCC JavaScript Loader - REPLICA v1.0.0 - Complete replica with all fixes including contact form
!function(){const e="1.0.0",t={production:{baseUrl:"https://bycc-scripts-replica.pages.dev/src",backendUrl:"https://byy-stripe-update-prod.technology-8eb.workers.dev"},preview:{baseUrl:"https://bycc-scripts-replica.pages.dev/src",backendUrl:"https://byy-stripe-update-prod.technology-8eb.workers.dev"},development:{baseUrl:"https://bycc-scripts-replica.pages.dev/src",backendUrl:"https://byy-stripe-update-prod.technology-8eb.workers.dev"}},n={home:["radar-frontend.js"],quote:["generate-quote.js"],"custom-quote":["generate-quote.js"],cart:["cart.js"],checkout:["checkout.js"],"quote-office":["office-quote.js"],"onsite-pricing":[],acreage:["acreage-based-landing.js"],contact:["contact-form.js"],"scoop-landing":["scoop-landing.js"],"test-playground":["test-playground.js"]},o={"/cart":"cart","/checkout":"checkout","/quote":"quote","/custom-quote":"custom-quote","/contact":"contact","/get-started":"contact","/acreage":"acreage","/scoop-landing":"scoop-landing","/quote-office":"quote-office","/office/onsite-pricing":"onsite-pricing"};function s(e,t){const n=document.createElement("script");return n.type="text/javascript",n.src=e,n.onload=function(){console.log(`โœ… BYCC-REPLICA: Successfully loaded ${e}`),t&&t(null,n)},n.onerror=function(o){console.error(`โŒ BYCC-REPLICA: Error loading ${e}`,o),t&&t(o,n)},document.body.appendChild(n),n}function a(){let e=document.body.getAttribute("data-page");if(e)return console.log(`๐ŸŽฏ BYCC-REPLICA: Found data-page="${e}"`),e;const t=window.location.pathname;console.log(`๐Ÿ” BYCC-REPLICA: No data-page found, detecting from URL: ${t}`);for(const[n,s]of Object.entries(o))if(t.includes(n))return console.log(`๐ŸŽฏ BYCC-REPLICA: Auto-detected page type: ${s}`),document.body.setAttribute("data-page",s),console.log(`โœ… BYCC-REPLICA: Set data-page="${s}" automatically`),s;return console.log("๐Ÿ  BYCC-REPLICA: Defaulting to home page type"),"home"}function c(){console.log("๐Ÿ›ก๏ธ BYCC-REPLICA: Blocking conflicting scripts...");const e=window.fetch;window.fetch=function(t,n){return"string"==typeof t&&t.includes("bycc.technology-8eb.workers.dev")&&(t=t.replace("https://bycc.technology-8eb.workers.dev",window.BYCC_CONFIG?.BACKEND_BASE_URL||"https://byy-stripe-update-prod.technology-8eb.workers.dev"),console.log(`๐Ÿ”„ BYCC-REPLICA: Redirected old URL to ${t}`)),e.call(this,t,n)}}function r(){console.log("๐Ÿš€ BYCC-REPLICA: Smart loader starting...");c();const o=function(){const e=window.location.hostname;return e.includes("webflow.io")||e.includes("localhost")?(console.log("๐Ÿ”ง BYCC-REPLICA: Using development environment"),"development"):e.includes("preview")||e.includes("test")?(console.log("๐Ÿงช BYCC-REPLICA: Using preview environment"),"preview"):(console.log("๐Ÿš€ BYCC-REPLICA: Using production environment"),"production")}(),r=t[o],i=a();window.BYCC_CONFIG={BACKEND_BASE_URL:r.backendUrl,ENVIRONMENT:o,VERSION:e},console.log(`โœ… BYCC-REPLICA: Config set for ${i} page:`,window.BYCC_CONFIG);const l=`?v=${e}`;s(`${r.baseUrl}/get-products-and-prices.js${l}`,function(e){e&&console.error("โŒ BYCC-REPLICA: Failed to load get-products-and-prices.js");const t=n[i.toLowerCase()];t&&t.length>0?(console.log(`๐Ÿ“ฆ BYCC-REPLICA: Loading scripts for ${i}:`,t),t.forEach(e=>{s(`${r.baseUrl}/${e}${l}`)})):console.log(`โš ๏ธ BYCC-REPLICA: No specific scripts for page type: ${i}`)}),console.log("โœ… BYCC-REPLICA: Smart loader complete")}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r()}();
</script>

Then, add the data-page attribute to your Webflow body element on each page, for example:

<body data-page="home">