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AAqG,EAAA,EAAA1G,GAAA,mBAAAjB,CAAA,CAAAC,CAAA,cAAAA,CAAAA,EAAA8H,OAAA,CAAAlI,KAAAkI,OAAA,CAAA9H,EAAA+H,OAAA,CAAAnI,KAAAmI,OAAA,CAAA/H,EAAAgI,QAAA,CAAApI,KAAAoI,QAAA,CAAAhI,EAAAG,KAAA,CAAAP,KAAAO,KAAA","sources":["webpack://_N_E/./node_modules/isomorphic-fetch/fetch-npm-browserify.js","webpack://_N_E/./adapters/helpers/Path.js","webpack://_N_E/./adapters/helpers/functions.js","webpack://_N_E/./components/RecentlyViewedProductsBlock/RecentlyViewedProductsBlock.js","webpack://_N_E/./persistence/localStorage.js","webpack://_N_E/./persistence/recentlyViewed.js","webpack://_N_E/./node_modules/next/dist/build/polyfills/fetch/whatwg-fetch.js","webpack://_N_E/"],"sourcesContent":["// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\nrequire('whatwg-fetch');\nmodule.exports = self.fetch.bind(self);\n","function standardizePath(path) {\n if (typeof path === 'string') {\n return path.replace(/\\/{1,}/g, '/')\n .replace(/\\/{1,}$/g, '');\n }\n}\nconst customJsonstringify = str => JSON.stringify(str) && JSON.stringify(str).replace(/([&\"'<>])/g, (char) => {\n switch (char) {\n case '&':\n return '\\u0026'\n case '<':\n return '\\u003c'\n case '>':\n return '\\u003e'\n case '\"':\n return '\\u0022'\n case \"'\":\n return '\\u0027'\n default:\n return char\n }\n})\n\nmodule.exports = {\n customJsonstringify,\n standardizePath,\n};","export function chunk(items, size) {\n if(!Array.isArray(items)\n || items.length === 0\n || !Number.isInteger(size)\n || size === 0) {\n return [];\n }\n\n const chunks = [];\n let chunk = [];\n\n for(let i = 0; i < items.length; i++) {\n chunk.push(items[i]);\n if((i + 1) % size === 0) {\n chunks.push(chunk);\n chunk = [];\n }\n }\n\n if(chunk.length > 0) {\n chunks.push(chunk);\n }\n\n return chunks;\n}\n\nexport function flatten(array) {\n if (!Array.isArray(array)) {\n return [];\n }\n\n return array.reduce((previous, current) => {\n if (Array.isArray(current)){\n return previous.concat(current);\n } else {\n previous.push(current);\n return previous;\n }\n }, []);\n}\n\nexport function minimum(array) {\n if (!Array.isArray(array)) {\n return undefined;\n }\n\n let minimum = undefined;\n\n for(let i = 0; i < array.length; i++) {\n const value = array[i];\n if(typeof value === 'number') {\n if(minimum === undefined || value < minimum) {\n minimum = value;\n }\n }\n }\n\n return minimum;\n}\n\n// function to return N given of items in an Array\nexport function first(array, n) {\n // if passed array is not an array, return empty array\n if (!Array.isArray(array)\n || n <= 0) {\n return [];\n }\n\n //if N number is bigger or equal slice up the entire thing\n if(n >= array.length) {\n return array.slice();\n } else {\n // otherwise return only N numbers of array items\n return array.slice(0, n);\n }\n}\n\nexport function isLater(value) {\n // Return true if today is after the value date\n let result = false\n\n if (value && value instanceof Date) {\n result = new Date() > value;\n } else if (value) {\n result = new Date() > new Date(value)\n }\n\n return result;\n}\n\nexport function isObject(value) {\n return (!!value) && (value.constructor === Object);\n}\n\nexport function findIndex(array, fn) {\n if (!Array.isArray(array)\n || !(typeof fn === 'function')) {\n return undefined;\n }\n for(let i = 0; i < array.length; i++) {\n const element = array[i];\n\n if(fn(element)) {\n return i;\n }\n }\n\n return undefined;\n}\n\nexport function escapeHtml(unsafe) {\n return unsafe\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n","import dynamic from 'next/dynamic';\nimport React, { useState, useEffect, useRef, useMemo } from 'react';\nimport { getProducts, removeProduct } from '../../persistence/recentlyViewed';\nimport 'isomorphic-fetch';\n\nimport Block from '../../adapters/helpers/Block';\nimport { Waypoint } from 'react-waypoint';\nimport { RecentlyViewedProductsBlockConstants } from '../../adapters/helpers/Constants'\n\nconst Heading = dynamic(() => import('../Heading/Heading'));\nconst ProductsOverview = dynamic(() => import('../ProductsOverview/ProductsOverview'));\n\nexport default function RecentlyViewedProductsBlock(props) {\n\n const standardizePath = require('../../adapters/helpers/Path').standardizePath;\n\n const block = new Block(props);\n const {document, extraAttributes} = props;\n\n const productsToLoad = useRef(\n getProducts()\n .map(({id}) => id)\n .filter(id => id !== extraAttributes?.slug)\n );\n\n const [products, setProducts] = useState(\n productsToLoad.current.map(() => undefined)\n );\n\n const [isShown, setIsShown] = useState(false);\n\n const anchorId = block.getAnchorId();\n\n const title = document?.fields?.title;\n const seeLessLabel = document?.fields?.seeLessLabel?.fields?.text;\n const seeMoreLabel = document?.fields?.seeMoreLabel?.fields?.text;\n\n const _handleWaypointEnter = () => {\n // Trigger by waypoint enter\n setIsShown(true);\n }\n\n const propsClassnames = document?.fields?.classNames;\n\n const classNames = useMemo(() => {\n const _classNames = [\n 'ob-recently-viewed-block',\n ];\n\n if(propsClassnames) {\n _classNames.push(propsClassnames);\n }\n\n if(isShown) {\n _classNames.push(RecentlyViewedProductsBlockConstants.show);\n }\n\n return _classNames;\n\n }, [propsClassnames, isShown])\n\n useEffect(() => {\n if(isShown) {\n for(let i = 0; i < productsToLoad.current.length; i++) {\n const productId = productsToLoad.current[i];\n (async () => {\n try {\n const loadedProduct = await (\n await (fetch(RecentlyViewedProductsBlockConstants.fetch + btoa(standardizePath(productId)) + RecentlyViewedProductsBlockConstants.json).then((response) => {\n const statusCategory = response.status.toString()[0];\n if(statusCategory === RecentlyViewedProductsBlockConstants.four) {\n removeProduct(productId);\n }\n return response;\n }))\n ).json();\n\n setProducts(prevState => {\n const products = prevState.slice();\n products[i] = loadedProduct;\n return products;\n });\n } catch(e) {\n //Log error or do something\n }\n })();\n }\n }\n }, [isShown]);\n\n return (\n <>\n {products.length > 0 &&
\n
\n {!!title && {title}}\n
\n \n \n
\n
\n
}\n \n );\n}\n","\nconst LOCAL_STORAGE_KEYS = {\n RECENTLY_VIEWED_PRODUCTS: 'RECENTLY_VIEWED_PRODUCTS',\n}\n\nexport { LOCAL_STORAGE_KEYS };","import { LOCAL_STORAGE_KEYS } from './localStorage';\nimport { first } from '../adapters/helpers/functions';\nimport { customSuperJsonParse, customSuperJsonStringify } from '../adapters/helpers/Utils';\n\nconst PRODUCT_PERSISTENCE_LIFESPAN_MILLISECONDS = 30 * 24 * 60 * 60 * 1000;\n\nfunction findProductIndex(products, id) {\n for(let i = 0; i < products.length; i++) {\n const product = products[i];\n\n if(product.id === id) {\n return i;\n }\n }\n\n return undefined;\n}\n\nfunction filterExpiredProducts(products) {\n return products.filter(({expiral}) =>\n new Date(expiral).getTime() > new Date().getTime())\n}\n\n\n// TODO: Remove in prod (Used for data consistency between changes)\nfunction isProductsDataValid(products) {\n if(!Array.isArray(products)) { return false; }\n\n for(let i = 0; i < products.length; i++) {\n const product = products[i];\n\n if(!product) { return false; }\n\n if(!product.hasOwnProperty('id')) { return false; }\n if(!product.hasOwnProperty('expiral')) { return false; }\n\n if(!(typeof product.id === 'string')) { return false; }\n if(!(typeof product.expiral === 'number')) { return false; }\n }\n return true;\n}\n\nexport function setViewed(id) {\n if((typeof localStorage !== 'undefined') && localStorage.setItem) {\n const products = getProducts();\n\n // Remove already viewed product\n const productsWithoutCurrentProduct = products.slice();\n const currentProductIndex = findProductIndex(products, id);\n\n if(currentProductIndex !== undefined) {\n productsWithoutCurrentProduct.splice(currentProductIndex, 1);\n }\n\n // Filter expirered products\n const expiralFilteredProduct = filterExpiredProducts(productsWithoutCurrentProduct);\n\n // Add id to first place\n const nextProducts = first([\n { id, expiral: (new Date().getTime() + PRODUCT_PERSISTENCE_LIFESPAN_MILLISECONDS)},\n ...expiralFilteredProduct\n ], 3);\n\n localStorage.setItem(LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS, customSuperJsonStringify(nextProducts));\n }\n}\n\nexport function getProducts() {\n if((typeof localStorage !== 'undefined') && localStorage.getItem) {\n const json = localStorage.getItem(LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS);\n\n if(json !== null) {\n try {\n const products = customSuperJsonParse(json);\n\n // TODO: Remove in prod\n if(!isProductsDataValid(products)) { return [];}\n\n return filterExpiredProducts(products);\n } catch(_e) {\n // Do nothing or log error\n }\n }\n }\n\n return [];\n}\n\nexport function removeProduct(id) {\n if((typeof localStorage !== 'undefined') && localStorage.setItem) {\n const products = getProducts();\n\n // Remove product\n const productsWithoutCurrentProduct = products.slice();\n const currentProductIndex = findProductIndex(products, id);\n\n if(currentProductIndex !== undefined) {\n productsWithoutCurrentProduct.splice(currentProductIndex, 1);\n }\n\n // Filter expirered products\n const expiralFilteredProduct = filterExpiredProducts(productsWithoutCurrentProduct);\n\n localStorage.setItem(LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS, customSuperJsonStringify(expiralFilteredProduct));\n }\n}\n","\"use strict\";\n/* globals self */ exports.Headers = self.Headers;\nexports.Request = self.Request;\nexports.Response = self.Response;\nexports.fetch = self.fetch;\n\n//# sourceMappingURL=whatwg-fetch.js.map","(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5205],{94301:function(e,n,t){t(66477),e.exports=self.fetch.bind(self)},57646:function(e){e.exports={customJsonstringify:function(e){return JSON.stringify(e)&&JSON.stringify(e).replace(/([&\"'<>])/g,(function(e){switch(e){case\"&\":return\"&\";case\"<\":return\"<\";case\">\":return\">\";case'\"':return'\"';case\"'\":return\"'\";default:return e}}))},standardizePath:function(e){if(\"string\"==typeof e)return e.replace(/\\/{1,}/g,\"/\").replace(/\\/{1,}$/g,\"\")}}},61986:function(e,n,t){\"use strict\";function r(e,n){if(!Array.isArray(e)||0===e.length||!Number.isInteger(n)||0===n)return[];for(var t=[],r=[],u=0;u0&&t.push(r),t}function u(e){if(Array.isArray(e)){for(var n=void 0,t=0;t=e.length?e.slice():e.slice(0,n)}function c(e){var n=!1;return e&&e instanceof Date?n=new Date>e:e&&(n=new Date>new Date(e)),n}function a(e){return!!e&&e.constructor===Object}function o(e,n){if(Array.isArray(e)&&\"function\"==typeof n)for(var t=0;t/g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\")}t.d(n,{Kn:function(){return a},LT:function(){return u},Ps:function(){return i},Xv:function(){return s},cx:function(){return o},en:function(){return c},yo:function(){return r}})},15205:function(e,n,t){\"use strict\";t.r(n),t.d(n,{default:function(){return y}});var r=t(49376),u=t.n(r),i=t(87794),c=t.n(i),a=t(5152),o=t.n(a),s=t(67294),l=t(27952),f=(t(94301),t(40483)),d=t(83824),p=t(24036),h=t(85893),g=o()((function(){return Promise.all([t.e(9238),t.e(5061)]).then(t.bind(t,92116))}),{loadableGenerated:{webpack:function(){return[92116]}}}),v=o()((function(){return t.e(9899).then(t.bind(t,79899))}),{loadableGenerated:{webpack:function(){return[79899]}}});function y(e){var n,r,i,a,o,y,b,x,m=t(57646).standardizePath,w=new f.Z(e),k=e.document,S=e.extraAttributes,A=(0,s.useRef)((0,l.Xp)().map((function(e){return e.id})).filter((function(e){return e!==(null==S?void 0:S.slug)}))),j=(0,s.useState)(A.current.map((function(){}))),D=j[0],N=j[1],C=(0,s.useState)(!1),P=C[0],_=C[1],I=w.getAnchorId(),E=null==k||null==(n=k.fields)?void 0:n.title,R=null==k||null==(r=k.fields)||null==(i=r.seeLessLabel)||null==(a=i.fields)?void 0:a.text,T=null==k||null==(o=k.fields)||null==(y=o.seeMoreLabel)||null==(b=y.fields)?void 0:b.text,O=null==k||null==(x=k.fields)?void 0:x.classNames,L=(0,s.useMemo)((function(){var e=[\"ob-recently-viewed-block\"];return O&&e.push(O),P&&e.push(p.dx.show),e}),[O,P]);return(0,s.useEffect)((function(){if(P)for(var e=function(e){var n=A.current[e];u()(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch(p.dx.fetch+btoa(m(n))+p.dx.json).then((function(e){return e.status.toString()[0]===p.dx.four&&(0,l.kh)(n),e}));case 3:return t.next=5,t.sent.json();case 5:r=t.sent,N((function(n){var t=n.slice();return t[e]=r,t})),t.next=11;break;case 9:t.prev=9,t.t0=t.catch(0);case 11:case\"end\":return t.stop()}}),t,null,[[0,9]])})))()},n=0;n0&&(0,h.jsx)(\"div\",{className:L.join(\" \"),id:I,children:(0,h.jsxs)(\"div\",{className:\"ob-recently-viewed-block-wrapper\",children:[!!E&&(0,h.jsx)(g,{className:\"ob-recently-viewed-block__heading\",children:E}),(0,h.jsxs)(\"div\",{className:\"ob-recently-viewed-block__product-grid-wrapper\",children:[(0,h.jsx)(d.h,{onEnter:function(){_(!0)}}),(0,h.jsx)(v,{seeMoreProductsText:T,seeLessProductsText:R,products:D,isRecentlyViewed:!0,isCarrousel:!0,onClickCallback:e.onClickCallback})]})]})})})}},27952:function(e,n,t){\"use strict\";t.d(n,{Xp:function(){return f},kh:function(){return d},OS:function(){return l}});var r=t(7980),u=t.n(r),i=\"RECENTLY_VIEWED_PRODUCTS\",c=t(61986),a=t(8996);function o(e,n){for(var t=0;t(new Date).getTime()}))}function l(e){if(\"undefined\"!=typeof localStorage&&localStorage.setItem){var n=f(),t=n.slice(),r=o(n,e);void 0!==r&&t.splice(r,1);var l=s(t),d=(0,c.Ps)([{id:e,expiral:(new Date).getTime()+2592e6}].concat(u()(l)),3);localStorage.setItem(i,(0,a.hD)(d))}}function f(){if(\"undefined\"!=typeof localStorage&&localStorage.getItem){var e=localStorage.getItem(i);if(null!==e)try{var n=(0,a.Cp)(e);return function(e){if(!Array.isArray(e))return!1;for(var n=0;n