PageSourceSearch

https://www.toyotaqatar.com/redesign/Cart-BGnrZ56K.js

js toyotaqatar.com collected 2026-10-02 20:14:23 UTC 26,776 bytes, 1 lines download raw bytes

1import{j as e,r as h,c as he,z as te,u as ge}from"./vendor-DYxW5LGU.js";import{a8 as fe,ar as ve,as as pe,at as Ce,au as be,av as je,aw as ye,b as K,am as Ne,Z as n,c as $,a9 as se,aa as le,ag as re,dz as ke,a4 as we,dv as L,ai as Te,ae as J,aj as Oe,ak as Se,al as q,aH as Pe}from"./toyota-DXGdWzqN.js";import{c as Re,a as Ae}from"./@react-router-DaRVw9c4.js";import{u as Ie}from"./usePartsAvailability-C2TiQ-24.js";import{u as Be,a as Ee}from"./usePaymentRequest-BZvvuG0x.js";import{b as S,E as k,g as _e,u as Le,a as Ue,c as Me,d as H,e as Ve}from"./orderResponse-qlUc0fJ1.js";import{b as T,c as B,J as Fe,S as M}from"./@material-B2dg908O.js";import"./@swiper-BWTHh-Bo.js";import{g as X}from"./getImageUrl-B_ic7xTZ.js";import{f as V}from"./no-image-available-mTwdaFyz.js";import{S as qe}from"./SameDayPickupBadge-D0mteVHZ.js";import"./@core-js-DtWBhRZj.js";import"./@postcss-DF7_BrDg.js";import"./@adobe-BYGCnzaY.js";import"./@lottie-web-BQRaNP8Q.js";import"./@react-query-DEPlkYZM.js";import"./@i18next-Q9yYWt2U.js";import"./@google-maps-DUKrSHjy.js";import"./@popper-CMBiYTiD.js";const He=()=>{const{mutateAsync:a}=Be(),{mutateAsync:i}=Ee(),{profile:s}=fe();return{createOrderAndRequestPayment:async({partNumbers:r,cartData:l,orderConfirmationUrl:f,orderUnsuccessfullUrl:C,finalPrice:t,currency:b})=>{var c,g,y;const p=l.map(N=>N.quantity).join(","),d=await a({materialList:r??"",quantityList:p,shippingCondition:be,street:Ce,city:pe,location:ve});localStorage.setItem("orderResponse",JSON.stringify(d));const v=(c=d==null?void 0:d.data)==null?void 0:c.transactionId,j={custom_return_url:f,override_custom_cancel_page:C,bill_to_forename:(s==null?void 0:s.firstName)??"",bill_to_surname:(s==null?void 0:s.lastName)??"",bill_to_address_country:ye,bill_to_phone:(s==null?void 0:s.checkInfMobile)??"",bill_to_email:((y=(g=s==null?void 0:s.emails)==null?void 0:g[0])==null?void 0:y.email)??"",transaction_type:je,amount:t,currency:b,transaction_uuid:v},m=await i(j);document.open(),document.write(m),document.close()}}};function Ke(a,i){return a.map(s=>{const o=i.find(l=>l.materialNumber===s.partNumber),r=o?parseInt(o.availableQuantity,10):0;return{id:s.id,partNumber:s.partNumber,nameEn:s.nameEn,nameAr:s.nameAr,requested:s.quantity,available:r}}).filter(s=>s.available<s.requested&&s.available>0)}function D(a,i){return a.map(s=>{const o=i.find(l=>l.materialNumber===s.partNumber),r=o?parseInt(o.availableQuantity,10):0;return{id:s.id,partNumber:s.partNumber,nameEn:s.nameEn,nameAr:s.nameAr,requested:s.quantity,available:r}}).filter(s=>s.available===0)}function $e(a,i){return a.map(s=>{const o=i.find(l=>l.materialNumber===s.partNumber),r=o?parseInt(o.availableQuantity,10):0;return{id:s.id,partNumber:s.partNumber,nameEn:s.nameEn,nameAr:s.nameAr,requested:s.quantity,available:r,price:s.price,originalPrice:s.originalPrice,imageUrl:s.imageUrl,currency:s.currency,unitDiscount:s.unitDiscount,cartId:s.cartId,quantity:s.quantity-r}}).filter(s=>s.available<s.requested&&s.available>0)}function Qe(a,i){const s=i.reduce((o,r)=>(o[r.materialNumber]=Number(r.availableQuantity),o),{});return a.every(o=>{const r=s[o.partNumber]||0;return o.quantity<=r})}const Ze=({size:a=24,...i})=>e.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:[e.jsx("path",{d:"M16.5301 8.83505C16.3312 8.83505 16.1404 8.75603 15.9997 8.61538C15.8591 8.47473 15.7801 8.28396 15.7801 8.08505V6.8138C15.7791 6.10856 15.4995 5.43227 15.0023 4.93219C14.505 4.43211 13.8303 4.14874 13.1251 4.1438H10.8751C10.1673 4.14479 9.48871 4.42641 8.9882 4.92692C8.48769 5.42743 8.20607 6.10598 8.20508 6.8138V8.08505C8.20508 8.28396 8.12606 8.47473 7.98541 8.61538C7.84476 8.75603 7.65399 8.83505 7.45508 8.83505C7.25617 8.83505 7.0654 8.75603 6.92475 8.61538C6.7841 8.47473 6.70508 8.28396 6.70508 8.08505V6.8138C6.70607 5.70815 7.14573 4.64807 7.92754 3.86626C8.70935 3.08445 9.76943 2.64479 10.8751 2.6438H13.1251C14.2281 2.64875 15.2844 3.09016 16.0629 3.87154C16.8415 4.65293 17.2791 5.71074 17.2801 6.8138V8.08505C17.2801 8.28396 17.2011 8.47473 17.0604 8.61538C16.9198 8.75603 16.729 8.83505 16.5301 8.83505Z",fill:"#20263B"}),e.jsx("path",{d:"M13.8752 21.24H10.1252C9.36159 21.2419 8.60512 21.0932 7.89909 20.8024C7.19306 20.5115 6.55135 20.0843 6.01072 19.545C5.47009 19.0058 5.04115 18.3652 4.74849 17.6599C4.45582 16.9546 4.30517 16.1985 4.30518 15.435V12.375C4.30518 11.6489 4.59359 10.9526 5.10697 10.4392C5.62035 9.92587 6.31665 9.63745 7.04268 9.63745H16.9577C17.6837 9.63745 18.38 9.92587 18.8934 10.4392C19.4068 10.9526 19.6952 11.6489 19.6952 12.375V15.4462C19.6937 16.2088 19.542 16.9637 19.2486 17.6677C18.9553 18.3717 18.5261 19.0109 17.9857 19.549C17.4452 20.087 16.804 20.5133 16.0987 20.8035C15.3934 21.0936 14.6378 21.2419 13.8752 21.24Z",fill:"#1FD4AF"}
1),e.jsx("path",{d:"M12 16.9049C11.8011 16.9049 11.6103 16.8259 11.4697 16.6853C11.329 16.5446 11.25 16.3539 11.25 16.1549V14.1899C11.25 13.991 11.329 13.8003 11.4697 13.6596C11.6103 13.519 11.8011 13.4399 12 13.4399C12.1989 13.4399 12.3897 13.519 12.5303 13.6596C12.671 13.8003 12.75 13.991 12.75 14.1899V16.1549C12.75 16.3539 12.671 16.5446 12.5303 16.6853C12.3897 16.8259 12.1989 16.9049 12 16.9049Z",fill:"#20263B"})]}),ze=({size:a=24,...i})=>e.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i,children:e.jsx("path",{d:"M7.50029 12.8001V5.6001H21.2003H21.3002V12.8001H7.50029ZM7.50029 12.8001V17.6001M7.50029 8.2001H2.80029V17.6001H16.0002V12.6001M21.2003 12.8001V18.4001",stroke:"black",strokeWidth:"1.5"})}),ee=a=>h.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},h.createElement("g",{clipPath:"url(#clip0_38615_103224)"},h.createElement("path",{d:"M9.0218 4.125C9.21005 4.14712 9.35967 4.3065 9.36717 4.4985V9.74737C9.36342 10.3294 8.86355 10.8592 8.25717 10.8709C6.75267 10.8802 5.24817 10.8709 3.7433 10.8709C3.15605 10.8671 2.62392 10.365 2.62017 9.74737V4.4985C2.62392 4.4025 2.63667 4.37662 2.66105 4.32825C2.76642 4.12125 3.08555 4.059 3.25992 4.23337C3.3293 4.30312 3.36605 4.3995 3.3698 4.4985C3.3698 6.24937 3.35892 8.00025 3.3698 9.75112C3.37355 9.94462 3.5438 10.1175 3.73955 10.1212C5.24217 10.1306 6.74517 10.1306 8.2478 10.1212C8.4428 10.1175 8.61642 9.94987 8.61755 9.74512V4.4985C8.62467 4.31887 8.75742 4.15612 8.93367 4.12837C8.98955 4.11937 9.00342 4.12425 9.0218 4.125ZM4.11942 2.62425V1.5C4.1213 1.43137 4.12767 1.41262 4.14042 1.37587C4.18692 1.24387 4.3118 1.14338 4.45242 1.12725C4.4708 1.12538 4.47567 1.12537 4.49442 1.125H7.49292C7.50005 1.12537 7.50717 1.12538 7.51392 1.12575C7.58217 1.13138 7.60092 1.13887 7.63655 1.1535C7.75955 1.2045 7.85067 1.3245 7.86567 1.458C7.86755 1.47637 7.86755 1.48125 7.86792 1.5V2.62425H9.74217C9.75305 2.625 9.76392 2.62537 9.7748 2.62575C9.95892 2.65012 9.97992 2.69925 10.0294 2.75812C10.1479 2.89987 10.1397 3.132 10.0073 3.26437C9.95292 3.31837 9.88242 3.35512 9.80705 3.36825C9.77855 3.3735 9.77105 3.37275 9.74217 3.37387H2.24517C2.2163 3.37275 2.2088 3.3735 2.1803 3.36825C1.88855 3.31687 1.75805 2.84775 2.05805 2.6745C2.1098 2.6445 2.13867 2.62912 2.24517 2.62425H4.11942ZM4.86905 1.87462V2.62425H7.1183V1.87462H4.86905Z",fill:"#141414"}),h.createElement("path",{d:"M5.27247 4.87394C5.34072 4.87994 5.35909 4.88707 5.39471 4.90207C5.51771 4.95269 5.60884 5.07307 5.62384 5.20619C5.62609 5.22494 5.62572 5.22982 5.62609 5.24819V8.24707C5.61822 8.53244 5.23722 8.73682 5.00172 8.52644C4.92297 8.45632 4.88059 8.38432 4.87646 8.24707V5.24819C4.87834 5.17994 4.88472 5.16082 4.89747 5.12444C4.94397 4.99244 5.06884 4.89157 5.20947 4.87582C5.24997 4.87132 5.25934 4.87357 5.27247 4.87394ZM6.75671 4.87394C6.82496 4.87994 6.84371 4.88707 6.87934 4.90207C7.00234 4.95307 7.09346 5.07307 7.10846 5.20619C7.11034 5.22494 7.10996 5.22982 7.11071 5.24819V8.24707C7.10809 8.33294 7.09684 8.36144 7.07359 8.40982C6.96297 8.63969 6.59096 8.69069 6.43009 8.46382C6.39746 8.41807 6.37571 8.36519 6.36634 8.30969C6.36259 8.28907 6.36146 8.26807 6.36109 8.24707V5.24819C6.36296 5.17994 6.36934 5.16082 6.38209 5.12444C6.42821 4.99244 6.55309 4.89157 6.69372 4.87582C6.73422 4.87132 6.74396 4.87357 6.75671 4.87394Z",fill:"#141414"})),h.createElement("defs",null,h.createElement("clipPath",{id:"clip0_38615_103224"},h.createElement("rect",{width:12,height:12,fill:"white"})))),We=({isOpen:a,onClose:i,onRemove:s,onKeep:o,title:r,subtitle:l,productName:f,partNumberText:C,partNumber:t,currentPrice:b,originalPrice:p,currency:d,imageUrl:v,removeButtonText:j,keepButtonText:m,isProcessing:c})=>{const{isMobile:g}=K();return e.jsx(Ne,{isOpen:a,onClose:i,enableSwipeToClose:!0,closeOnBackdrop:!0,children:e.jsxs("div",{className:"flex flex-col justify-center p-6 sm:px-14 sm:py-10 gap-6 sm:gap-8",children:[e.jsxs("div",{className:"text-start flex flex-col gap-4",children:[g&&e.jsx(n,{variant:"TitleBold",color:"Primary.black",children:r}),e.jsx(n,{variant:`${g?"BodyRegular":"TitleBold"}`,color:"Neutrals.800",children:l})]}),e.jsxs("div",{className:"flex items-start gap-4 w-full",children:[e.jsx("div",{className:"w-24 sm:w-48 h-24 sm:h-36 rounded-lg overflow-hidden",children:e.jsx("img",{src:v,onError:y=>{const N=y.currentTarget;N.src!==V&&(N.src=V)},alt:f,className:"w-full h-full object-contain"})}),e.jsxs("div",{className:"flex flex-col justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(n,{variant:"BodyBold",color:"Neutrals.800",children:f}),e.jsxs(n,{variant:"CaptionLargeRegular",color:"Neutrals.400",children:[C,": ",t]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:"BodyBold",color:"Primary.black",children:[b," ",d]}),p&&e.jsxs(n,{variant:"BodyLargeRegular",color:"Neutrals.400",className:"line-through",children:[p," ",d]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(T,{variant:"outlinedBlack",fullWidth:!0,onClick:s,children:c?e.jsx(B,{size:14,sx:{color:"black"}}):e.jsx(n,{variant:"BodyBold",color:"Primary.black",children:j})}),e.jsx(T,{variant:"containedBlack",fullWidth:!0,onClick:o,children:e.jsx(n,{variant:"BodyBold",color:"Functional.white",children:m})})]})]})})};function Ge({isItemOutOfStock:a,showBorder:i,keepButtonText:s,outOfStockLabel:o,partNumberText:r,product:l,removeButtonText:f,removeItemLabel:C,removeModalSubtitle:t,removeModalTitle:b,currency:p,trigger:d}){const{language:v}=$(),{isMobile:j}=K(),{data:m}=se(),{removeItem:c,increment:g,decrement:y}=le({fetchItems:!1}),N=async()=>{try{await g.mutateAsync(l.id),d({event:k.ADD_TO_CART,trigger:S.PRODUCT_INCREMENT_BUTTON,product:[l]})}catch(E){te.error(e.jsx(re,{title:(m==null?void 0:m.outOfStockLabel)??"",message:(m==null?void 0:m.outOfStockDescription)??""}),{autoClose:ke}),console.error("Error checking availability:",E)}},R=async()=>{l.quantity===1?P(!0):(await y.mutateAsync(l.id),d({event:k.CART_REMOVAL,trigger:S.PRODUCT_DECREMENT_BUTTON,product:[l]}))},[F,P]=h.useState(!1),A=()=>{P(!0),d({event:k.CTA_CLICK,trigger:S.REMOVE_INITIATE})},U=async()=>{await c.mutateAsync(l.id),P(!1),d({event:k.CART_REMOVAL,trigger:S.REMOVE,product:[l]})},I=()=>{P(!1),d({event:k.PRODUCT_RETAINED,trigger:S.KEEP_IT,product:[l]})};return e.jsxs("div",{className:he("flex gap-6 py-5",i&&"border-b border-gray-200"),children:[e.jsxs("div",{className:"relative flex justify-center overflow-hidden rounded-xl flex-shrink-0",children:[e.jsx("img",{src:X(l.imageUrl),alt:l.nameEn,className:"w-36 h-36 sm:w-40 sm:h-40 object-cover rounded-xl",loading:"lazy",onError:E=>{const w=E.currentTarget;w.src!==V&&(w.src=V)}}),j&&e.jsx(T,{onClick:A,variant:"text",className:"!absolute top-1 right-1 !bg-white !rou
1nded-full !p-1",children:e.jsx(ee,{className:"w-4 h-4 text-white"})})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:gap-3 w-full mt-1",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(n,{variant:"BodyBold",color:"Primary.black",children:v==="ar"?l.nameAr:l.nameEn}),e.jsxs(n,{variant:"CaptionLargeRegular",color:"Secondary.gray",children:[r,": ",l.partNumber]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 ",children:[e.jsxs(n,{variant:"BodyLargeBold",color:"Functional.black",children:[l.price," ",p]}),l.originalPrice>l.price&&e.jsxs(n,{variant:"BodyLargeRegular",color:"Neutrals.400",className:"line-through",children:[l.originalPrice," ",p]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(T,{onClick:R,className:"!min-w-0 !w-6 !h-6 !rounded-lg !bg-gray-100 !shadow-none hover:!bg-gray-200",children:y.isPending?e.jsx(B,{size:14,sx:{color:"black"}}):e.jsx(n,{variant:"BodyBold",color:"Functional.black",children:"-"})}),e.jsx(n,{variant:"CaptionMedium",color:"Neutrals.800",className:"!w-6 text-center",children:l.quantity}),e.jsx(T,{disabled:g.isPending,onClick:N,className:"!min-w-0 !w-6 !h-6 !rounded-lg !bg-black !shadow-none",children:g.isPending?e.jsx(B,{size:14,sx:{color:"white"}}):e.jsx(n,{variant:"BodyBold",color:"Functional.white",children:"+"})}),j&&a&&e.jsx(n,{variant:"CaptionRegular",color:"Primary.red",className:"!ms-5",children:o})]}),!j&&e.jsxs("div",{className:"flex justify-between items-start py-5",children:[e.jsx("div",{className:"flex gap-6",children:e.jsx("div",{className:"flex flex-col gap-2 sm:gap-3",children:e.jsxs(T,{variant:"text",onClick:A,className:"gap-x-1",children:[e.jsx(ee,{}),e.jsx(n,{variant:"CaptionRegular",color:"Neutrals.800",children:C})]})})}),a&&e.jsx(n,{variant:"CaptionRegular",color:"Primary.red",className:"!me-10",children:o})]})]})]}),e.jsx(We,{isOpen:F,onClose:I,onRemove:U,onKeep:I,title:b,subtitle:t,productName:v==="ar"?l.nameAr:l.nameEn,partNumber:l.partNumber,partNumberText:r,currentPrice:l.price.toString(),originalPrice:l.originalPrice>l.price?l.originalPrice.toString():"",currency:l.currency,imageUrl:X(l.imageUrl),removeButtonText:f,keepButtonText:s,isProcessing:c.isPending})]})}const Ye=({title:a,subtitle:i,buttonText:s,onButtonClick:o,emptyCartIcon:r})=>e.jsxs("div",{className:"flex flex-col items-center justify-center w-full mx-auto",children:[e.jsx("div",{className:"flex items-center justify-center mb-6",children:(r==null?void 0:r._dmS7Url)&&e.jsx("img",{src:r._dmS7Url??"",alt:"Empty cart",className:"w-54 h-54"})}),e.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[e.jsx(n,{variant:"TitleBold",color:"Primary.black",children:a}),e.jsx(n,{variant:"BodyRegular",color:"Background.800",children:i})]}),e.jsx("div",{className:"mt-6 mb-2 md:w-72 w-full max-w-xs",children:e.jsx(T,{onClick:o,variant:"containedBlack",fullWidth:!0,children:e.jsx(n,{variant:"BodyLarge",children:s})})})]}),Je=({finalAmount:a,currency:i,totalPriceLabel:s,buttonText:o,isProcessing:r,onProceedToCheckout:l})=>e.jsx("div",{className:"sticky bottom-0 left-0 right-0 bg-white px-6 py-5 sticky-container-shadow",children:e.jsxs("div",{className:"flex justify-between items-center gap-8 mx-auto",children:[e.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[e.jsxs(n,{variant:"BodyLargeBold",color:"Primary.black",children:[a," ",i]}),e.jsx(n,{variant:"CaptionRegular",color:"Primary.black",children:s})]}),e.jsx("div",{className:"max-w-xs w-full",children:e.jsx(T,{variant:"containedBlack",fullWidth:!0,onClick:l,disabled:r,children:r?e.jsx(B,{size:20,color:"inherit"}):e.jsx(n,{variant:"CaptionBold",children:o})})})]})});function ne({buttonLabel:a,imageSrc:i,onRemoveOutOfStock:s,subtitle:o,title:r,isRemoving:l}){return e.jsxs("div",{className:"flex flex-col items-start gap-4 sticky bottom-0 bg-white pt-2 sm:pt-0 px-6 sm:px-0 pb-2 sticky-container-shadow sm:!shadow-none rounded-2xl sm:rounded-none",children:[e.jsx("img",{src:(i==null?void 0:i._dmS7Url)??"",alt:"Out of stock",className:"w-16 h-16",loading:"lazy"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(n,{variant:"BodyLargeBold",color:"Functional.black",children:r}),e.jsx(n,{variant:"BodyRegular",color:"Functional.black",children:o})]}),e.jsx(T,{variant:"containedBlack",fullWidth:!0,className:"py-3",onClick:s,children:l?e.jsx(B,{size:20,color:"inherit"}):e.jsx(n,{variant:"BodyBold",color:"Functional.white",children:a})})]})}const Xe=({title:a,locationName:i,locationAddress:s,locationBadge:o})=>e.jsxs("div",{className:"flex flex-col bg-white rounded-lg shadow-card px-3.5 py-4.5 gap-4",children:[e.jsx(n,{variant:"BodyBold",color:"Primary.black",children:a}),e.jsxs("div",{className:"flex items-start gap-4 px-2 py-4 bg-white rounded-lg",children:[e.jsx("div",{className:"flex items-center justify-center rounded-lg p-1.5 bg-gray-50",children:e.jsx(ze,{className:"w-6 h-6"})}),e.jsxs("div",{className:"flex flex-col gap-2 flex-1",children:[e.jsx(n,{variant:"CaptionBold",color:"Primary.black",children:i}),e.jsx(n,{variant:"CaptionRegular",color:"Primary.black",children:s}),e.jsx("div",{className:"w-fit",children:e.jsx(qe,{text:o})})]})]})]}),De=({buttonText:a,currency:i,discounts:s,discountsPromotionsLabel:o,finalAmount:r,finalAmountLabel:l,isMobile:f,isOutOfStock:C,isProcessing:t,onProceedToCheckout:b,onRemoveOutOfStock:p,outOfStockButtonLabel:d,outOfStockImageSrc:v,outOfStockSubtitle:j,outOfStockTitle:m,securityNotice:c,title:g,totalAmount:y,totalCartAmountLabel:N,isRemoving:R})=>e.jsxs("div",{className:"flex flex-col bg-white shadow-card rounded-lg pb-10 px-4 py-5 gap-4",children:[C&&!f&&e.jsx(ne,{buttonLabel:d,imageSrc:v??null,onRemoveOutOfStock:p,subtitle:j,title:m,isRemoving:R}),e.jsx(n,{variant:"CaptionLargeMedium",color:"Primary.black",children:g}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(n,{variant:"CaptionRegular",color:"Neutrals.800",children:N}),e.jsxs(n,{variant:"CaptionBold",color:"Neutrals.800",children:[y," ",i]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(n,{variant:"CaptionRegular",color:"Neutrals.800",children:o}),e.jsxs(n,{variant:"CaptionBold",color:"Additional.brightTeal",children:[s," ",i]})]}),e.jsx("div",{className:"border-t border-gray-100"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(n,{variant:"CaptionBold",color:"Neutrals.700",children:l}),e.jsxs(n,{variant:"CaptionBold",color:"Primary.black",children:[r," ",i]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Ze,{className:"w-4 h-4"}),e.jsx(n,{variant:"CaptionRegular",color:"Neutrals.700",children:c})]})]}),!f&&!C&&e.jsx(T,{variant:"containedBlack",fullWidth:!0,onClick:b,disabled:t,children:t?e.jsx(B,{size:20,color:"inherit"}):e.jsx(n,{variant:"CaptionBold",color:"Functional.white",children:a})})]});function et({outOfStockItems:a,partNumberLabel:i,reducedOutOfStockLabel:s,reducedQuantityFromText:o,reducedQuantityText:r,reducedStockAvailableTitle:l,reducedStockItems:f,reducedStockSubText:C}){const t=[...a,...f],{language:b}=$(),p=d=>d.available===0?`${s}`:`${r} ${d.available} ${o} ${d.requested}`;return e.jsxs("div",{className:"relative border border-[#F2C02A] rounded-r-lg p-6 mb-6",children:[e.jsx("div",{className:"absolute top-0 left-0 h-full w-1.5 bg-[#F2C02A]"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Fe,{className:"text-yellow-400 ",style:{fontSize:20}}),e.jsx("div",{children:e.jsx(n,{variant:"BodyBold",color:"Functional.black",children:l})})]}),e.jsx(n,{variant:"CaptionBold",color:"Neutrals.800",children:C}),e.jsx("div",{className:"mt-3 ",children:t.map((d,v)=>e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsxs(n,{variant:"CaptionBold",color:"Neutrals.800",children:[b==="ar"?d.nameAr:d.nameEn," ",p(d)]})},v),e.jsx("div",{children:e.jsxs(n,{variant:"CaptionMedium",color:"Secondary.gray",children:[i,": ",d.partNumber]})})]}))})]})}function bt(){var G;const{data:a}=we("product-carts",!1),{removeItem:i,isLoading:s,updateQuantity:o}=le(),[r,l]=h.useState([]),[f,C]=h.useState([]),t=(G=a==null?void 0:a.components)==null?void 0:G[0],{language:b}=$(),{orderNumber:p,transactionId:d}=_e(),{isMobile:v}=K(),[j]=Re(),{data:m}=se(),c=L(u=>u.items),g=L(u=>u.totalPrice),y=L(u=>u.totalDiscounts),N=L(u=>u.totalOriginalPrice),R=Ae(),{createOrderAndRequestPayment:F}=He(),[P,A]=h.useState(!1),{checkPartsAvailability:U}=Ie(),I=h.useMemo(()=>c.map(u=>u.partNumber).join(","),[c]),{triggerCartAnalytics:E,trigger:w}=Le(),Q=j.get("paymentSuccess"),Z=h.useRef(!1);Ue({triggerCartAnalytics:E});const{ref:ae,inView:ie}=ge({threshold:.1}),{component:oe,eventInfo:ce}=h.useMemo(()=>Me(H.CART),[]),[de,ue]=h.useState();Te({component:{[H.CART]:{...oe[H.CART],...Ve(c,N,g,y),button:"","out-of-stock":r.length>0}},eventInfo:ce,isAllNeededData:c.length>0&&!!de,isVisible:ie}),h.useEffect(()=>{m&&Q===J.FAILURE&&te.error(e.jsx(re,{title:(m==null?void 0:m.failedMessageTosterLabel)??"",message:(m==null?void 0:m.failedMessageTosterDescription)??""}))},[m,j]),h.useEffect(()=>
1{Q===J.FAILURE&&c.length&&!Z.current&&(w({event:k.PURCHASE_FAILED,trigger:"purchaseFailed",product:c,transactionId:d,orderNumber:p,isSuccessfullOrder:!1,isPaymentSuccess:!1}),Z.current=!0);async function u(){const x=await U(I),O=D(c,x);l(O),ue(x)}c.length&&u()},[c]);const z=async()=>{const u=c.filter(x=>r.some(O=>O.id===x.id));w({event:k.OUT_OF_STOCK_UPDATE,trigger:S.OUT_OF_STOCK_UPDATE_TRIGGER,product:u}),await Promise.all(r.filter(x=>x.available===0).map(x=>i.mutateAsync(String(x.id)))),l([]),w({event:k.CART_VIEW,product:L.getState().items})},xe=async u=>{await Promise.all(u.map(x=>o.mutateAsync({id:String(x.id),quantity:x.available})))},me=()=>{R(q.onlineParts)},W=async()=>{A(!0);const u=await U(I);if(!Qe(c,u)){const x=Ke(c,u),O=$e(c,u),_=D(c,u);C(x),l(_),await xe(x),w({event:k.AUTO_STOCK_UPDATE,trigger:S.AUTO_STOCK_UPDATE_TRIGGER,product:O}),A(!1);return}w({event:k.CTA_CLICK,trigger:S.PROCEED_TO_CHECKOUT,product:c});try{const x=new URLSearchParams;b&&x.set("lang",b);const O=`${window.location.origin}${q.orderConfirmation}?${x.toString()}`,_=`${window.location.origin}${q.cart}?${x.toString()}`;await F({partNumbers:I,cartData:c,orderConfirmationUrl:O,orderUnsuccessfullUrl:_,finalPrice:g.toFixed(2).toString(),currency:Pe}),w({event:k.INITIATE_CHECKOUT,trigger:S.PROCEED_TO_CHECKOUT,product:c})}catch(x){console.error("Something went wrong:",x)}finally{A(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(Oe,{ref:ae,children:[e.jsx("div",{className:"mb-2",children:e.jsx(Se,{variant:"text",onClick:()=>R(-1),children:e.jsx(n,{variant:"BodyLargeRegular",color:"Functional.black",children:t==null?void 0:t.backButtonLabel})})}),s?e.jsxs("div",{className:"flex flex-col lg:flex-row gap-2 lg:gap-10 pb-6",children:[e.jsx("div",{className:"w-full lg:w-2/3 flex flex-col gap-4",children:e.jsxs("div",{className:"rounded-lg shadow-card px-2 sm:px-6 py-6",children:[e.jsx(M,{variant:"text",width:180,height:28,className:"mb-4"}),[...Array(3)].map((u,x)=>e.jsx(M,{variant:"rectangular",height:100,className:"mb-3 rounded-md"},x))]})}),e.jsxs("div",{className:"w-full lg:w-1/3 flex flex-col gap-4",children:[e.jsx(M,{variant:"rectangular",height:120,className:"rounded-md"}),e.jsx(M,{variant:"rectangular",height:200,className:"rounded-md"})]})]}):c.length===0?e.jsx("div",{className:"flex justify-center items-baseline md:h-[85vh] my-12 md:mt-36 ",children:e.jsx(Ye,{emptyCartIcon:(t==null?void 0:t.emptyCartIcon)??null,title:t==null?void 0:t.emptyCartTitle,subtitle:t==null?void 0:t.emptyCartSubtext,buttonText:t==null?void 0:t.continueSearchingButtonLabel,onButtonClick:me})}):e.jsxs("div",{className:"flex flex-col lg:flex-row gap-2 lg:gap-10 pb-6",children:[e.jsxs("div",{className:"w-full lg:w-2/3 flex flex-col gap-4 ",children:[!!(r.length||f.length)&&e.jsx(et,{outOfStockItems:r,partNumberLabel:t==null?void 0:t.partNumberLabel,reducedOutOfStockLabel:t==null?void 0:t.reducedOutOfStockLabel,reducedQuantityFromText:t==null?void 0:t.reducedQuantityFromText,reducedQuantityText:t==null?void 0:t.reducedQuantityText,reducedStockAvailableTitle:t==null?void 0:t.reducedStockAvailableTitle,reducedStockItems:f,reducedStockSubText:t==null?void 0:t.reducedStockSubText}),e.jsxs("div",{className:"rounded-lg shadow-card px-2 sm:px-6 pt-4.5",children:[e.jsx("div",{children:e.jsxs(n,{variant:"BodyBold",color:"Neutrals.800",children:[t==null?void 0:t.myCartLabel," ‎(",c.length,")‎"]})}),e.jsx("div",{className:"max-h-[calc(100vh-300px)] overflow-y-auto",children:c.map((u,x)=>{const O=r.some(Y=>Y.id===u.id&&Y.available===0),_=x===c.length-1;return e.jsx(Ge,{isItemOutOfStock:O,showBorder:!_,keepButtonText:t==null?void 0:t.keepItButtonLabel,outOfStockLabel:t==null?void 0:t.outOfStockLabel,partNumberText:t==null?void 0:t.partNumberLabel,product:u,removeButtonText:t==null?void 0:t.removeButtonLabel,removeItemLabel:t==null?void 0:t.removeItemLabel,removeModalSubtitle:t==null?void 0:t.areYouSureToRemoveItemText,removeModalTitle:t==null?void 0:t.yourMissingOnProductText,currency:t==null?void 0:t.qarLabel,trigger:w},u.id)})})]})]}),e.jsx("div",{className:"relative w-full lg:w-1/3 flex flex-col ",children:e.jsxs("div",{className:"sticky top-0 flex flex-col gap-4",children:[e.jsx(Xe,{locationAddress:t==null?void 0:t.pickupOptionsLocationAddress,locationBadge:t==null?void 0:t.sameDayPickupLabel,locationName:t==null?void 0:t.pickupOptionsLocationTitle,title:t==null?void 0:t.pickupOptionsTitle}),e.jsx(De,{title:t==null?void 0:t.pricingOverviewLabel,totalCartAmountLabel:t==null?void 0:t.totalCartAmountLabel,discountsPromotionsLabel:t==null?void 0:t.discountAndPromotionsLabel,finalAmountLabel:t==null?void 0:t.finalAmountLabel,totalAmount:N,discounts:y,finalAmount:g,currency:t==null?void 0:t.qarLabel,securityNotice:t==null?void 0:t.y
1ourPaymentSecuredText,buttonText:t==null?void 0:t.proceedToCheckoutButtonLabel,isMobile:v,onProceedToCheckout:W,isProcessing:P,isOutOfStock:r.length>0,outOfStockTitle:r.length>1?t==null?void 0:t.manyItemOutOfStockText:t==null?void 0:t.oneItemOutOfStockText,outOfStockSubtitle:r.length>1?t==null?void 0:t.manyItemOutOfStockSubtext:t==null?void 0:t.oneItemOutOfStockSubtext,outOfStockButtonLabel:t==null?void 0:t.removeItemsButtonLabel,onRemoveOutOfStock:z,outOfStockImageSrc:(t==null?void 0:t.emptyCartIcon)??null,isRemoving:i.isPending})]})})]})]}),r.length>0&&v&&e.jsx(ne,{isRemoving:i.isPending,buttonLabel:t==null?void 0:t.removeItemsButtonLabel,imageSrc:(t==null?void 0:t.emptyCartIcon)??null,onRemoveOutOfStock:z,subtitle:r.length>1?t==null?void 0:t.manyItemOutOfStockSubtext:t==null?void 0:t.oneItemOutOfStockSubtext,title:r.length>1?t==null?void 0:t.manyItemOutOfStockText:t==null?void 0:t.oneItemOutOfStockText}),v&&r.length===0&&e.jsx(Je,{buttonText:t==null?void 0:t.proceedToCheckoutButtonLabel,currency:t==null?void 0:t.qarLabel,finalAmount:g,isProcessing:P,onProceedToCheckout:W,totalPriceLabel:t==null?void 0:t.finalAmountLabel})]})}export{bt as default};

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.