PageSourceSearch

https://editor-assets-ab.periodica.press/bundle/CartPage-D8bXMlHC.js

js periodica.press collected 2026-10-02 14:56:17 UTC 19,798 bytes, 1 lines download raw bytes

1import{r as c,j as e,di as oe,aj as N,bA as ce,bZ as J,C as r,R as C,P as f,y as D,e as w,f as ie,o as j,dj as K,dk as S,d6 as le,dl as de,d3 as y,d1 as V,d8 as ue,db as me,d2 as _e,bU as he,ak as pe,b5 as xe,D as O,N as ee,ao as je,am as ge,V as fe,h as se,m as F,F as ve,w as Ce,ae as be,aM as H,ah as I,U as ke,dm as ye,i as Ne,dn as Pe,dp as we,ag as Ee,ai as q,df as Be,O as Se}from"./index-C_CbUvha.js";import{p as Fe,u as Te,C as De}from"./useValidatePromocodes-Dza6Xyb4.js";import{N as M}from"./Number-BAFoleFz.js";import{I as R,M as Le}from"./Modal-DH0KiJvA.js";import{P as Re,C as ze}from"./index-BU9EtngL.js";import{e as Ie}from"./index-BNKOB6z_.js";import{g as Me,C as Ae}from"./useGetProductsForChange-B5P67Nqm.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"periodica-ba54bdcc90450fbeaa16d2d5c0ff60bfc1871774"};var n=new s.Error().stack;n&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[n]="b4201d28-930d-4d1f-b500-d5a70b5e9878",s._sentryDebugIdIdentifier="sentry-dbid-b4201d28-930d-4d1f-b500-d5a70b5e9878")}catch{}})();const $e="_stepper_19ran_1",W="_stepperButton_19ran_7",Ue="_left_19ran_19",Ve="_right_19ran_23",G="_disabled_19ran_27",Oe="_stepperInput_19ran_32",T=1,z=1e3;function He({value:s,onChange:n,ariaLabelGood:t="предметов в заказе"}){const[d,a]=c.useState(()=>s),l=c.useRef(null),m=c.useCallback(i=>{const u=Math.min(Math.max(Number.isNaN(i)?T:i,T),z);n(u),a(u)},[n]);return e.jsxs("div",{className:$e,children:[e.jsx("input",{type:"number",inputMode:"numeric",ref:l,value:d,className:Oe,onBlur:()=>m(d),onChange:i=>a(Number.parseInt(i.target.value,10)),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),m(d))},min:T,max:z}),e.jsx("button",{type:"button",tabIndex:-1,"aria-label":`Уменьшить количество ${t} на 1`,className:N(W,Ue,s===T&&G),onClick:()=>{m(s-1),l.current?.focus()},children:e.jsx(oe,{size:20})}),e.jsx("button",{type:"button",tabIndex:-1,"aria-label":`Увеличить количество ${t} на 1`,className:N(W,Ve,s===z&&G),onClick:()=>{m(s+1),l.current?.focus()},children:e.jsx(ce,{size:20})})]})}const qe="_tagContainer_jnw2m_1",We="_icon_jnw2m_10",Ge="_closeButton_jnw2m_20",Ye="_iconContainer_jnw2m_28";function Qe({icon:s,children:n,name:t,onClick:d}){const a=()=>{d&&d(t)};return e.jsxs("div",{className:N([qe,s&&We]),children:[s&&s,n,e.jsx("button",{className:Ge,type:"button","aria-label":"Удалить тэг",onClick:a,children:e.jsx("span",{className:Ye,children:e.jsx(J,{size:16})})})]})}const Xe="_containerBanner_1ktfl_1",Ze="_banner_1ktfl_11",Je="_link_1ktfl_18",Y="_img_1ktfl_43",Ke="_onlyOneBanner_1ktfl_50",es="_mobileBannerHidden_1ktfl_59",ss="_mobileBannerVisible_1ktfl_63",ts="/assets/banners/cartBannerSale-long.jpeg",ns="/assets/banners/cartBannerSale-short.jpeg",Q=[{index:1,image:{longBanner:ts,shortBanner:ns}}];function as(){const s=()=>{r.analytics.logEvent({name:"event_editor_banner_cart"})},n=Q.length===2;return e.jsx("div",{className:Xe,onClick:s,children:Q.map(({index:t,url:d,image:a})=>e.jsxs("div",{className:Ze,children:[e.jsx("img",{className:N({[Y]:!0,[Ke]:!n}),src:n?a.shortBanner:a.longBanner,alt:"banner"}),e.jsx("img",{className:N({[Y]:!0,[es]:!0,[ss]:!n}),src:a.shortBanner,alt:"banner"}),d?e.jsx("a",{className:Je,href:d,target:"_blank",rel:"noreferrer"}):null]},t))})}const rs="https://editor-assets-ab.periodica.press/bundle/notebook-BvL1HXZ7.jpg",os="https://editor-assets-ab.periodica.press/bundle/photobook-wmbDB-7X.jpg",cs="_banner_x2l7r_1",is="_link_x2l7r_13",ls="_img_x2l7r_30",ds="_bannersList_x2l7r_36",us="/assets/banners/cartBannerSale-short.jpeg",ms=[{index:1,image:us},{index:2,url:"https://periodica.press/products/photobooks/",image:os},{index:3,url:"https://periodica.press/products/notebooks/",image:rs}];function _s(){return e.jsx("div",{className:ds,children:ms.map(s=>c.createElement(hs,{...s,key:s.index}))})}function hs({image:s,url:n}){const t=()=>{r.analytics.logEvent({name:"event_editor_banner_EmptyCart"})};return e.jsxs("div",{className:cs,onClick:t,children:[n?e.jsx("a",{className:is,href:n,target:"_blank",rel:"noreferrer"}
1):null,e.jsx("img",{className:ls,src:s,alt:"Banner-image"})]})}const ps="_cartEmpty_wkk92_1",xs="_upperContent_wkk92_8",js="_mainText_wkk92_20",gs="_link_wkk92_26",fs="_underContent_wkk92_31",vs="_dividerBlock_wkk92_40",Cs="_divider_wkk92_40",bs="_banners_wkk92_57",ks="https://periodica.press/products";function ys(){return e.jsxs("div",{className:ps,children:[e.jsxs("div",{className:xs,children:[e.jsxs("div",{className:js,children:[e.jsx(C,{variant:"h1",children:"Корзина пустая"}),e.jsx(f,{weight:"normal",size:"large",children:"Похоже, вы еще не добавили в корзину ни один продукт."})]}),e.jsx(D,{size:"large",asChild:!0,children:e.jsx("a",{href:ks,rel:"nofollow",className:gs,children:"В каталог"})})]}),e.jsx("div",{className:vs,children:e.jsx("div",{className:Cs})}),e.jsx("div",{className:fs,children:e.jsxs("div",{className:bs,children:[e.jsx(C,{variant:"h2",children:"Вам может понравиться"}),e.jsx(_s,{})]})})]})}const Ns="_cartProduct_1hw97_1",Ps="_info_1hw97_23",ws="_titleLine_1hw97_30",Es="_actionLine_1hw97_31",Bs="_actionGroup_1hw97_60";function X({product:s,cartItemId:n,status:t,title:d}){const a=w(),l=ie(),m=j(r.selectors.getProjectsIsProcessing),u=j(r.selectors.checkedItemsIsFetching)||m,v=c.useCallback(async()=>{(await r.alertService.fire({title:"Дублировать продукт",text:"Вы сможете отредактировать дубликат, при этом первоначальный продукт сохранится."}))?.value&&a(r.actions.project.createProductCopy(s.type,s.size||"",n))},[n,a,s.size,s.type]),o=c.useCallback(async()=>{if((await r.alertService.fire({title:"Удалить продукт из корзины?"}))?.value){let E="event_editor_project_remove_from_cart";s.type===K&&(E="event_editor_remove_product_upsale"),r.analytics.logEvent({name:E}),S.logRemoveFromCart({name:s.name??"",type:s.type}),a(r.actions.project.removeProjectFromCart(n,s.type))}},[n,a,s.type,s.name]),g=c.useCallback(()=>{a(r.actions.project.editProduct(n)),S.logRemoveFromCart({name:s.name??"",type:s.type}),l(`/projects/${n}`)},[n,a,l,s]),p=c.useCallback(_=>{_<s.orderCount?S.logRemoveFromCart({name:s.name??"",type:s.type}):_>s.orderCount&&S.logAddToCart({type:s.type,name:s.name||""}),a(r.actions.project.setProductCount(n,_))},[n,a,s]);return e.jsxs("div",{className:Ns,children:[u&&e.jsx(le,{}),e.jsx(de,{projectId:n,disabled:!y(t)}),e.jsxs("div",{className:Ps,children:[e.jsxs("div",{className:ws,children:[V(s.type)?e.jsxs("div",{children:[e.jsx(f,{size:"large",weight:"emphasized",color:y(t)?void 0:"tertiary",children:d}),e.jsx(f,{size:"small",color:"secondary",children:s.name||""})]}):e.jsx(f,{size:"large",weight:"emphasized",color:y(t)?void 0:"tertiary",children:s.name||""}),y(t)&&e.jsxs(C,{variant:"h3",customTag:"p",children:[e.jsx(M,{maximumFractionDigits:2,children:(s.basePrice||0)*s.orderCount})," ₽"]})]}),t!==ue.Enabled?e.jsx(Re,{status:t,productType:s.type}):null,e.jsxs("div",{className:Es,children:[y(t)&&e.jsx(He,{onChange:p,value:s.orderCount}),!y(t)&&!me(s.type)&&e.jsx("div",{children:e.jsx(ze,{projectId:n,productId:s.id||0,pageCount:s.maxCount||0})}),e.jsxs("div",{className:Bs,children:[V(s.type)&&_e(t)&&e.jsxs(e.Fragment,{children:[e.jsx(R,{icon:e.jsx(he,{}),onClick:g,title:"Редактировать"}),e.jsx(R,{icon:e.jsx(pe,{}),onClick:v,title:"Создать копию"})]}),e.jsx(R,{icon:e.jsx(xe,{}),onClick:o,title:"Удалить из корзины"})]})]})]})]})}const Z="_cartProducts_1polk_1";function Ss({canOrderItems:s,otherItems:n}){return e.jsxs(e.Fragment,{children:[s.length>0?e.jsx("div",{className:Z,children:s.map(t=>e.jsx(X,{product:t.product.info,cartItemId:t.id,status:t.state||"",title:t.title||O},`cart-product-${t.id}`))}):null,n.length>0?e.jsxs("div",{className:Z,children:[e.jsx(C,{variant:"h3",children:"Недоступны для заказа"}),n.map(t=>e.jsx(X,{product:t.product.info,cartItemId:t.id,status:t.state||"",title:t.title||O},`cart-product-${t.id}`))]}):null]})}const Fs="_tagContainer_17y7k_1",Ts="_tagList_17y7k_6";function Ds({onDelete:s}){const n=j(r.selectors.getPromocodes);return e.jsxs("div",{className:Fs,children:[e.jsx(f,{size:"small",color:"secondary",children:"Можно применить один промокод и Ð
1½ÐµÑÐºÐ¾Ð»ÑŒÐºÐ¾ сертификатов и бонусных кодов"}),n.length?e.jsx("div",{className:Ts,children:n.map(t=>e.jsx(Qe,{icon:t.kind==="certificate"?e.jsx(je,{}):e.jsx(ge,{}),onClick:()=>{s(t?.value,t.kind),ee({text:`${t.kind==="certificate"?"Сертификат":"Промокод"} отменен`})},children:t.value},t.value))}):null]})}const Ls="_promoField_1eqdu_1",Rs="_fluidInput_1eqdu_7",zs="_button_1eqdu_11",Is="_promoForm_1eqdu_15";function Ms(){const s=w(),{currentUser:n}=fe(),[t,d]=c.useState(""),[a,l]=c.useState(""),[m,i]=c.useState(void 0),{promocodes:u,options:v}=j(h=>({promocodes:r.selectors.getPromocodes(h),options:r.selectors.getCartProducts(h)})),o=u.at(-1),g=c.useRef(o),{data:p,isFetching:_,isError:E}=se(Fe(a,v,n?.id)),b=p&&!("error"in p)?p:void 0,A=p&&"error"in p?p.error:void 0,te=c.useMemo(()=>r.selectors.getNextPromocodesAndNotificationText(b),[b]),k=j(te);c.useEffect(()=>{if(!_&&!Ie(g.current,b)&&b&&k.notificationText&&(ee({text:k.notificationText}),d(""),F.logEvent({name:k.gtmText}),k.updatedPromocodes.length)){const h=k.updatedPromocodes.map(P=>P.value),B=new Set(h);h.length!==B.size&&r.errorReporter.logError("cart_discount_apply_double"),s(r.actions.order.updatePromocodes(k.updatedPromocodes)),g.current=b}},[b,_,k,s]),c.useEffect(()=>{!u.length&&g.current&&(g.current=void 0)},[u]),c.useEffect(()=>{t===""&&(i(void 0),l(""))},[t]);const $=()=>{const h=t.trim();F.logEvent({name:"e_e_cart_discount_try"}),u.some(P=>P.value.toLowerCase()===h.toLowerCase())?(F.logEvent({name:"e_e_cart_discount_exist"}),i("exist")):l(h)},ne=(h,B)=>{F.logEvent({name:`e_e_cart_${B}_tag_delete`});const P=u.filter(re=>re.value!==h);s(r.actions.order.updatePromocodes(P)),g.current?.value===h&&(g.current=void 0),i(void 0)};if(E)return e.jsx(f,{size:"large",children:"Промокоды временно недоступны."});const U=!_&&a!==""&&a===t,ae=u.find(h=>h.value.toLowerCase()===t.toLowerCase()),L=A&&U||m;return e.jsxs("form",{className:Is,onSubmit:h=>{h.preventDefault(),$()},children:[e.jsx(ve,{label:"Промокод или сертификат",name:"promocode",description:u.length&&!L?e.jsx(As,{promocode:g.current??o}):void 0,error:L?e.jsx(Us,{reason:A||m,kind:ae?.kind==="certificate"?"сертификат":"промокод"}):void 0,children:e.jsxs("div",{className:Ls,children:[e.jsx(Ce,{name:"promocode",value:t,onChange:d,className:Rs,error:L}),e.jsx(be,{size:"large",variant:"secondary",onClick:$,className:zs,loading:_,disabled:U&&!!b?.value,children:"Применить"})]})}),e.jsx(Ds,{onDelete:ne})]})}function As({promocode:s}){return s.kind==="certificate"?e.jsx($s,{promocode:s}):e.jsx(e.Fragment,{children:"Промокод активирован. Ура, магия сработала!"})}function $s({promocode:s}){const{lastCertificateBalance:n}=j(r.selectors.getOrderSumAndDiscounts);return e.jsxs(e.Fragment,{children:["На балансе сертификата ",s.value," осталось"," ",e.jsx(M,{maximumFractionDigits:2,children:n})," ₽."]})}function Us({reason:s,kind:n}){switch(s){case"exist":return e.jsxs(e.Fragment,{children:["Упс! В корзине уже применен этот ",n,"."]});case"disabled":return e.jsx(e.Fragment,{children:"Упс! Этот промокод вам недоступен."});case"empty":return e.jsxs(e.Fragment,{children:["Что-то пошло не так. Попробуйте позже или ",e.jsx(H,{children:"напишите в поддержку"}),"."]});case"expired":return e.jsx(e.Fragment,{children:"К сожалению, срок действия этого промокода истек."});case"need-login":case"need_login":return e.jsx(Vs,{});case"not-valid":case"not_valid":return e.jsx(e.Fragment,{children:"Промокода не существует или он больше не активен."});case"repeat-purchase":case"repeat_purchase":return e.jsx(e.Fragment,{children:"Этот промокод работает только для первой покупки."});
1case"zero":return e.jsx(e.Fragment,{children:"На балансе вашего сертификата осталось 0 ₽. Оплата им невозможна"});case"special_cannot_be_applied":return e.jsx(e.Fragment,{children:"Этот промокод не подходит к вашему заказу."});case"no_applicable_products":return e.jsx(e.Fragment,{children:"В корзине нет продуктов, на которые действует промокод."});case"other_user":return e.jsx(e.Fragment,{children:"Этот промокод вам недоступен."});case"self_referral":return e.jsx(e.Fragment,{children:"Вы не можете применить промокод, который выпустили сами."});default:return e.jsxs(e.Fragment,{children:["Что-то пошло не так. Попробуйте позже или ",e.jsx(H,{children:"напишите в поддержку"}),"."]})}}function Vs(){const s=w();return e.jsxs(e.Fragment,{children:[e.jsx(I,{asChild:!0,children:e.jsx("button",{type:"button",onClick:()=>s(ke()),children:"Авторизуйтесь"})}),", чтобы применить промокод. Это займет всего пару секунд!"]})}const Os="_container_1mcan_1",Hs="_summary_1mcan_7",qs=c.forwardRef(function({className:n,summary:t,content:d,initial:a=!0},l){const[m,i]=c.useState(a);return c.useImperativeHandle(l,()=>({toggle:()=>i(u=>!u),open:()=>i(!0),close:()=>i(!1)}),[]),e.jsxs("div",{className:N(Os,n),children:[e.jsxs("button",{className:Hs,type:"button",onClick:()=>i(u=>!u),children:[t,e.jsx(ye,{style:{transform:`rotate(${m?180:0}deg)`},size:20})]}),m?d:null]})}),Ws="_postCard_i27uf_14",Gs="_cardPreview_i27uf_29",Ys="_cardPreviewButton_i27uf_37",Qs="_cardTexts_i27uf_72",Xs="_title_i27uf_84",Zs="_cardPrice_i27uf_85",Js="_cardButton_i27uf_100",Ks="_cardFull_i27uf_110",et="_description_i27uf_117",st="_cardModalDialog_i27uf_131",tt="_cardModalDialogClose_i27uf_141",x={postCard:Ws,cardPreview:Gs,cardPreviewButton:Ys,cardTexts:Qs,title:Xs,cardPrice:Zs,cardButton:Js,cardFull:Ks,description:et,cardModalDialog:st,cardModalDialogClose:tt};function nt({description:s,link:n,previewUrl:t,price:d,title:a,onClick:l}){const[m,i]=c.useState(!1);return e.jsxs("div",{className:x.postCard,children:[e.jsx("button",{type:"button",className:x.cardPreviewButton,onClick:()=>i(!0),children:e.jsx("img",{className:x.cardPreview,src:t,alt:a})}),e.jsxs("div",{className:x.cardTexts,children:[e.jsx("div",{className:x.title,children:a}),s&&e.jsx(f,{className:x.description,children:s}),n&&e.jsx(f,{children:e.jsx(I,{href:n,target:"_blank",rel:"noreferrer",children:"Подробнее"})}),e.jsxs("div",{className:x.cardPrice,children:[" ",e.jsx(M,{children:d})," ₽"]})]}),e.jsx(D,{type:"button",variant:"secondary",size:"medium",className:x.cardButton,onClick:l,children:"Добавить"}),e.jsxs(Le,{customClassName:x.cardModalDialog,show:m,onClose:()=>i(!1),closeOnEscape:!0,children:[e.jsx(J,{className:x.cardModalDialogClose,size:24}),e.jsx("img",{className:x.cardFull,src:t,alt:a})]})]})}const at="_upSaleBlock_6ruta_1",rt="_upSaleContent_6ruta_13",ot="_upSaleCategories_6ruta_31";function ct({loadUpSaleProducts:s}){const n=w(),[t,d]=c.useState("0"),{data:a,isLoading:l,isError:m}=se({...Me(),enabled:s}),i=s&&l,u=o=>()=>{r.analytics.logEvent({name:"event_editor_add_product_upsale"}),n(r.actions.storageProducts.addStorageProductToCart({productId:o}))},v=o=>{t!==o&&(d(o),r.analytics.logEvent({name:`event_editor_upsale_category_${o}`}))};return i?e.jsx(Ne,{title:""}):!m&&a&&a.hasItems?e.jsx("div",{className:at,children:e.jsx(qs,{className:rt,summary:e.jsx(C,{variant:"h3",customTag:"p",children:"Дополните заказ особенными деталями"}),content:e.jsxs(e.Fragment,{children:[a.hasCategories&&e.jsx("div",{className:ot,children:Object.keys(a.categories)?.map(o=>e.jsx(D,{onClick:()=>v(o),size:"medium",variant:o!==t?"secondary":"brandPrimary",children:Ae[o].name},o))}),(a.hasCategories?a.categories[t]:a.items)?.map(o=>
1e.jsx(nt,{title:o.title,description:o.description,previewUrl:o.previewUrl,price:o.price,link:o.link,onClick:u(o.id)},`${o.category}_${o.size}`))]})})}):null}const it=s=>s.map(n=>n?.product?.info?.id).filter(n=>n!==void 0).sort();function lt(){Te();const s=w(),n=j(r.selectors.getCartItems),t=j(r.selectors.checkedItemsSelector),d=j(r.selectors.checkedItemsHasFetchingError),a=j(r.selectors.checkedItemsIsFetching),{canOrderItems:l,otherItems:m}=c.useMemo(()=>Pe({items:n,checkedItems:t,isCheckLoading:a}),[n,t,a]),i=j(r.selectors.getCartProductIds),u=c.useRef([]);c.useEffect(()=>{const _=it(n);u.current.toString()!==_.toString()&&(s(r.actions.project.checkCartItems(i)),u.current=_)},[n,i,s]);const v=c.useRef(!0);if(c.useEffect(()=>{if(l.length>0&&v.current){const _=we(l);r.analytics.logViewCart(_),v.current=!1}},[l]),c.useEffect(()=>{n.length>0&&(s(r.actions.project.checkCartItems(i)),s(r.actions.project.initCart()))},[]),d)return e.jsxs("div",{children:[e.jsx("div",{className:"cart__head-wrapper",children:e.jsx(C,{children:"Корзина"})}),e.jsx("div",{className:"cart__wrapper",children:e.jsx(Ee,{message:"Не удалось загрузить товары в корзине. Пожалуйста, попробуйте обновить страницу.",eventName:"event_editor_cartErr_help",hasHelpButton:!0})})]});const o=!!(l?.length||m?.length),p=l.map(_=>_.product.info.type).every(_=>_===K);return e.jsx("div",{children:o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"cart__head-wrapper",children:e.jsx(C,{children:"Корзина"})}),e.jsxs("div",{className:"cart__wrapper",children:[e.jsx(Ss,{canOrderItems:l,otherItems:m}),e.jsxs(f,{children:["Макеты ваших проектов хранятся в разделе"," ",e.jsx(I,{asChild:!0,children:e.jsx(q,{to:"../projects",children:"«Мои проекты»"})})," — их можно использовать, если вы захотите напечатать копии или фотокниги с похожим содержанием."]})]}),e.jsx(ct,{loadUpSaleProducts:o}),e.jsx("div",{className:"cart__cart_banner",children:e.jsxs("div",{className:"cart__content",children:[e.jsx(C,{variant:"h2",customTag:"p",children:"Вам может понравиться"}),e.jsx(as,{})]})}),e.jsx("div",{className:"cart__cart_total",children:e.jsx("div",{className:"cart__cart_total_content",children:e.jsx(De,{})})}),e.jsxs("div",{className:"cart__fieldBlock",children:[e.jsx(Ms,{}),e.jsxs("div",{className:"cart__btn_and_text",children:[e.jsx(D,{size:"xLarge",asChild:!0,disabled:!l.length||p,children:e.jsx(q,{to:"../checkout",className:"cart__btn",children:"Перейти к оформлению"})}),p&&e.jsx(f,{size:"small",color:"secondary",children:"Добавьте товар, собранный в конструкторе, чтобы продолжить"})]})]})]}):e.jsx(ys,{})})}function jt(){return e.jsx(Be,{children:e.jsx("div",{className:"cart-page__wrapper",children:e.jsxs("div",{className:"cart-page__cart",children:[e.jsx(Se,{title:"Корзина"}),e.jsx(lt,{})]})})})}export{jt 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.