1"use strict";(self.webpackChunk_sbi_international_englander=self.webpackChunk_sbi_international_englander||[]).push([[3405],{15242:function(e,t,n){n.d(t,{A:function(){return r}});var l=n(45458),o=n(55268),i=n(96540);const r=()=>{const e=(0,o.useStaticQuery)("652475033");return(0,i.useMemo)(()=>{const{allMagentoProductReviews:t}=e;return(0,l.A)(t.nodes)},[e])}},20605:function(e,t,n){n.r(t),n.d(t,{default:function(){return v}});var l=n(96540),o=n(69450),i=n(69866),r=n(82699),a=n(92196),u=n(20173),s=n(79696),c=n(78818),d=n(15242);function m(e){if(!e)return null;const t=e.trim(),n=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);if(n){const[,e,t,l]=n;return new Date(Number(e),Number(t)-1,Number(l))}const l=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(l){const[,e,t,n]=l;return new Date(Number(n),Number(t)-1,Number(e))}return null}function v(e){var t,n,v,p,f,g,h,E,b,N;let{data:D}=e;const{currentLocale:P}=(0,o.usePageLocalization)(),k=(0,l.useContext)(r.ServicesContext),w=null==k?void 0:k.magento.productService,C=(0,d.A)(),{0:S,1:_}=(0,l.useState)(),y=D[P],{t:T}=(0,i.useTranslation)("pages"),{0:A,1:M}=(0,l.useState)(1),R=(0,r.useDeviceDetect)().isMobile()?6:12,L=(null==D||null===(t=D.allProductsJson)||void 0===t?void 0:t.nodes)||[],x=L.filter(e=>/^\/Englander\/Heaters\//.test(null==e?void 0:e.category)),F=new Date;F.setHours(0,0,0,0);const H="CA"===P.split("_")[1]?"Canada":"United States",I=(null!==(n=null==y?void 0:y.promotions)&&void 0!==n?n:[]).filter(e=>{var t;if(!e||"englander_promo-brouillon"===e.code)return!1;const n=(null!==(t=e.availableCountries)&&void 0!==t?t:[]).filter(Boolean);if(n.length>0&&!n.includes(H))return!1;const l=m(e.startDate),o=m(e.expirationDate);return!(l&&l>F)&&!(o&&o<F)}).sort((e,t)=>{var n,l;const o=m(t.endDate),i=m(e.endDate);return(null!==(n=null==o?void 0:o.getTime())&&void 0!==n?n:0)-(null!==(l=null==i?void 0:i.getTime())&&void 0!==l?l:0)});return(0,l.useEffect)(()=>{const e=x.map(e=>{var t;return null!==(t=null==e?void 0:e.code)&&void 0!==t?t:"no-code-found"});let t=[];w&&L&&L.length>0?w.operations.getProducts(e).then(e=>{for(const l of x){const o=e.find(e=>e.sku===l.code);if(o&&o.currentPrice.hasDiscount){var n;const e=(0,r.generateIProductReviewsFromSummary)(null!==(n=l.code)&&void 0!==n?n:"no-code-found",C.filter(e=>e.sku===l.code));t.push({static:l,live:o,productReviews:e})}}_(t)}):_(L.map(e=>({static:e})))},[w]),l.createElement(s.P,null,l.createElement(c.A,{title:null!==(v=null==y||null===(p=y.seo)||void 0===p?void 0:p.metaTitle)&&void 0!==v?v:"",description:null!==(f=null==y||null===(g=y.seo)||void 0===g?void 0:g.metaDescription)&&void 0!==f?f:""}),l.createElement("div",{className:"promotions container"},l.createElement(u.Qp,{elements:[{link:"/",name:T("layout:appliance.home")},{link:"",name:null!==(h=null==y?void 0:y.title)&&void 0!==h?h:""}]}),l.createElement(u.sT,{title:null!==(E=null==y?void 0:y.title)&&void 0!==E?E:"",description:null!==(b=null==y?void 0:y.description)&&void 0!==b?b:""}),l.createElement("div",{className:"buy-promo section"},l.createElement("h2",null,null==y?void 0:y.sectionTitleSales),l.createElement("div",{className:"discounted-products"},S&&S.length>0?null==S||null===(N=S.slice(R*(A-1),R*A))||void 0===N?void 0:N.map((e,t)=>l.createElement(a.IL,{appliance:e.static,productLive:e.live,productReviews:e.productReviews,key:t,isPromo:!0})):l.createElement("p",{className:"no-promo"},T("promotions.no-sales-promo"))),S&&S.length/R>1&&l.createElement(u.dK,{currentPage:A,onPageChange:e=>M(e),pageNumber:Math.ceil(S.length/R)})),l.createElement("div",{className:"redeem-promo section"},l.createElement("h2",null,null==y?void 0:y.sectionTitleClaim),(null==I?void 0:I.length)>0?l.createElement(l.Fragment,null,I.map((e,t)=>l.createElement(a.UK,{key:t,promoCMS:e,allProducts:L}))):l.createElement("p",{className:"no-promo"},T("promotions.no-sales-promo")))))}}}]); 2//# sourceMappingURL=component---src-pages-promotions-tsx-1dfd38e407ab03d151c8.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.