PageSourceSearch

https://www.which.co.uk/static/deliver/static/js/pages-reviews-pro…son-ProductComparisonPage.f0b27e64.chunk.js

js which.co.uk collected 2026-10-01 07:37:54 UTC 10,271 bytes, 2 lines download raw bytes

1"use strict";(this.__LOADABLE_LOADED_CHUNKS__=this.__LOADABLE_LOADED_CHUNKS__||[]).push([["pages-reviews-product-comparison-ProductComparisonPage"],{"./src/pages/reviews/product-comparison/ProductComparisonPage.tsx"(t,e,s){s.r(e),s.d(e,{default:()=>C,getAttributesCount:()=>f});var o=s("../../node_modules/react/index.js"),a=s("../../node_modules/react-router/esm/react-router.js"),r=s("./src/generated/frontend.ts"),n=s("./src/shared/components/Error/index.ts"),i=s("./src/shared/components/Loader/index.ts"),c=s("./src/shared/contexts/CompareTrayContext.tsx"),d=s("./src/shared/templates/PageTemplate.tsx"),u=s("./src/shared/usePageProps.tsx"),l=s("./src/pages/reviews/product-comparison/ComparisonTableContext.ts"),p=s("./src/pages/reviews/product-comparison/hooks/useProductComparisonComponents.tsx"),g=s("./src/pages/reviews/product-comparison/hooks/useProductComparisonPageMetaTags.ts"),m=s("./src/pages/reviews/product-comparison/reducers/comparisonTable.reducer.ts"),x=s("./src/pages/reviews/product-comparison/reducers/comparisonTableActionTypes.ts"),y=s("../../node_modules/react/jsx-runtime.js");const C=()=>{const{compareTrayItems:t,setTaxonomySlug:e,taxonomySlug:s}=(0,o.useContext)(c.j),{categorySlug:C}=(0,a.g)();(0,o.useEffect)(()=>{C&&s!==C&&e(C)},[e,s,C]);const{context:T}=(0,u.l)(),h=Array.isArray(t)&&t.length>0?t.map(t=>t.businessKey):[""],[_,v]=(0,o.useReducer)(m.comparisonTableReducer,m.comparisonTableInitialState),{loading:P,error:w,data:b}=(0,r.T0c)({variables:{categorySlug:C,context:T||"",productsIds:h},notifyOnNetworkStatusChange:!0}),k=(0,p.useProductComparisonComponents)(),{getPageMetaTags:N}=(0,g.useProductComparisonPageMetaTags)(),{meta:j={}}=b?.productComparisonPage||{};return(0,o.useEffect)(()=>{b?.productComparisonPage&&v({type:x.UPDATE_PRODUCT_COMPARISON_PAGE_DATA,data:b.productComparisonPage})},[b,v]),P?(0,y.jsx)(i.a,{}):w?(0,y.jsx)(n.A,{error:w}):b?.productComparisonPage?(0,y.jsx)(l.ComparisonTableContext.Provider,{value:{state:_,dispatch:v},children:(0,y.jsx)(d.U,{metaTags:N({meta:j,noIndex:!0,attributesCount:f(_.productDetails)}),components:k})}):(0,y.jsx)(n.h,{pageName:"Product Comparison Page"})},f=t=>({productsCount:t?.length||0,testedProductsCount:T("tested",t),notTestedProductsCount:T("ntpd",t),bestBuyCount:h("best buy",t),dontBuyCount:h("don't buy",t),firstLookCount:h("first look",t)}),T=(t,e)=>{const s=e?.filter(e=>e.testedType===t);return s?.length||0},h=(t,e)=>{const s=e?.filter(e=>e.badges?.includes(t));return s?.length||0}},"./src/pages/reviews/product-comparison/get-data-layer-script.tsx"(t,e,s){s.r(e),s.d(e,{getDataLayerScriptContent:()=>a});var o=s("./src/shared/utils/remove-url-query-string-and-fragment.ts");const a=({meta:t,attributesCount:e,fullUrl:s})=>{const{bestBuyCount:a,dontBuyCount:r,firstLookCount:n,notTestedProductsCount:i,testedProductsCount:c,productsCount:d}=e||{};if(!d||d<=0)return{};const u=t.dataLayer?.[1]?.paidAccess,l=t.dataLayer?.[0]?.loginStatus,p="LoggedIn"===l&&"paid"===u;return{loginStatus:l,content_type:"compare",paidAccess:t.dataLayer?.[1]?.paidAccess,vertical:t?.taxonomyHierarchy?.vertical?.slug,sub_vertical:t?.taxonomyHierarchy?.subVertical?.slug,category:t?.taxonomyHierarchy?.category?.slug,super_category:t?.taxonomyHierarchy?.superCategory?.slug,category_id:t?.taxonomyHierarchy?.category?.additional_items?.custom_taxonomy_configuration?.meta_data?.akeneo_code,productsCount:d,testedProductsCount:c,...p&&{notTestedProductsCount:i},...p&&{bestBuyCount:a},...p&&{dontBuyCount:r},...p&&{firstLookCount:n},wcdPageUrl:(0,o.Q)(s),wcdPageTitle:t?.title||""}}},"./src/pages/reviews/product-comparison/hooks/useProductComparisonComponents.tsx"(t,e,s){s.r(e),s.d(e,{useProductComparisonComponents:()=>r});var o=s("./src/pages/reviews/shared/components/ToastNotification/index.ts"),a=s("./src/pages/reviews/product-comparison/components/index.ts");const r=()=>({Breadcrumb:a.ComparisonBreadcrumb,ReviewsComparisonTable:a.ComparisonTable,ToastNotification:o.ToastNotification})},"./src/pages/reviews/product-comparison/hooks/useProductComparisonPageDataLayer.ts"
1(t,e,s){s.r(e),s.d(e,{useProductComparisonPageDataLayer:()=>u});var o=s("./src/shared/BrowserBackStackProvider.tsx"),a=s("./src/shared/data-layer.tsx"),r=s("./src/shared/dfp.tsx"),n=s("./src/shared/hooks/useFullUrl.ts"),i=s("./src/shared/utils/getPreviousUrl/getPreviousUrl.ts"),c=s("./src/shared/utils/remove-falsy.ts"),d=s("./src/pages/reviews/product-comparison/get-data-layer-script.tsx");const u=()=>{const{getFullUrl:t}=(0,n.q)(),e=(0,o.l)(),s=(0,i.j)({backStack:e});return{getDataLayerItems(e,o){const{dataLayer:n=[],taxonomyHierarchy:i}=e,u=(0,d.getDataLayerScriptContent)({meta:e,attributesCount:o,fullUrl:t()}),l={vertical:i?.vertical?.slug,sub_vertical:i?.subVertical?.slug,category:i?.category?.slug,content_type:"compare",pageType:"product-listing",...s&&{previousWcdPageUrl:s}};return[...(0,a.S)([(0,c.a)(u)]),...(0,r.v)(n,l)]}}}},"./src/pages/reviews/product-comparison/hooks/useProductComparisonPageMetaTags.ts"(t,e,s){s.r(e),s.d(e,{useProductComparisonPageMetaTags:()=>r});var o=s("./src/shared/hooks/useBaseMetaTags.tsx"),a=s("./src/pages/reviews/product-comparison/hooks/useProductComparisonPageDataLayer.ts");const r=()=>{const{getBaseMetaTags:t}=(0,o.r)(),{getDataLayerItems:e}=(0,a.useProductComparisonPageDataLayer)();return{getPageMetaTags:({meta:s,imageAlt:o,imageUrl:a,twitterCard:r,noIndex:n,attributesCount:i})=>[...t({meta:s,imageAlt:o,imageUrl:a,twitterCard:r,noIndex:n}),...e(s,i)]}}},"./src/pages/reviews/shared/components/ToastNotification/ToastNotification.module.scss"(t,e,s){s.r(e),s.d(e,{default:()=>o});const o={sticky:"ToastNotification_sticky__qt-+V",visible:"ToastNotification_visible__8fXd9",infoBar:"ToastNotification_infoBar__rtTTO",error:"ToastNotification_error__-scXo",textAndLink:"ToastNotification_textAndLink__TwdyA",link:"ToastNotification_link__IL2dW",close:"ToastNotification_close__GTTQS"}},"./src/pages/reviews/shared/components/ToastNotification/ToastNotification.tsx"(t,e,s){s.r(e),s.d(e,{ToastNotification:()=>m,defaultState:()=>g});var o=s("../../node_modules/react/index.js"),a=s("../../node_modules/@which/seatbelt/src/index.ts"),r=s("../../node_modules/@which/seatbelt/src/components/Icons/Navigational/index.ts"),n=s("../../node_modules/classnames/index.js"),i=s.n(n),c=s("./src/pages/article/ArticleTemplateContext.tsx"),d=s("./src/pages/reviews/product-comparison/ComparisonTableContext.ts"),u=s("./src/pages/reviews/product-listing/ReviewsTemplateContext.tsx"),l=s("./src/pages/reviews/shared/components/ToastNotification/ToastNotification.module.scss"),p=s("../../node_modules/react/jsx-runtime.js");const g={displayToast:!1,error:!1,mainText:"",linkText:"",linkUrl:void 0,onClick:void 0},m=()=>{const{state:t}=(0,o.useContext)(u.ReviewsTemplateContext),{state:e}=(0,o.useContext)(d.ComparisonTableContext),s=(0,o.useContext)(c.ArticleTemplateContext),[n,m]=(0,o.useState)(g);t&&(t.setToastContext=m),e&&(e.setToastContext=m),(0,o.useEffect)(()=>{s?.toast?.displayToast&&m(s.toast)},[s?.toast]);const x=(0,o.useCallback)(()=>{clearTimeout(v.current);const t={...g,error:n.error};m(t),s?.setToast&&s.setToast(t)},[s,n.error]),{displayToast:y,error:C,mainText:f,linkText:T,linkUrl:h,onClick:_}=n,v=(0,o.useRef)(void 0),P=(0,o.useRef)(y);return(0,o.useEffect)(()=>(y&&!P.current&&(v.current&&clearTimeout(v.current),v.current=setTimeout(x,5e3)),P.current=y,()=>clearTimeout(v.current)),[x,y]),(0,p.jsx)("div",{className:i()(l.default.sticky,y&&l.default.visible),"data-testid":"toast-notification",children:(0,p.jsxs)("div",{className:i()(l.default.infoBar,C&&l.default.error),children:[(0,p.jsxs)("div",{className:l.default.textAndLink,children:[(0,p.jsx)(a.Yx,{"data-testid":"toast-notification-text",textStyle:"sb-text-interface-body-small-regular","aria-live":"assertive","aria-atomic":!0,children:f}),T&&h&&(0,p.jsx)(a.N_,{className:l.default.link,textStyle:"sb-text-interface-body-small-strong","data-which-id":"toast-notification-link","data-item-text":T,"data-item-spec":"toast notification link","data-testid":"toast-notification-link",href:h,children:T}),T&&_&&(0,p.jsx)(a.z9,{className:l.default.link,textStyle:"sb-text-interface-body-small-strong","data-which-id":"toast-notification-link","data-item-text":T,"data-item-spec":"toast notification link","data-testid":"toast-notification-button",onClick:_,children:T})]}),(0,p.jsx)("button",{className:l.default.close,onClick:x,onKeyPress:x,"aria-label":"Close",children:(0,p.jsx)(r.w0,{width:15,height:15})})]})})}},"./src/pages/reviews/shared/components/ToastNotification/index.ts"(t,e,s){s.r(e),s.d(e,{ToastNotification:()=>o.ToastNotification,defaultState:()=>o.defaultState});var o=s("./src/pages/reviews/shared/components/ToastNotification/ToastNotification.tsx")},"./src/shared/data-layer.tsx"(t,e,s){s.d(e,{S:()=>a}),s("../../node_modules/react/index.js");var o=s("../../node_modules/react/jsx-runtime.js");const a=(t=[])=>{const e=t.reduce((t,e)=>`${t}dataLayer.push(${JSON.stringify(e)});\n\t`,"");return[(0,o.jsx)("script",{children:`\n\twindow.dataLayer = window.dataLayer || [];\n\tdataLayer.push(function() { this.reset(); })\n\t${e}`},"ga-script")]}},"./src/shared/dfp.tsx"(t,e,s){s.d(e,{v:()=>a}),s("../../node_modules/react/index.js");var o=s("../../node_modules/react/jsx-runtime.js");const a=(t,e)=>{const s=t.find(t=>t?.loginStatus);return[(0,o.jsx)("script",{children:`window.googletag = window.googletag || { cmd: [] };\n      window.googletag.cmd = window.googletag.cmd || [];\n      window.dfp = {\n        vertical: '${e?.vertical??""}',\n        sub_vertical: '${e?.sub_vertical??""}',\n        category: '${e?.category??""}',\n        tags: ${JSON.stringify(e?.tags??[])},\n        keywords: ${JSON.stringify(e?.keywords??[])},\n        login_status: '${s?.loginStatus??"loggedOut"}',\n        content_id: '${e?.content_id??""}',\n        GB_test_value: '${e?.GB_test_value??""}',\n        content_type: '${e?.content_type??""}',\n        page_type: '${e?.pageType??""}',\n      };`},"google-tag")]}},"./src/shared/utils/getPreviousUrl/getPreviousUrl.ts"(t,e,s){s.d(e,{j:()=>o});const o=({backStack:t})=>{if(t&&!(t.length<2))return t[t.length-2]}}}]);
2//# sourceMappingURL=pages-reviews-product-comparison-ProductComparisonPage.f0b27e64.chunk.js.map

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.