(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[565],{8873:function(e,a,s){Promise.resolve().then(s.bind(s,3886))},3886:function(e,a,s){"use strict";s.r(a),s.d(a,{default:function(){return l}});var t=s(7437),r=s(2265),n=s(605),i=s(155),o=s(9215),c=s(8349);function l(){var e;let[a,s]=(0,r.useState)("storeshifted"),[l,d]=(0,r.useState)(null),[h,u]=(0,r.useState)(!1),[m,f]=(0,r.useState)(""),{data:g,status:p}=(0,n.useSession)(),[v,_]=(0,r.useState)({name:"",street1:"",city:"",state:"",zip:"",country:"US",phone:""});async function j(e){u(!0),f("");try{let a=await fetch("/api/cart/get?slug=".concat(e)),s=await a.json();if(!a.ok)throw Error(s.error||"Failed to load cart");d(s.cart)}catch(e){f(e.message||"Failed to load cart.")}finally{u(!1)}}async function x(e,s){u(!0);try{let t=await fetch("/api/cart/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemId:e,quantity:s})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to update cart");await j(a)}catch(e){f(e.message||"Failed to update cart.")}finally{u(!1)}}async function y(e){u(!0);try{let s=await fetch("/api/cart/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemId:e})}),t=await s.json();if(!s.ok)throw Error(t.error||"Failed to remove item");await j(a)}catch(e){f(e.message||"Failed to remove item.")}finally{u(!1)}}async function N(){u(!0),f("");try{let e=await fetch("/api/cart/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:a,shippingAddress:v})}),s=await e.json();if(!e.ok)throw Error(s.error||"Checkout failed");window.location.href=s.url}catch(e){f(e.message||"Checkout failed.")}finally{u(!1)}}(0,r.useEffect)(()=>{let e=window.localStorage.getItem("connectStoreSlug");e&&s(e)},[]),(0,r.useEffect)(()=>{j(a)},[a]);let b=null!==(e=null==l?void 0:l.items.reduce((e,a)=>e+a.unitAmount*a.quantity,0))&&void 0!==e?e:0;return(0,t.jsxs)("main",{className:"cart-page",children:[(0,t.jsx)(i.default,{}),(0,t.jsx)(o.default,{}),(0,t.jsx)("section",{className:"section",children:(0,t.jsxs)("div",{className:"container cart-page__inner",children:[(0,t.jsx)("h1",{className:"page-title",children:"Cart"}),"authenticated"===p?(0,t.jsxs)("p",{className:"connect-muted",children:["Signed in as ",g.user.email]}):(0,t.jsxs)("p",{className:"connect-muted",children:["Sign in to save your cart across devices. ",(0,t.jsx)("a",{href:"/login",children:"Sign in"})]}),m?(0,t.jsx)("div",{className:"connect-message",children:m}):null,(0,t.jsxs)("div",{className:"cart-list",children:[null==l?void 0:l.items.map(e=>(0,t.jsxs)("div",{className:"cart-item",children:[(0,t.jsxs)("div",{className:"cart-item__info",children:[(0,t.jsx)("div",{className:"cart-item__name",children:e.name}),(0,t.jsxs)("div",{className:"cart-item__price",children:[(e.unitAmount/100).toFixed(2)," ",e.currency.toUpperCase()]})]}),(0,t.jsxs)("div",{className:"cart-item__actions",children:[(0,t.jsx)("input",{type:"number",min:1,value:e.quantity,onChange:a=>x(e.id,Number(a.target.value))}),(0,t.jsx)("button",{className:"btn btn--ghost",onClick:()=>y(e.id),children:"Remove"})]})]},e.id)),(null==l?void 0:l.items.length)?null:(0,t.jsx)("div",{className:"storefront-muted",children:"Your cart is empty."})]}),(0,t.jsxs)("div",{className:"cart-shipping",children:[(0,t.jsx)("h2",{children:"Shipping"}),(0,t.jsx)("div",{className:"cart-shipping__grid",children:(0,t.jsxs)("div",{className:"cart-shipping__card",children:[(0,t.jsx)("h3",{children:"Ship To"}),(0,t.jsx)("input",{value:v.name,onChange:e=>_({...v,name:e.target.value}),placeholder:"Name"}),(0,t.jsx)("input",{value:v.street1,onChange:e=>_({...v,street1:e.target.value}),placeholder:"Street"}),(0,t.jsx)("input",{value:v.city,onChange:e=>_({...v,city:e.target.value}),placeholder:"City"}),(0,t.jsx)("input",{value:v.state,onChange:e=>_({...v,state:e.target.value}),placeholder:"State/Province"}),(0,t.jsx)("input",{value:v.zip,onChange:e=>_({...v,zip:e.target.value}),placeholder:"Postal Code"}),(0,t.jsx)("input",{value:v.country,onChange:e=>_({...v,country:e.target.value}),placeholder:"Country"})]})})]}),(0,t.jsxs)("div",{className:"cart-summary",children:[(0,t.jsxs)("div",{children:["Total: ",(b/100).toFixed(2)," USD"]}),(0,t.jsx)("button",{className:"btn",onClick:N,disabled:h||!(null==l?void 0:l.items.length),children:"Checkout"})]})]})}),(0,t.jsx)(c.Z,{})]})}},155:function(e,a,s){"use strict";s.d(a,{default:function(){return l}});var t=s(7437),r=s(7648),n=s(2265),i=s(1276),o=s(605);let c=["/icons/merchicon1.png","/icons/merchicon2.png","/icons/merchicon3.png","/icons/merchicon4.png"];function l(e){let{forceScrolled:a=!1}=e,[s,l,d,h,u,m,f,g]=i.a,[p,v]=(0,n.useState)(0),[_,j]=(0,n.useState)(a),{data:x,status:y}=(0,o.useSession)();return"authenticated"===y&&(x.user.name||x.user.email),(0,n.useEffect)(()=>{let e=setInterval(()=>v(e=>(e+1)%c.length),3e3);return()=>clearInterval(e)},[]),(0,n.useEffect)(()=>{if(a){j(!0);return}let e=()=>{if(window.innerWidth<981){j(!1);return}let e=window.scrollY;j(a=>a?e>80:e>140)};return e(),window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[a]),(0,n.useEffect)(()=>{if(window.innerWidth>=981)return document.body.classList.toggle("so-header-scrolled",_),()=>document.body.classList.remove("so-header-scrolled")},[_]),(0,t.jsx)("header",{className:"so-header".concat(_?" so-header--scrolled":""),children:(0,t.jsxs)("div",{className:"container",children:[(0,t.jsxs)("div",{className:"so-header__top",children:[(0,t.jsxs)("div",{className:"so-header__left",children:[(0,t.jsx)(r.default,{href:"/",className:"so-home","aria-label":"Home",children:(0,t.jsx)("span",{className:"so-home__icon"})}),(0,t.jsx)(r.default,{href:"/merch",className:"so-merch","aria-label":"Merch",children:c.map((e,a)=>(0,t.jsx)("img",{src:e,className:"so-merch__icon"+(a===p?" so-merch__icon--active":""),alt:""},e))})]}),(0,t.jsx)(r.default,{href:"/",className:"so-header__logo-wrap",children:(0,t.jsx)("img",{src:"/icons/logo.png",className:"so-header__logo",alt:"Shifted Offroad"})}),(0,t.jsxs)("div",{className:"so-header__right",children:[(0,t.jsx)(r.default,{href:"/rewards",className:"so-rewards",children:(0,t.jsx)("span",{className:"so-rewards__icon"})}),(0,t.jsx)(r.default,{href:"/cart",className:"so-cart",children:(0,t.jsx)("span",{className:"so-cart__icon"})})]})]}),(0,t.jsxs)("div",{className:"so-header__categories",children:[(0,t.jsx)("nav",{className:"so-header__nav so-header__nav--left",children:[s,u,l,g].map(e=>(0,t.jsx)(r.default,{href:"/category/".concat((0,i.F)(e)),className:"so-navitem",children:e},e))}),(0,t.jsx)("nav",{className:"so-header__nav so-header__nav--right",children:[d,m,h,f].map(e=>(0,t.jsx)(r.default,{href:"/category/".concat((0,i.F)(e)),className:"so-navitem",children:e},e))})]})]})})}},8349:function(e,a,s){"use strict";s.d(a,{Z:function(){return i}});var t=s(7437),r=s(7648),n=s(1276);function i(){return(0,t.jsxs)("footer",{className:"footer",children:[(0,t.jsxs)("div",{className:"container footer__inner",children:[(0,t.jsxs)("div",{className:"footer__brand",children:[(0,t.jsx)("img",{src:"/icons/logo.png",alt:"Shifted Offroad",style:{height:54,width:"auto",display:"block",marginBottom:10},decoding:"async",loading:"lazy"}),(0,t.jsx)("div",{style:{opacity:.9,fontSize:13,lineHeight:1.65},children:"Shifted Offroad (Kelowna, BC) is an offroad parts and accessories company built around real fitment, honest advice, and clean installs. We focus on parts that work as advertised, pair well with common builds, and hold up to the conditions that actually get trucks and SUVs used the way they should be."}),(0,t.jsx)("div",{style:{opacity:.9,fontSize:13,lineHeight:1.65,marginTop:10},children:"Our catalog blends trail-ready essentials with smart upgrades that improve capability without compromising daily drivability. Whether you are dialing in stance, lighting, recovery, or cargo utility, we help you choose components that fit your vehicle and your goals."}),(0,t.jsx)("div",{style:{opacity:.9,fontSize:13,lineHeight:1.65,marginTop:10},children:"We are easy to reach, fast to respond, and focused on getting it right the first time. The goal is a simple, confident purchase and a setup you are proud to run."})]}),(0,t.jsxs)("div",{className:"footer__col footer__col--categories",children:[(0,t.jsx)("h4",{children:"Categories"}),n.a.map(e=>(0,t.jsx)(r.default,{href:"/category/".concat((0,n.F)(e)),children:e},e))]}),(0,t.jsxs)("div",{className:"footer__col footer__col--support",children:[(0,t.jsx)("h4",{children:"Support"}),(0,t.jsx)(r.default,{href:"/contact",children:"Contact"}),(0,t.jsx)(r.default,{href:"/legal/faq",children:"FAQ"}),(0,t.jsx)(r.default,{href:"/legal/warranty",children:"Warranty"})]}),(0,t.jsxs)("div",{className:"footer__col footer__col--legal",children:[(0,t.jsx)("h4",{children:"Legal"}),(0,t.jsx)(r.default,{href:"/legal/privacy-policy",children:"Privacy Policy"}),(0,t.jsx)(r.default,{href:"/legal/terms-of-service",children:"Terms of Service"}),(0,t.jsx)(r.default,{href:"/legal/refund-policy",children:"Refund Policy"}),(0,t.jsx)(r.default,{href:"/legal/cookies",children:"Cookies"})]})]}),(0,t.jsx)("div",{className:"footer__payments",children:(0,t.jsxs)("div",{className:"container footer__payments-inner",children:[(0,t.jsx)("div",{children:"Secure checkout powered by trusted processors."}),(0,t.jsxs)("div",{className:"footer__payment-logos",children:[(0,t.jsx)("img",{src:"/assets/payments/visa.svg",alt:"Visa",loading:"lazy",decoding:"async"}),(0,t.jsx)("img",{src:"/assets/payments/visa-alt.svg",alt:"Visa",loading:"lazy",decoding:"async"}),(0,t.jsx)("img",{src:"/assets/payments/stripe.svg",alt:"Stripe",loading:"lazy",decoding:"async"}),(0,t.jsx)("img",{src:"/assets/payments/paypal.svg",alt:"PayPal",loading:"lazy",decoding:"async"})]})]})})]})}},9215:function(e,a,s){"use strict";s.d(a,{default:function(){return c}});var t=s(7437),r=s(7648),n=s(2265),i=s(1276),o=s(605);function c(e){let{forceScrolled:a=!1}=e,[s,c]=(0,n.useState)(a),[l,d]=(0,n.useState)(!1),[h,u]=(0,n.useState)(null);(0,o.useSession)();let m={Interior:"/categories/cat-interior.png",Tools:"/categories/cat-tools.png",Exterior:"/categories/cat-exterior.png",Drivetrain:"/categories/cat-drivetrain.png",Lighting:"/categories/cat-lighting.png",Suspension:"/categories/cat-suspension.png",Audio:"/categories/cat-audio.png",Performance:"/categories/cat-performance.png"};(0,n.useEffect)(()=>{if(a){c(!0),d(!1);return}let e=()=>{let e=window.scrollY;c(a=>a?e>80:e>140),d(a=>e>140&&a)};return e(),window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[a]);let f=e=>{var a,s;u(null!==(s=null===(a=e.touches[0])||void 0===a?void 0:a.clientY)&&void 0!==s?s:null)},g=e=>{var a,t;if(null===h)return;let r=(null!==(t=null===(a=e.changedTouches[0])||void 0===a?void 0:a.clientY)&&void 0!==t?t:h)-h;s&&!l&&r<-40?d(!0):l&&r>40&&d(!1),u(null)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("header",{className:"so-header so-header--mobile".concat(s?" so-header--shrunk":"").concat(l?" so-header--hidden":""),onTouchStart:f,onTouchEnd:g,children:(0,t.jsxs)("div",{className:"container so-header__mobile",children:[(0,t.jsx)("div",{className:"so-header__top",children:(0,t.jsx)(r.default,{href:"/",className:"so-header__logo-wrap",children:(0,t.jsx)("img",{src:"/icons/logo.png",className:"so-header__logo",alt:"Shifted Offroad"})})}),(0,t.jsxs)("div",{className:"so-header__categories",children:[(0,t.jsx)("nav",{className:"so-header__nav so-header__nav--mobile",children:i.a.map(e=>(0,t.jsx)(r.default,{href:"/category/".concat((0,i.F)(e)),className:"so-navitem",style:{backgroundImage:"url(".concat(m[e]||"",")")},children:(0,t.jsx)("span",{className:"so-navitem__label",children:e})},e))}),(0,t.jsx)(r.default,{href:"/cart",className:"so-mobile-corner so-mobile-corner--home","aria-label":"Cart",children:(0,t.jsx)("span",{className:"so-mobile-corner__icon so-mobile-corner__icon--cart","aria-hidden":"true"})}),(0,t.jsx)(r.default,{href:"/",className:"so-mobile-corner so-mobile-corner--cart","aria-label":"Home",children:(0,t.jsx)("span",{className:"so-mobile-corner__icon so-mobile-corner__icon--home","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"so-header__mobile-tools",children:[(0,t.jsx)("input",{className:"so-header__search",type:"search",placeholder:"Search","aria-label":"Search"}),(0,t.jsx)(r.default,{href:"/login",className:"so-auth-icon","aria-label":"Sign in",children:(0,t.jsx)("span",{className:"so-auth-icon__glyph","aria-hidden":"true"})})]})]})]})}),(0,t.jsx)("button",{type:"button",className:"so-header__pulltab so-header__pulltab--visible".concat(l?" so-header__pulltab--hidden":"").concat(s?" so-header__pulltab--shrunk":""),onClick:()=>d(!1),onTouchStart:f,onTouchEnd:g,"aria-label":l?"Show header":"Hide header",children:(0,t.jsx)("span",{className:"so-header__pulltab-grip"})})]})}},1276:function(e,a,s){"use strict";s.d(a,{F:function(){return r},a:function(){return t}});let t=["Interior","Exterior","Lighting","Audio","Tools","Suspension","Performance","Drivetrain"];function r(e){return e.toLowerCase()}},7648:function(e,a,s){"use strict";s.d(a,{default:function(){return r.a}});var t=s(2972),r=s.n(t)}},function(e){e.O(0,[972,605,971,117,744],function(){return e(e.s=8873)}),_N_E=e.O()}]);