PageSourceSearch

https://www.autotrader.co.za/Bundles/client/FeaturedListings-BTJIGm72.js

js autotrader.co.za collected 2026-10-02 21:25:13 UTC 9,990 bytes, 1 lines download raw bytes

1var E=Object.defineProperty,L=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var P=(e,i,a)=>i in e?E(e,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[i]=a,x=(e,i)=>{for(var a in i||(i={}))k.call(i,a)&&P(e,a,i[a]);if(N)for(var a of N(i))M.call(i,a)&&P(e,a,i[a]);return e},v=(e,i)=>L(e,O(i));var I=(e,i,a)=>new Promise((s,n)=>{var l=r=>{try{o(a.next(r))}catch(m){n(m)}},d=r=>{try{o(a.throw(r))}catch(m){n(m)}},o=r=>r.done?s(r.value):Promise.resolve(r.value).then(l,d);o((a=a.apply(e,i)).next())});import{r as h,j as t}from"./vendor-CdyVhcFp.js";import{aq as F,E as U,b as f,o as C,x as $,u as D,a$ as B,n as R,bC as V,P as W,aA as z,i as H}from"./main-g-ZnRNk3.js";import{anQ as Y,anR as q,anS as G,anT as Q,anU as X,anV as Z,anW as _,anX as J,anY as K,anZ as ee,an_ as te,an$ as ae,ao0 as ie,ao1 as se,ao2 as ne,ao3 as re,ao4 as le,ao5 as oe,ao6 as ce,ao7 as de}from"./cssModules-BUIZcazZ.js";import{P as me}from"./ProfileClient-B7kfsLFM.js";import{F as S,P as ue,N as he}from"./PriceRatingDetail-CuyLBB_p.js";import{s as ge}from"./Toast-hz-Trfeo.js";import{B as xe}from"./Button-NOZXTRtp.js";import{F as ye}from"./FixedFooter-YB9lhFma.js";import{S as y,c as fe,t as je}from"./tour-MT0dG_Kx.js";import{P as T}from"./PriceRating-CivhFTXD.js";import{PriceRatingContent as ve}from"./PriceRatingContent-BOVQNXAS.js";import{u as Re}from"./useRecentlyViewed-BwZv0d35.js";import{G as j}from"./GalleryAction-DwoXwS2l.js";import{a as Ne,u as Pe,S as Ie}from"./useTrackingUrl-Bu58WBDG.js";import{P as Fe}from"./PriceOption-BG-6RfjE.js";import"./Spinner-iGCsqlB0.js";import"./SearchClient-DEqV1EL6.js";class Se extends h.Component{constructor(i){super(i),this.state={isFavourite:this.props.isFavourite,isLoading:!1}}toggleFavourite(i){return I(this,null,function*(){i.preventDefault(),i.stopPropagation();const a=this.state.isFavourite,s=new me;let n;try{if(this.setState({isLoading:!0,isFavourite:!a}),this.state.isFavourite)n=yield s.favouritesRemove(this.props.listingId),F.removeRecentFavourite(this.props.listingId),this.props.onUnfavourite!=null&&this.props.onUnfavourite();else{if(n=yield s.favouritesAdd(this.props.listingId),n.result===S.LimitReached){ge("error","You have reached the maximum number of favourites allowed. Please remove a favourite before adding another."),this.setState({isFavourite:a});return}U.getInstance().logFavouriteListingEvent(this.props.listingId),F.addRecentFavourite(this.props.listingId)}n.result==S.NotLoggedIn&&n.redirectUrl!==void 0&&window.location.replace(n.redirectUrl)}catch(l){this.setState({isFavourite:a})}finally{this.setState({isLoading:!1})}})}render(){let i="b-favourite";return this.state.isLoading&&(i+=" m-loading"),this.props.isInactive===!0&&this.state.isFavourite||this.props.isInactive===!1||this.props.isInactive===void 0?t.jsxs("span",{className:i,onClick:a=>this.toggleFavourite(a),children:[!this.state.isFavourite&&t.jsx(f,{name:"heart",theme:"regular",primaryColor:"warm-grey",size:"lg-20"}),this.state.isFavourite&&t.jsx(f,{name:"heart",theme:"solid-sharp",primaryColor:"light-blue",size:"lg-20"}),this.props.showText===!0&&!this.state.isFavourite&&t.jsx("span",{className:"e-favourite-text",children:"Add to Favourites"}),this.props.showText===!0&&this.state.isFavourite&&t.jsx("span",{className:"e-favourite-text",children:"Remove from Favourites"})]}):null}}const Te=e=>{const[i,a]=h.useState(!1),s=C(e.originalAmountString)?e.amountString:t.jsxs(t.Fragment,{children:[t.jsx("span",{children:e.amountString}),t.jsx("span",{children:e.originalAmountString})]});return t.jsxs(t.Fragment,{children:[s,i&&t.jsx($,{headerText:"Estimated Repayment",onClosed:()=>a(!1),colour:"blue",footer:t.jsx(ye,{children:t.jsx("div",{className:"e-footer-buttons",children:t.jsx("div",{className:"b-responsive-container",children:t.jsxs("div",{className:"row",children:[t.jsx("div",{className:"col-4"}),t.jsx("div",{className:"col-4"}),t.jsx("div",{className:"col-4",children:t.jsx(xe,{color:"blue",onClick:()=>a(!1),children:"Close"})})]})})})}),children:!e.isPOA&&t.jsx("div",{className:Y,children:t.jsx("div",{children:e.repaymentTerms})})})]})};function we(e){const i=(s,n)=>{let l="e-summary-icon";switch(s.type){case y.Demo:l+=" m-demo";break;case y.CertifiedPreOwned:l+=" m-certified-pre-owned";break;case y.ListingType:l+=" m-type";break}let d=`${s.text}-${n}`;e.keyText&&(d=e.keyText(s,n));const o=r=>(e.showIcon||r.type===y.CertifiedPreOwned)&&r.url;return t.jsxs("li",{className:l,title:s.title,children:[o(s)&&s.text!="Electric"&&s.text!="Armoured"&&t.jsx("img",{src:s.url,alt:s.title+" Icon",width:"20",height:"20"}),o(s)&&s.text=="Electric"&&t.jsx(f,{name:"charging-station",theme:"light",primaryColor:"grey"}),e.showIcon&&s.text=="Armoured"&&t.jsx(f,{name:"shield-quartered",theme:"light",primaryColor:"grey"}),s.text]},d)};let a="b-icons";return e.showSeparator&&(a+=" m-separator"),e.isFeatured&&(a+=" m-featured"),e.largeSpacing&&(a+=" m-large"),e.showIcon&&(a+=" m-icon"),t.jsx("ul",{className:a,children:e.summaryIcons.map(i)})}function w(e){const i=T[e.rating];let a=i+" Price";return e.rating==T.NoRating&&(a="No Rating"),t.jsx("span",{className:`b-price-rating m-${i.toLowerCase()}`,children:a})}const b=h.memo(e=>{const[i,a]=h.useState(!1),s=D();function n(u){return t.jsx(W,{special:u,expiryDate:u.expiryDate},u.id)}function l(){a(!0)}const d=e.enablePriceRatings&&t.jsxs("span",{className:"b-price-rating-wrapper",children:[e.showInfoModal&&t.jsxs("span",{className:"e-price-rating",onClick:l,children:[t.jsx(w,{rating:e.priceRating}),t.jsxs("span",{className:"e-detail-wrapper",children:[t.jsx(ue,{marketPriceData:e.marketPriceData,priceRating:e.priceRating}),t.jsx(B,{})]})]}),!e.showInfoModal&&t.jsx("span",{className:"e-price-rating",children:t.jsx(w,{rating:e.priceRating})})]}),o=e.priceNegotiable&&t.jsx(he,{}),r=!e.enablePriceRatings&&e.hasAnyPriceRating&&t.jsx("span",{className:"b-price-rating-placeholder"}),m=!R(e.specials)&&e.specials.map(n),g=e.hasAnySpecials&&R(e.specials)&&t.jsx("span",{className:"b-specials-placeholder"}),c=e.enablePriceRatings&&i&&e.showInfoModal&&t.jsx(V,{onClose:()=>a(!1),modalTitle:"Price Ratings",fixedHeader:!0,useMaxWidth:!0,children:t.jsx(ve,{priceRating:e.priceRating})});return d||r||m||g||c||o?t.jsxs("span",{className:`b-listing-indicators-old${s==="SmartPhone"?" m-mobile-listing-indicators":""}`,children:[d,r,m,g,c,o]}):null});b.displayName="ListingIndicatorsOld";const Ce=e=>t.jsxs("span",{className:q,children:[t.jsx(j,{size:"small",icon:t.jsx("img",{src:fe,alt:"",height:"14",width:"14"}),children:e.imageCount},`${e.listingId}-photo-count`),e.hasSpin360&&t.jsx(j,{size:"small",icon:t.jsx("img",{src:je,alt:"",height:"14",width:"14"}),children:"Tour"},`${e.listingId}-result-tile-360-container`)]},`${e.listingId}-result-tile-icons`),be=e=>t.jsxs("span",{className:G,children:[e.recentlyViewed&&t.jsx(j,{size:"small",children:"Seen"}),e.warranty&&t.jsx(j,{size:"small",children:e.warranty})]}),p=h.memo(e=>{const i=Re(e.listingId,e.recentlyViewed),a=h.useRef(null);Ne({listingId:e.listingId,tileType:e.impressionTileType,rank:e.rank},a);const{redirectUrl:s,handleRightClick:n,redirectToQueryParametersUrl:l}=Pe(e.canonicalUrl,e.queryParameters);function d(){return e.price}function o(){return t.jsx(Te,{amountString:e.estimatedMonthlyRepayment,listingUrl:e.canonicalUrl,isPOA:e.isPOA,repaymentTerms:e.repaymentTerms})}const r=()=>
1{const c=e.selectedPriceOption==Fe.EstimatedRepayment&&e.isCarsChannel&&!C(e.estimatedMonthlyRepayment),u=c?o():d(),A=c?d():o();return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:se,children:u}),e.isCarsChannel&&e.hasAnyEstimatedRepayment&&t.jsx("span",{className:ne,children:A}),e.hasAnyEstimatedRepayment&&t.jsx("div",{className:re})]})},g=e.displayWarrantyStrapLine&&e.displayFittedExtrasStrapLine&&"Warranty & Factory Extras Included"||e.displayWarrantyStrapLine&&"Warranty Included"||e.displayFittedExtrasStrapLine&&"Factory Extras Included";return t.jsx("a",{href:s,className:Q,"aria-label":"Featured Result Tile",onClick:l,onContextMenu:n,onMouseDown:c=>c.button===1&&n(),ref:c=>a.current=c,children:t.jsxs("div",{className:X,children:[t.jsxs("div",{className:`${Z} ${_}`,children:[t.jsx("img",{className:`e-image-tile ${J}`,loading:"eager",src:e.imageUrl,alt:e.sellerType===Ie.Trade?`${e.makeModelLongVariant} ${e.dealerName}`:e.makeModelLongVariant}),t.jsx(be,{recentlyViewed:i,warranty:g}),t.jsx(Ce,{listingId:e.listingId,imageCount:e.imageCount,hasSpin360:e.hasSpin360})]}),t.jsxs("span",{className:K,children:[t.jsxs("span",{className:ee,children:[t.jsx("span",{className:te,children:r()}),t.jsx("span",{className:ae,children:t.jsx(Se,{isFavourite:e.isFavourite,onUnfavourite:e.onUnfavourite,listingId:e.listingId})})]}),t.jsx(b,v(x({},e.indicators),{hasAnySpecials:e.hasAnySpecials,hasAnyPriceRating:e.hasAnyPriceRating})),t.jsxs("span",{className:ie,children:[e.registrationYear?`${e.registrationYear} `:"",e.makeModelLongVariant]}),t.jsx(we,x({keyText:(c,u)=>`${e.listingId}-summary-${u}-${c.text}`,showSeparator:!0,isFeatured:!0},e))]})]})})});p.displayName="FeaturedResultTileOld";class pe extends h.PureComponent{constructor(i){super(i),this.state={selectedIndex:0}}render(){return t.jsx("div",{className:le,children:t.jsx("div",{className:oe,children:t.jsx(z,{showDots:!0,noInlinePadding:!0,children:this.props.children})})})}}const Xe=function(e){if(H(e)||R(e.listings))return null;const i=e.listings.some(n=>"estimatedMonthlyRepayment"in n),a=e.listings.some(n=>n.isSpecial),s=e.listings.some(n=>n.indicators.enablePriceRatings);return t.jsxs("div",{className:ce,children:[t.jsx("h2",{className:de,children:e.heading}),t.jsx(pe,{children:e.listings.map((n,l)=>t.jsx(p,v(x({index:l},n),{hasAnyEstimatedRepayment:i,hasAnyPriceRating:s,hasAnySpecials:a,imageLoadType:"eager"}),`${n.listingId}-featured`))},"featured-result-tile-carousel")]})};export{Xe as FeaturedListings};

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.