PageSourceSearch

https://www.bark.com/bwrAssets/bark-hero-DM71Mx5t.js

js bark.com collected 2026-09-24 08:01:43 UTC 12,531 bytes, 1 lines download raw bytes

1import{r as h,j as t,t as R,R as U,a as O}from"./components-BQBQZtji.js";import{B as I}from"./button-CNiWWYwJ.js";import{P,S as H,a as y,H as W}from"./hero-Lt_Ma5g4.js";import{c as V,a as A}from"./cn-Mszrrdy2.js";import{l as F,E as G,A as J,a as K,C as T,T as L}from"./category-search-BJeaBfhp.js";import{h as q}from"./url-helpers-Cqlvt3hB.js";import{m as B}from"./map-country-code-to-country-id-DlCcAJSj.js";import{u as _}from"./useTranslation-nCmqK_YE.js";import{M as S}from"./multi-media-ClvzuAVR.js";import{u as z}from"./hooks-8QOLz7j2.js";const c=[];for(let e=0;e<256;++e)c.push((e+256).toString(16).slice(1));function X(e,s=0){return(c[e[s+0]]+c[e[s+1]]+c[e[s+2]]+c[e[s+3]]+"-"+c[e[s+4]]+c[e[s+5]]+"-"+c[e[s+6]]+c[e[s+7]]+"-"+c[e[s+8]]+c[e[s+9]]+"-"+c[e[s+10]]+c[e[s+11]]+c[e[s+12]]+c[e[s+13]]+c[e[s+14]]+c[e[s+15]]).toLowerCase()}const Y=new Uint8Array(16);function Z(){return crypto.getRandomValues(Y)}function w(e,s,r){return crypto.randomUUID?crypto.randomUUID():Q(e)}function Q(e,s,r){e=e||{};const n=e.random??e.rng?.()??Z();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,X(n)}function C(e){if(typeof document>"u")return null;const r=`; ${document.cookie}`.split(`; ${e}=`);return r.length===2?r.pop()?.split(";").shift()??null:null}function M(e,s,r=365){if(typeof document>"u")return;const n=new Date;n.setTime(n.getTime()+r*24*60*60*1e3);const a=`expires=${n.toUTCString()}`;document.cookie=`${e}=${s};${a};path=/;SameSite=Lax`}function ee(){if(typeof document>"u")return{};const e={},s=document.cookie.split(";");for(const r of s)try{const n=r.split("="),a=n[0]?.replace(/^ /,""),o=n[1];a&&o&&(e[decodeURIComponent(a)]=decodeURIComponent(o))}catch{continue}return e}function te(e){const s={},r=["^utm_","^trk_","^campaign$","^gclid$","^msclid$","^fbclid$"];for(const[n,a]of Object.entries(e))for(const o of r)if(new RegExp(o).test(n)){s[n]=a;break}return s}function se(){if(typeof globalThis.window>"u")return{};const e={},s=new URLSearchParams(globalThis.location.search),r=["gclid","msclid","fbclid","campaign"];for(const n of r){const a=s.get(n);a&&(e[n]=a)}for(const[n,a]of s.entries())(n.startsWith("utm_")||n.startsWith("trk_"))&&(e[n]=a);return e}function ne(){return te(ee())}function re(){return{...ne(),...se()}}function ae(){if(typeof globalThis.window>"u")return"";try{const e=sessionStorage.getItem("seller_list_session_id");if(e)return e;const s=w();return sessionStorage.setItem("seller_list_session_id",s),s}catch{return""}}function $(e,s){if(typeof globalThis.window>"u")return"";try{const r=`search_id_${e.toString()}_${s??"alid"}`,n=localStorage.getItem(r);if(n)return n;const a=w();return localStorage.setItem(r,a),a}catch{return""}}function oe(){try{const e=C("search_session_id");if(e)return e;const s=w();return M("search_session_id",s),s}catch{return""}}function ce(){try{const e=C("bes-token");if(e)return e;const s=w();return M("bes-token",s),s}catch{return""}}function ie(){try{const e=C("bark_mkt_session");if(!e)return{};const s=e.includes("%")?decodeURIComponent(e):e,r=JSON.parse(s);if(!r.marketingParams)return{};const n={};for(const[a,o]of Object.entries(r.marketingParams))n[a]=typeof o=="object"&&"S"in o?o.S:o;return n}catch{return{}}}function le(){try{if(typeof document>"u")return"";const e=document.referrer;if(!e)return"";const s=new URL(e);return s.hostname===globalThis.location.hostname?"":s.hostname}catch{return""}}function ue(){return globalThis.location.pathname}function de(e){try{const s={...re()},r=ie();Object.assign(s,r);const n=le();n&&(s.trk_initial_referrer=n);const a=ue();return a&&(s.trk_bark_landing_page=a),JSON.stringify(s)}catch{return"{}"}}function Ie(e,s,r){return{search_list_id:ae(),search_id:$(e,s),session_id:ce(),search_session_id:oe(),marketing_tracking:de(),source:"landing_page"}}const E=h.createContext(void 0);function me(){const e=h.useContext(E);if(e===void 0)throw new Error("usePageContext must be used within a PageContext");const s=h.useMemo(()=>({searchID:$(e.category.externalId,e.googleLocationId),isLandingPage:!0}),[e.category.externalId,e.googleLocationId]),r=h.useCallback((n,a)=>{F(G,n,{...s,...a}
1)},[s]);return{...e,logEvent:r}}const Pe=({children:e,category:s,externalCategoryData:r=null,sellers:n,popularPlaces:a,articleCollection:o,reviews:i,locationName:u="",googleLocationId:d=null,resolvedLocation:l={source:"unknown"},pageType:m,pageMeta:x,qaFilters:g,preAppliedFilterName:f,hasStandaloneTailoredQuotes:j=!1})=>{const p=h.useMemo(()=>({locationName:u,category:s,externalCategoryData:r,sellers:n,googleLocationId:d,resolvedLocation:l,articleCollection:o,pageType:m,popularPlaces:a,reviews:i,pageMeta:x,qaFilters:g,preAppliedFilterName:f,hasStandaloneTailoredQuotes:j}),[u,s,r,n,d,l,o,m,a,i,x,g,f,j]);return t.jsx(E.Provider,{value:p,children:e})};function N({label:e,accentBackground:s=!1,showSubmitButton:r=!0,iconName:n="hollow-pin",onSubmit:a,onSelect:o,defaultValue:i,inputVariant:u="default"}){const{locale:d}=R(),{t:l}=_(),m=U.useMemo(()=>({delay:500,countryId:B(d)}),[d]);return t.jsx(J,{iconName:n,autocompleteOptions:m,fetchUrl:"https://api.bark.com/location",label:e,placeholder:l("search.locationPlaceholder"),formatResult:x=>x.name,emptyMessage:l("search.emptyMessage"),searchMessage:l("search.searchMessage"),onSubmit:a,onSelect:o,buttonLabel:l("search.buttonLabel"),accentBackground:s,defaultValue:i,dataCy:"location-search",showSubmitButton:r,inputVariant:u})}function xe(e,s){return K("https://api.bark.com/location",e,s)}const fe=A("",{variants:{accentBackground:{true:"rounded-lg bg-primary-accent px-2 py-4"}}});function k({label:e,className:s,accentBackground:r=!1,inputVariant:n="default"}){const a=R(),o=O(),[i,u]=U.useState(null),{t:d}=_(),{category:l,locationName:m,qaFilters:x}=me(),g=xe(m,{countryId:B(a.locale)}).suggestions?.[0],f=j=>{if(!j){u(d("search.error.location"));return}u(null);const p=new URLSearchParams(o.search);if(p.set("location",j.match),!a.lang||!a.locale)return;const b=q({lang:a.lang,locale:a.locale,slug:l.slug,searchParams:p.toString(),qaFilters:x});window.location.assign(b)};return t.jsxs("div",{className:V("mx-auto w-full max-w-3xl",s),children:[t.jsx("div",{className:fe({accentBackground:r}),children:t.jsx(N,{label:e,accentBackground:r,onSubmit:f,onSelect:f,defaultValue:g,inputVariant:n})}),i&&t.jsx("div",{className:"mt-2 text-xs text-destructive","data-cy":"location-error",children:i})]})}const v=({multiMedia:e,isDesktop:s})=>s?t.jsx("div",{className:"relative mr-4 flex w-1/3 pr-4 pb-4",children:t.jsxs("div",{className:"rotate-[-5.56deg]",children:[t.jsx(S,{...e,rounded:"xl",asset:{...e.asset,assetWidth:450,width:void 0,height:void 0}}),t.jsx(P,{})]})}):t.jsxs("div",{className:"-ml-4 flex-1 rotate-[-5.56deg]",children:[t.jsx(S,{...e,rounded:"xl",asset:{...e.asset,assetWidth:1e3,width:void 0,height:void 0}}),t.jsx(P,{})]}),D=({multiMedia:e})=>t.jsxs("div",{className:"relative flex-[0.79] rotate-[8.57deg]",children:[t.jsx(S,{...e,rounded:"xl"}),t.jsx(H,{})]});function he({multiMedia:e,secondaryMedia:s,highlight:r=null,text:n=null,subtitle:a,dataTestId:o,headingClassName:i}){return n?t.jsx("header",{"data-testid":o,"data-slot":"hero-section",className:"container",children:t.jsx("div",{className:"mx-auto flex justify-center",children:t.jsxs("div",{className:"flex max-w-full justify-center",children:[t.jsxs("div",{className:"hidden items-center justify-between py-8 lg:flex",children:[t.jsxs("div",{className:"flex w-1/2 flex-col gap-10",children:[t.jsx("div",{className:"text-left",children:t.jsx(y,{text:n,highlight:r,subtitle:a,headingClassName:i})}),t.jsx("div",{className:"ml-4",children:t.jsx(k,{})})]}),e?.asset.url&&t.jsx(v,{multiMedia:e,isDesktop:!0})]}),t.jsxs("div",{className:"flex flex-col items-center justify-between gap-8 py-6 lg:hidden",children:[t.jsxs("div",{className:"flex items-center justify-center gap-8 overflow-hidden py-8",children:[e?.asset.url&&t.jsx(v,{multiMedia:e,isDesktop:!1}),s&&t.jsx(D,{multiMedia:s})]}),t.jsxs("div",{className:"flex w-full flex-col justify-start gap-6",children:[t.jsx("div",{className:"pr-8 text-left",children:t.jsx(y,{text:n,highlight:r,subtitle:a})}),t.jsx(k,{className:"mx-4 w-auto"})]})]})]})})}):null}function ge({multiMedia:e,secondaryMedia:s,highlight:r=null,text:n=null,subtitle:a,dataTestId:o,headingClassName:i}){const[u,d]=h.useState(null),[l,m]=h.useState(null),[x,g]=h.useState(null),{t:f}=_(),j=z({hasModal:!0,closeOnExit:!0,allowPolarisRedirect:!0}),p=h.useCallback(async()=>
1{if(!u&&!l){g(f("search.error.categoryAndLocation"));return}if(!u){g(f("search.error.category"));return}if(!l){g(f("search.error.location"));return}g(null),await j({category_id:u.id,locationData:l})},[j,u,l,f]),b=h.useCallback(()=>{p().catch(console.error)},[p]);return n?t.jsx("header",{"data-testid":o,"data-slot":"hero-section",className:"container",children:t.jsx("div",{className:"mx-auto flex justify-center",children:t.jsxs("div",{className:"flex max-w-full justify-center",children:[t.jsxs("div",{className:"hidden items-center justify-between py-8 lg:flex",children:[t.jsxs("div",{className:`flex flex-col gap-10 ${e?.asset.url?"w-3/5":"w-full"}`,children:[t.jsx("div",{className:"text-left",children:t.jsx(y,{text:n,highlight:r,headingClassName:i})}),t.jsxs("div",{className:"mr-4 ml-4 rounded-lg bg-bark-blue p-4",children:[t.jsx("p",{className:"pb-2 text-base text-background",children:a}),t.jsxs("div",{className:"flex flex-row gap-2",children:[t.jsx("div",{className:"w-full",children:t.jsx(T,{accentBackground:!0,showSubmitButton:!1,onSubmit:d,onSelect:d})}),t.jsx("div",{className:"w-full",children:t.jsx(N,{accentBackground:!0,showSubmitButton:!1,onSubmit:m,onSelect:m,iconName:"hollow-pin"})}),t.jsx(I,{onClick:b,children:"Continue"})]}),x&&t.jsx("div",{className:"mt-2 text-xs text-destructive","data-cy":"location-error",children:x})]})]}),e?.asset.url&&t.jsx(v,{multiMedia:e,isDesktop:!0})]}),t.jsxs("div",{className:"flex flex-col items-center justify-between gap-8 py-6 lg:hidden",children:[t.jsxs("div",{className:"flex items-center justify-center gap-8 overflow-hidden py-8",children:[e?.asset.url&&t.jsx(v,{multiMedia:e,isDesktop:!1}),s&&t.jsx(D,{multiMedia:s})]}),t.jsxs("div",{className:"flex w-full flex-col justify-start gap-6",children:[t.jsx("div",{className:"text-left",children:t.jsx(y,{text:n,highlight:r,headingClassName:i})}),t.jsxs("div",{className:"mr-4 ml-4 rounded-lg bg-bark-blue p-4",children:[t.jsx("p",{className:"pb-2 text-base text-background",children:a}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(T,{accentBackground:!0,showSubmitButton:!1,onSubmit:d,onSelect:d}),t.jsx(N,{accentBackground:!0,showSubmitButton:!1,onSubmit:m,onSelect:m,iconName:"hollow-pin"}),t.jsx(I,{onClick:b,children:"Continue"})]}),x&&t.jsx("div",{className:"mt-2 text-xs text-destructive","data-cy":"location-error",children:x})]})]})]})]})})}):null}function je({multiMedia:e,secondaryMedia:s,highlight:r=null,text:n=null,subtitle:a,dataTestId:o,headingClassName:i}){return n?t.jsx("header",{"data-testid":o,className:"bg-gradient-to-b from-primary-light from-0% to-background to-50% lg:to-100%","data-slot":"hero-section",children:t.jsx("div",{className:"container",children:t.jsx("div",{className:"mx-auto flex justify-center",children:t.jsxs("div",{className:"flex max-w-full justify-center",children:[t.jsxs("div",{className:"hidden items-center justify-between py-20 lg:flex",children:[t.jsxs("div",{className:"flex w-1/2 flex-col gap-8",children:[t.jsx(y,{text:n,highlight:r,subtitle:a,headingClassName:i}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(k,{className:"mx-4 rounded-lg bg-background"}),t.jsx(L,{templateName:"Micro Combo"})]})]}),e?.asset.url&&t.jsx(v,{multiMedia:e,isDesktop:!0})]}),t.jsx("div",{className:"flex flex-col items-center justify-between py-10 lg:hidden",children:t.jsxs("div",{className:"flex w-full flex-col justify-start gap-6",children:[t.jsx("div",{className:"text-left md:text-center",children:t.jsx(y,{text:n,highlight:r,subtitle:a})}),t.jsxs("div",{className:"flex w-auto flex-col items-start gap-6 px-4 md:items-center",children:[t.jsx(k,{className:"rounded-lg bg-background"}),t.jsx("div",{className:"mx-auto",children:t.jsx(L,{templateName:"Micro TrustScore"})})]})]})})]})})})}):null}function Te(e){return e.variant==="location-search"?t.jsx(he,{...e}):e.variant==="category-location-search"?t.jsx(ge,{...e}):e.variant==="trustpilot"?t.jsx(je,{...e}):t.jsx(W,{...e})}export{Te as B,Pe as P,xe as a,Ie as b,k as c,$ as g,me as u,w as v};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.