PageSourceSearch

https://b2b.cafe/assets/conditions-9kGdGo6S.js

js b2b.cafe collected 2026-10-02 01:20:39 UTC 5,825 bytes, 1 lines download raw bytes

1import{r as x,u as e,bP as S,ay as w,am as C}from"./vendor-DzWMmZj2.js";import{u as T,d as E,e as K}from"./vendor-tanstack-D-s8FawA.js";import{a4 as O,u as D,b as R,p as j,a as _,Z as L,_ as I,$ as z}from"./index-DzzETE43.js";import{u as H}from"./useLockAppScroll-Dzf21vlV.js";import{u as k}from"./vendor-i18n-C7hD56hb.js";import"./vendor-socket-CdJ84v18.js";import"./vendor-phone-CDRp5aFf.js";const U=()=>({legalDocuments:(s,n)=>O({url:"/docs/legal_documents",method:"POST",headers:{"Content-Type":"application/json"},data:s},n)}),{legalDocuments:B}=U(),M="Раздел в разработке",N={cookie_policy:"cookie_policy",personal_data_policy:"personal_data_policy",agreement:"personal_data_processing_agreement",confident:"confident"},P={cookie_policy:"conditions_menu.cookie",personal_data_policy:"conditions_menu.privacy",agreement:"conditions_menu.consent",confident:j.id==="conteb2b"||j.id==="alivaria"?"conditions_menu.confident":"conditions_menu.confident_combined"},$=["cookie_policy","personal_data_policy","agreement","confident"],V=({html:r})=>{const s=x.useRef(null);return x.useEffect(()=>{var u;const n=s.current;if(!n)return;const i=(u=n.shadowRoot)!=null?u:n.attachShadow({mode:"open"});i.innerHTML=r},[r]),e.jsx("div",{ref:s})},X=({sectionKey:r,legalFiles:s,title:n})=>{const{t:i,i18n:u}=k(),[o,l]=x.useState(null),[c,g]=x.useState(!0),m=N[r],d=m?s==null?void 0:s[m]:void 0,a=d==null?void 0:d.html,h=d==null?void 0:d.pdf;if(x.useEffect(()=>{if(!a){g(!1);return}let p=!1;return g(!0),l(null),fetch(a).then(y=>y.text()).then(y=>{p||l(y)}).catch(()=>{p||l("")}).finally(()=>{p||g(!1)}),()=>{p=!0}},[a,u.language]),c)return null;const b=h?e.jsx("div",{className:"flex items-center gap-4 mt-4",children:e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-primary underline underline-offset-4",children:i("conditions_menu.pdf_view")})}):null;return o?e.jsxs("div",{children:[e.jsx(V,{html:o}),b]}):h?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:n}),b]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:n}),e.jsx("p",{className:"text-sm text-muted-foreground",children:M})]})},A=({sections:r,activeKey:s,onSelect:n})=>{const{t:i}=k(),[u,o]=x.useState(!1),l=r.find(c=>c.key===s);return H(u),e.jsxs("div",{className:"desktop:hidden",children:[e.jsxs("button",{type:"button",onClick:()=>o(!0),className:"w-full flex items-center justify-between gap-2 px-4 py-3 rounded-lg border border-border bg-background text-sm font-medium text-foreground cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{className:"size-5 shrink-0"}),i(l.titleKey)]}),e.jsx(w,{className:"size-4 shrink-0"})]}),u&&e.jsxs("div",{className:"fixed inset-0 z-99999 overflow-y-auto bg-(--background-page,#ffffff) flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsx("img",{src:j.branding.logoSrc,alt:i("common.image.logo"),className:"h-8 object-contain"}),e.jsx("button",{type:"button","aria-label":i("common.dialog.close"),onClick:()=>o(!1),className:"p-2 -mr-2 text-foreground",children:e.jsx(C,{className:"size-5"})})]}),e.jsx("div",{className:"flex flex-col divide-y divide-border",children:r.map(c=>e.jsx("button",{type:"button",onClick:()=>{n(c.key),o(!1)},className:_("w-full text-left px-4 py-3.5 text-sm font-medium transition-colors",c.key===s?"bg-primary text-primary-foreground":"text-foreground hover:bg-accent"),children:i(c.titleKey)},c.key))})]})]})},G=()=>{var b,p,y,v;const{t:r,i18n:s}=k(),n=T(),i=E(),u=D("appStore"),{country:o}=K({from:"/_app/conditions"}),l=(y=o!=null?o:(p=(b=u.user)==null?void 0:b.country)==null?void 0:p.code)!=null?y:"RU",{data:c}=R({mutationKey:["legalDocuments",l,s.language],mutationFn:()=>B({countryCode:l}),init:!0,successFn:t=>{var f;return(f=t==null?void 0:t.result)==null?void 0:f.files}}),g=(l==null?void 0:l.toUpperCase())==="BY",m=$.filter(t=>{if(!c)return!1;const f=N[t];return f?f in c:!1}).map(t=>{const f=j.id==="b2bcafe"&&g&&t==="cookie_policy"?"conditions_menu.cookie_by":P[t];return{key:t,titleKey:f}}),d=m.some(t=>t.key===n.hash),a=d?n.hash:(v=m[0])==null?void 0:v.key;if(x.useEffect(()=>{n.pathname==="/conditions"&&(d||!a||i({to:"/conditions",search:o?{country:o}:{},hash:a,replace:!0,resetScroll:!1}))},[n.pathname,d,a,i,o]),!a)return null;const h=t=>{i({to:"/conditions",search:o?{country:o}:{},hash:t,replace:!0,resetScroll:!1})};return e.jsxs("div",{className:"w-full max-w-6xl mx-auto flex flex-col desktop:flex-row gap-6 desktop:gap-12 px-4 tablet:px-6 py-6 desktop:py-10",children:[e.jsx("h1",{className:"sr-only",children:r("common.page.conditions")}),e.jsxs("aside",{className:_("w-full desktop:w-64 shrink-0 desktop:self-start","desktop:sticky desktop:overflow-y-auto desktop:scrollbar-stable","desktop:top-[calc(var(--topbar-height,0px)+var(--current-header-height,0px)+3rem)]","desktop:max-h-[calc(100svh-var(--topbar-height,0px)-var(--current-header-height,0px)-3rem)]"),children:[e.jsx(A,{sections:m,activeKey:a,onSelect:h}),e.jsx(L,{orientation:"vertical",value:a,onValueChange:t=>h(t),className:"hidden desktop:flex w-full",children:e.jsx(I,{variant:"block",color:"primary",orientation:"vertical",className:"w-full",children:m.map(t=>e.jsx(z,{value:t.key,variant:"block",color:"primary",orientation:"vertical",className:"w-full justify-start whitespace-normal! overflow-visible! text-left h-auto! py-2",children:r(t.titleKey)},t.key))})})]}),e.jsx("div",{className:"flex-1 min-w-0 pb-20",children:e.jsx("div",{className:"max-w-180",children:e.jsx(X,{sectionKey:a,legalFiles:c,title:r(m.find(t=>t.key===a).titleKey)},"".concat(a,"-").concat(s.language))})})]})},ee=G;export{ee as component};

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.