This is the repository of JavaScript files for the BYCC website. These files are loaded dynamically on the Webflow site.
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">