(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{5006:(e,t,s)=>{Promise.resolve().then(s.bind(s,6261))},6261:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var r=s(2860),a=s(3200),l=s(3875),o=s(3678),n=s(7866),c=s(3618);let i="https://www.webdsites.com",d="".concat(i,"/wp-json/twx-frontend/v1/config"),x="".concat(i,"/wp-json/wc/v3/products"),h="".concat(i,"/wp-json/twx-frontend/v1/render-shortcode"),m={hidden:{opacity:0,y:50},visible:{opacity:1,y:0,transition:{duration:.8,ease:"easeOut"}}},u=e=>{let{children:t,className:s,id:l}=e,i=(0,o.s)(),[d,x]=(0,c.Wx)({triggerOnce:!0,threshold:.1});return(0,a.useEffect)(()=>{x&&i.start("visible")},[i,x]),(0,r.jsx)(n.P.section,{id:l,ref:d,initial:"hidden",animate:i,variants:m,className:"py-16 md:py-24 ".concat(s||""),children:t})},g=()=>(0,r.jsx)("nav",{className:"fixed top-0 left-0 right-0 bg-black bg-opacity-50 backdrop-blur-md p-4 z-50 shadow-lg",children:(0,r.jsxs)("div",{className:"container mx-auto flex justify-between items-center",children:[(0,r.jsx)("div",{className:"text-white text-2xl font-bold",children:"Storefront"}),(0,r.jsx)("ul",{className:"flex space-x-6",children:[{label:"Home",href:"#hero"},{label:"Products",href:"#products"},{label:"Catalogue (Shortcode)",href:"#shortcode-catalogue"},{label:"Contact",href:"#contact"}].map(e=>(0,r.jsx)("li",{children:(0,r.jsx)("a",{href:e.href,className:"text-gray-300 hover:text-white transition-colors duration-300 text-lg",children:e.label})},e.label))})]})}),p=e=>{let{phoneNumber:t,storeId:s}=e,a=s||null,l=t&&a?"https://wa.me/".concat(t.replace(/\D/g,""),"?text=Hello%20Store%20").concat(a):t?"https://wa.me/".concat(t.replace(/\D/g,"")):"#";return(0,r.jsx)(u,{id:"hero",className:"bg-gradient-to-br from-gray-900 to-gray-800 text-white text-center min-h-screen flex flex-col justify-center items-center pt-20",children:(0,r.jsxs)("div",{className:"container mx-auto px-6",children:[(0,r.jsx)(n.P.h1,{className:"text-5xl md:text-7xl font-bold mb-6",initial:{opacity:0,y:-50},animate:{opacity:1,y:0},transition:{duration:.8,delay:.2},children:"Experience Innovation."}),(0,r.jsx)(n.P.p,{className:"text-xl md:text-2xl mb-8 text-gray-300",initial:{opacity:0,y:-30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.4},children:"Discover our latest collection, crafted with precision and passion."}),t&&(0,r.jsxs)(n.P.a,{href:l,target:"_blank",rel:"noopener noreferrer",className:"bg-green-500 hover:bg-green-600 text-white font-semibold py-3 px-8 rounded-lg text-lg transition-colors duration-300 shadow-lg inline-flex items-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.6},children:[(0,r.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M17.015 13.146q0.062 0.484-0.141 0.875t-0.578 0.609q-0.406 0.234-1 0.234-0.312 0-0.734-0.078t-0.828-0.219q-1.609-0.578-3.031-1.812t-2.281-2.844q-0.125-0.25-0.187-0.484t-0.062-0.531q0-0.328 0.203-0.531t0.547-0.203q0.219 0 0.328 0.016t0.266 0.047q0.203 0.047 0.312 0.062t0.234 0.047q0.25 0 0.391-0.156t0.141-0.391q0-0.203-0.031-0.391t-0.094-0.328q-0.203-0.484-0.5-0.828t-0.562-0.5q-0.203-0.109-0.437-0.109-0.344 0-0.656 0.203-0.219 0.125-0.359 0.297t-0.25 0.391-0.172 0.484q-0.094 0.25-0.094 0.578 0 0.438 0.109 0.859t0.328 0.797q0.562 1.031 1.359 1.953t1.719 1.547q0.328 0.234 0.75 0.469t0.828 0.375q0.531 0.172 0.937 0.172 0.438 0 0.797-0.187t0.547-0.531q0.125-0.25 0.125-0.516 0-0.172-0.031-0.344t-0.109-0.297q-0.078-0.125-0.25-0.266t-0.297-0.187q-0.141-0.047-0.312-0.047-0.25 0-0.406 0.156t-0.156 0.406zM10 0q-2.016 0-3.859 0.781t-3.078 2.125-2.125 3.078-0.781 3.859 0.781 3.859 2.125 3.078 3.078 2.125 3.859 0.781q4.406 0 7.609-2.672l1.406 1.406q0.203 0.203 0.203 0.5t-0.203 0.5q-0.219 0.219-0.516 0.219t-0.5-0.203l-1.406-1.406q-1.359 0.937-2.937 1.437t-3.25 0.5q-1.969 0-3.75-0.766t-3.094-2.094-2.094-3.094-0.766-3.75 0.766-3.75 2.094-3.094 3.094-2.094 3.75-0.766q1.984 0 3.781 0.781t3.078 2.109 2.109 3.078 0.781 3.781q0 1.781-0.75 3.391t-2.062 2.828q-0.219 0.187-0.219 0.484t0.203 0.516q0.203 0.203 0.5 0.203t0.5-0.203q1.531-1.266 2.422-3.047t0.891-3.797q0-4.406-3.187-7.594t-7.594-3.187z"})}),"Chat on WhatsApp"]})]})})},f=e=>{let{product:t}=e;return(0,r.jsxs)(n.P.div,{className:"bg-white rounded-xl shadow-2xl overflow-hidden transform hover:scale-105 transition-transform duration-300 flex flex-col h-full",whileHover:{y:-10},children:[t.images&&t.images.length>0&&(0,r.jsx)("img",{src:t.images[0].src,alt:t.images[0].alt||t.name,className:"w-full h-64 object-cover"}),(0,r.jsxs)("div",{className:"p-6 flex flex-col flex-grow",children:[(0,r.jsx)("h3",{className:"text-2xl font-semibold text-gray-800 mb-2",children:t.name}),(0,r.jsx)("div",{className:"text-gray-600 mb-4 text-sm",dangerouslySetInnerHTML:{__html:t.short_description||"
No description available.
"}}),(0,r.jsxs)("p",{className:"text-3xl font-bold text-gray-900 mt-auto",children:["$",t.price]})]})]})},b=e=>{let{products:t}=e;return(0,r.jsx)(u,{id:"products",className:"bg-gray-100",children:(0,r.jsxs)("div",{className:"container mx-auto px-6",children:[(0,r.jsx)("h2",{className:"text-4xl md:text-5xl font-bold text-center text-gray-800 mb-16",children:"Our Products"}),t&&t.length>0?(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-10",children:t.map(e=>(0,r.jsx)(f,{product:e},e.id))}):(0,r.jsx)("p",{className:"text-center text-gray-600 text-xl",children:"No products found. Please check back later or ensure products are added in WooCommerce."})]})})},j=e=>{let{htmlContent:t,shortcodeLabel:s}=e;return t?(0,r.jsx)(u,{id:"shortcode-catalogue",className:"bg-gray-200",children:(0,r.jsxs)("div",{className:"container mx-auto px-6",children:[(0,r.jsx)("h2",{className:"text-4xl md:text-5xl font-bold text-center text-gray-700 mb-8",children:s}),(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:t}})]})}):(0,r.jsx)(u,{id:"shortcode-catalogue",className:"bg-gray-200",children:(0,r.jsxs)("div",{className:"container mx-auto px-6",children:[(0,r.jsx)("h2",{className:"text-4xl md:text-5xl font-bold text-center text-gray-700 mb-8",children:s}),(0,r.jsx)("p",{className:"text-center text-gray-600 text-xl",children:"Loading shortcode content or not available in this mode..."})]})})},y=()=>(0,r.jsx)(u,{id:"contact",className:"bg-gray-800 text-white",children:(0,r.jsxs)("div",{className:"container mx-auto px-6 text-center",children:[(0,r.jsx)("h2",{className:"text-3xl md:text-4xl font-bold mb-6",children:"Ready to Elevate Your Experience?"}),(0,r.jsx)("p",{className:"text-lg md:text-xl mb-8 text-gray-300",children:"Explore our full range of products or get in touch with our team today."}),(0,r.jsx)(n.P.button,{className:"bg-white text-gray-800 font-semibold py-3 px-8 rounded-lg text-lg hover:bg-gray-200 transition-colors duration-300 shadow-lg",whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>{var e;return null===(e=document.getElementById("hero"))||void 0===e?void 0:e.scrollIntoView({behavior:"smooth"})},children:"Learn More"})]})}),N=function(){let[e,t]=(0,a.useState)([]),[s,o]=(0,a.useState)(null),[n,c]=(0,a.useState)(null),[m,u]=(0,a.useState)(!0),[f,N]=(0,a.useState)(null),[v,w]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{w(!1),(async()=>{try{u(!0),N(null);{let e=await l.A.get(d);o(e.data);let s=await l.A.get(x);t(s.data);try{let e=await l.A.post(h,{shortcode:"[products]"});c(e.data.html)}catch(e){console.error("Error fetching shortcode:",e),c('Failed to load WooCommerce catalogue shortcode.
')}}}catch(t){console.error("Error fetching data:",t);let e="Failed to load data. Please ensure your WordPress and WooCommerce services are running and accessible.";l.A.isAxiosError(t)&&t.response?e+=" (Status: ".concat(t.response.status,")"):l.A.isAxiosError(t)&&t.request&&(e+=" (No response from server - check network and CORS settings on WordPress)"),N(e)}finally{u(!1)}})()},[]),m)?(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-900 text-white",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("svg",{className:"animate-spin h-10 w-10 text-blue-500 mx-auto mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,r.jsx)("p",{className:"text-xl",children:"Loading Storefront..."})]})}):f&&!v?(0,r.jsxs)("div",{className:"min-h-screen flex flex-col items-center justify-center bg-red-50 text-red-700 p-6",children:[(0,r.jsx)(g,{}),(0,r.jsxs)("div",{className:"pt-20 text-center",children:[(0,r.jsx)("h2",{className:"text-3xl font-bold mb-4",children:"Oops! Something went wrong."}),(0,r.jsx)("p",{className:"text-lg mb-2",children:'We couldn"t load the store information from WordPress.'}),(0,r.jsx)("p",{className:"text-md bg-red-100 p-4 rounded-md",children:f}),(0,r.jsxs)("p",{className:"mt-4 text-sm",children:["Please ensure your local WordPress site is running at ",(0,r.jsx)("code",{className:"bg-red-200 p-1 rounded",children:i})," and the TWX Frontend Config plugin is activated. Also, check if WooCommerce is active and has products."]}),(0,r.jsxs)("p",{className:"mt-2 text-sm",children:["Alternatively, you can enable Demo Mode by setting ",(0,r.jsx)("code",{className:"bg-red-200 p-1 rounded",children:"NEXT_PUBLIC_DEMO_MODE=true"})," in your ",(0,r.jsx)("code",{className:"bg-red-200 p-1 rounded",children:".env.local"})," file."]})]})]}):(0,r.jsxs)("main",{className:"overflow-x-hidden",children:[(0,r.jsx)(g,{}),(0,r.jsx)(p,{phoneNumber:(null==s?void 0:s.phoneNumber)||null,storeId:null==s?void 0:s.storeId}),(0,r.jsx)(b,{products:e}),(0,r.jsx)(j,{htmlContent:n,shortcodeLabel:"WooCommerce Catalogue (via Shortcode)"}),(0,r.jsx)(y,{}),(0,r.jsxs)("footer",{className:"text-center py-8 bg-gray-900 text-gray-400",children:[(0,r.jsxs)("p",{children:["\xa9 ",new Date().getFullYear()," Modern Storefront. All rights reserved."]}),(0,r.jsxs)("p",{children:["Powered by Next.js ",v?"(Demo Mode)":"& WordPress"]})]})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[332,685,411,358],()=>t(5006)),_N_E=e.O()}]);