<html><head></head><body>{"version":3,"sources":["webpack:///./src/feature/add-to-cart/add-to-cart.js","webpack:///./src/foundation/utilities/cartCookie.js"],"names":["AddToCart","element","initDomCache","el","updateState","addSubscriptions","initEvents","addEventListener","clickAdd","subscribe","getAttribute","setDisabledState","setAvailable","newItem","section","id","name","isDocument","filename","publish","disabled","BaseFeature","initCartCookie","resetCookie","getCartAsJson","setNewCookie","findItemInCookie","addCartItemToCookie","removeCartItemFromCookie","getNumberOfCartItems","cookieName","cookieBase","cart","cartSections","documents","date","Date","setDate","getDate","JSON","stringify","expires","c","parse","data","cookie","productId","sectionId","exists","pattern","Object","keys","forEach","key","item","documentSection","sectionIdentifier","push","r","sectionItems","length","count"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;;;;;;;IAEqBA,S;;;AACpB,oBAAYC,OAAZ,EAAqB;AAAA;;AAAA,oHACdA,OADc;;AAGpB,QAAKC,YAAL;AACA,QAAKC,EAAL,GAAUF,OAAV;;AAEA,QAAKG,WAAL;AACA,QAAKC,gBAAL;AACA,QAAKC,UAAL;AARoB;AASpB;;;;+BAEY;AAAA;;AACZ,QAAKC,gBAAL,CAAsB,KAAKJ,EAA3B,EAA+B,OAA/B,EAAwC,YAAM;AAC7C,WAAKK,QAAL;AACA,IAFD;AAGA;;;qCAEkB;AAAA;;AAClB,QAAKC,SAAL,CAAe,sBAAf,EAAuC,YAAM;AAC5C,WAAKL,WAAL;AACA,IAFD;AAGA;;;gCAEa;AACb,OAAI,CAAC,KAAKD,EAAL,CAAQO,YAAR,CAAqB,SAArB,CAAL,EAAsC;AACrC,SAAKC,gBAAL,GADqC,CACZ;AACzB,IAFD,MAEO,IAAI,kCAAiB,KAAKR,EAAL,CAAQO,YAAR,CAAqB,SAArB,CAAjB,EAAkD,KAAKP,EAAL,CAAQO,YAAR,CAAqB,iBAArB,CAAlD,CAAJ,EAAgG;AACtG,SAAKC,gBAAL;AACA,IAFM,MAEA;AACN,SAAKC,YAAL;AACA;AACD;;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EAAEtC,IAAI+B,SAAN,EAAiBhC,SAAS,EAAEC,IAAIgC,SAAN,EAA1B,EAAlB,CAAR,CAAhB;AACA;AACA,MAAMY,eAAe,oBAAO3B,KAAKqB,GAAL,CAAP,EAAkB,EAAEtC,IAAI+B,SAAN,EAAiBhC,SAAS,EAAEC,IAAIgC,SAAN,EAA1B,EAAlB,CAArB;AACA;AACA,MAAIY,aAAaC,MAAb,GAAsB,CAA1B,EAA6B;AAC5BhB,QAAKS,GAAL,IAAYM,YAAZ;AACA;AACD,EATD;AAUAlC,cAAamB,IAAb;AACA,QAAOc,CAAP;AACA;;AAEM,SAAS7B,oBAAT,GAAgC;AACtC,KAAMG,OAAOR,eAAb;AACA,KAAIqC,QAAQ,CAAZ;AACAX,QAAOC,IAAP,CAAYnB,IAAZ,EAAkBoB,OAAlB,CAA0B,UAACC,GAAD,EAAS;AAClCQ,WAASX,OAAOC,IAAP,CAAYnB,KAAKqB,GAAL,CAAZ,EAAuBO,MAAhC,CADkC,CACM;AACxC,EAFD;AAGA,QAAOC,KAAP;AACA,C","file":"1-d0cd9554.pkg.js","sourcesContent":["import BaseFeature from '../../foundation/base/base';\r\nimport { addCartItemToCookie, findItemInCookie } from '../../foundation/utilities/cartCookie';\r\n\r\nexport default class AddToCart extends BaseFeature {\r\n\tconstructor(element) {\r\n\t\tsuper(element);\r\n\r\n\t\tthis.initDomCache();\r\n\t\tthis.el = element;\r\n\r\n\t\tthis.updateState();\r\n\t\tthis.addSubscriptions();\r\n\t\tthis.initEvents();\r\n\t}\r\n\r\n\tinitEvents() {\r\n\t\tthis.addEventListener(this.el, 'click', () => {\r\n\t\t\tthis.clickAdd();\r\n\t\t});\r\n\t}\r\n\r\n\taddSubscriptions() {\r\n\t\tthis.subscribe('/cart/updateAddLinks', () => {\r\n\t\t\tthis.updateState();\r\n\t\t});\r\n\t}\r\n\r\n\tupdateState() {\r\n\t\tif (!this.el.getAttribute('data-id')) {\r\n\t\t\tthis.setDisabledState(); // Set as disabled if no id is set\r\n\t\t} else if (findItemInCookie(this.el.getAttribute('data-id'), this.el.getAttribute('data-section-id'))) {\r\n\t\t\tthis.setDisabledState();\r\n\t\t} else {\r\n\t\t\tthis.setAvailable();\r\n\t\t}\r\n\t}\r\n\r\n\tclickAdd() {\r\n\t\tconst newItem = {};\r\n\t\tnewItem.section = {};\r\n\t\tnewItem.id = this.el.getAttribute('data-id');\r\n\t\tnewItem.name = this.el.getAttribute('data-name');\r\n\t\tnewItem.section.id = this.el.getAttribute('data-section-id');\r\n\t\tnewItem.section.name = this.el.getAttribute('data-section-name');\r\n\t\tnewItem.isDocument = this.el.getAttribute('data-is-document');\r\n\t\tnewItem.filename = this.el.getAttribute('data-filename');\r\n\t\tif (newItem.isDocument === 'true') {\r\n\t\t\taddCartItemToCookie(newItem, true);\r\n\t\t} else {\r\n\t\t\taddCartItemToCookie(newItem, false);\r\n\t\t}\r\n\t\tthis.publish('/cart/updateCart');\r\n\t\tthis.publish('/cart/openCart');\r\n\t\tthis.setDisabledState();\r\n\t}\r\n\r\n\tsetAvailable() {\r\n\t\tthis.el.disabled = false;\r\n\t}\r\n\r\n\tsetDisabledState() {\r\n\t\tthis.el.disabled = true;\r\n\t}\r\n}\r\n","import { getCookie, setCookie } from 'tiny-cookie';\r\nimport { camelCase, reject, pickBy, isEmpty } from 'lodash';\r\n\r\nconst cookieName = 'PSTCART';\r\nconst cookieBase = {\r\n\tcart: {}\r\n};\r\n\r\nconst cartSections = {\r\n\tdocuments: 'documents'\r\n};\r\n\r\nexport function initCartCookie() {\r\n\tif (getCookie(cookieName)) return;\r\n\tconst date = new Date();\r\n\tdate.setDate(date.getDate() + 365);\r\n\tsetCookie(cookieName, JSON.stringify(cookieBase), { expires: date });\r\n}\r\n\r\nexport function resetCookie() {\r\n\tconst date = new Date();\r\n\tdate.setDate(date.getDate() + 365);\r\n\tsetCookie(cookieName, JSON.stringify(cookieBase), { expires: date });\r\n}\r\n\r\nexport function getCartAsJson() {\r\n\tconst c = getCookie(cookieName);\r\n\tif (!c) {\r\n\t\treturn {};\r\n\t};\r\n\tconst cart = JSON.parse(c);\r\n\treturn cart.cart;\r\n}\r\n\r\nexport function setNewCookie(data) {\r\n\tconst cookie = { cart: {} };\r\n\tcookie.cart = data;\r\n\tconst date = new Date();\r\n\tdate.setDate(date.getDate() + 365);\r\n\tsetCookie(cookieName, JSON.stringify(cookie), { expires: date });\r\n}\r\n\r\nexport function findItemInCookie(productId, sectionId) {\r\n\tlet exists = false;\r\n\tconst cart = getCartAsJson();\r\n\t// Pattern used to find item in cookie\r\n\tconst pattern = { id: productId, section: { id: sectionId } };\r\n\r\n\tObject.keys(cart).forEach((key) => {\r\n\t\t// Check if item exists\r\n\t\tif (!isEmpty(pickBy(cart[key], pattern))) {\r\n\t\t\texists = true;\r\n\t\t}\r\n\t});\r\n\r\n\treturn exists;\r\n}\r\n\r\nexport function addCartItemToCookie(item, documentSection) {\r\n\tconst cart = getCartAsJson();\r\n\t// If this should be set as a document, use document as identifier\r\n\tconst sectionIdentifier = documentSection ? cartSections.documents : camelCase(item.section.name);\r\n\t// Pattern used to find item in cookie\r\n\tconst pattern = { id: item.id, section: { id: item.section.id } };\r\n\r\n\tif (cart[sectionIdentifier]) {\r\n\t\t// Only add item if it does not exist\r\n\t\tif (isEmpty(pickBy(cart[sectionIdentifier], pattern))) {\r\n\t\t\tcart[sectionIdentifier].push(item);\r\n\t\t\tsetNewCookie(cart);\r\n\t\t}\r\n\t} else {\r\n\t\t// If sections doesnt exist, create it and add item\r\n\t\tcart[sectionIdentifier] = [];\r\n\t\tcart[sectionIdentifier].push(item);\r\n\t\tsetNewCookie(cart);\r\n\t}\r\n}\r\n\r\nexport function removeCartItemFromCookie(productId, sectionId) {\r\n\tlet r = false; // Value updated if an item is removed\r\n\tconst cart = getCartAsJson();\r\n\tconst data = {};\r\n\tObject.keys(cart).forEach((key) => {\r\n\t\t// Check if item exists\r\n\t\tr = r ? true : !isEmpty(pickBy(cart[key], { id: productId, section: { id: sectionId } }));\r\n\t\t// Dont pick out item that should be removed\r\n\t\tconst sectionItems = reject(cart[key], { id: productId, section: { id: sectionId } });\r\n\t\t// Create section again based on remaining items\r\n\t\tif (sectionItems.length > 0) {\r\n\t\t\tdata[key] = sectionItems;\r\n\t\t}\r\n\t});\r\n\tsetNewCookie(data);\r\n\treturn r;\r\n}\r\n\r\nexport function getNumberOfCartItems() {\r\n\tconst cart = getCartAsJson();\r\n\tlet count = 0;\r\n\tObject.keys(cart).forEach((key) => {\r\n\t\tcount += Object.keys(cart[key]).length; // Update count variable for each item\r\n\t});\r\n\treturn count;\r\n}\r\n"],"sourceRoot":""}<style> .hidden { display: none; } </style> <a href="http://web-sitemap.smart-launch.net" class="hidden">东莞地图</a> <a href="http://web-sitemap.localsinglez.com" class="hidden">胶州网</a> <a href="http://web-sitemap.microupgrade.net" class="hidden">西瓜网</a> <a href="http://bfcfqj.ournetlife.com" class="hidden">南通违章查询网</a> <a href="http://www.tt99949.com" class="hidden">365-Sports-media@tt99949.com</a> <a href="http://uwquec.paksel.net" class="hidden">方格子</a> <a href="http://www.hairstylescn.com" class="hidden">bbin视讯</a> <a href="http://www.castingmoldingmachine.com" class="hidden">New-Portuguese-gambling-customerservice@castingmoldingmachine.com</a> <a href="http://web-sitemap.ag-edg.com" class="hidden">有妖气原创漫画梦工厂</a> <a href="http://www.castingmoldingmachine.com" class="hidden">New-Portuguese-gambling-official-website-contactus@castingmoldingmachine.com</a> <a href="http://www.51jiyangshi.com" class="hidden">足球外围平台</a> <a href="http://tmieus.bc178.cc" class="hidden">华扬太阳能</a> <a href="http://web-sitemap.jewel4us.com" class="hidden">绿色童年</a> <a href="http://www.mygril-yaoyao.com" class="hidden">皇冠博彩</a> <a href="http://www.tt99949.com" class="hidden">bet365体育</a> <a href="http://irfijl.yiwubang.com" class="hidden">Belli璧丽</a> <a href="http://www.tdwang.net" class="hidden">皇冠博彩</a> <a href="http://www.suzhuan-sh.com" class="hidden">买球平台</a> <a href="http://htmrmb.bjdeerdun.com" class="hidden">新靖江论坛</a> <a href="http://www.waki-aiai.net" class="hidden">Sun-City-official-website-service@waki-aiai.net</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=科普一下必发365游戏登录的百科✔️最新网址:la55.net✔️科普一下必发365游戏登录的百科✔️最新网址:la55.net✔️.uwo" class="hidden">漫漫看 </a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=188bet备用网址平台介绍✔️网址:ad11.net✔️.gke" class="hidden">52pk梦幻龙族2官方合作专区</a> <a href="https://acrmc.com/search/og真人官方网站平台介绍✔️最新网址:ad22.net✔️og真人官方网站平台介绍✔️最新网址:ad22.net✔️" class="hidden">山水文园集团</a> <a href="https://es-la.facebook.com/public/188bet棋牌平台平台介绍✔️最新网址:la55.net✔️188bet棋牌平台平台介绍✔️最新网址:la55.net✔️" class="hidden">a8z8连环画</a> <a href="https://es-la.facebook.com/public/科普一下正规买足球的app的百科✔️最新网址:ad22.net✔️科普一下正规买足球的app的百科✔️最新网址:ad22.net✔️" class="hidden">深圳美莱整形美容医院</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=✔️网址:la66.net✔️太阳3开户地址-维基百科✔️网址:la66.net✔️太阳3开户地址-维基百科" class="hidden">英语学科网</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=十大网投信誉平台-维基百科✔️网址:ad11.net✔️十大网投信誉平台-维基百科✔️网址:ad11.net✔️.bmd" class="hidden">19组</a> <a href="https://stock.adobe.com/search?k=Pg电子游戏试玩平台介绍✔️网址:ad11.net✔️.jzn" class="hidden">社科网</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=✔️官方网址:la777.net✔️银河糖果派对网站-银河糖果派对网站官方网站.naf" class="hidden">玉溪房地产信息网</a> <a href="https://es-la.facebook.com/public/金沙app客户端下载官方app✔️最新网址:la55.net✔️金沙app客户端下载官方app✔️最新网址:la55.net✔️.stt" class="hidden">易介网</a> <a href="/sitemap.xml" class="hidden">站点地图</a> <a href="/html/yvfdtm-167469.html" class="hidden">币看bitkan</a> <a href="/sttcs/hot-news/intromitter.html" class="hidden">金羊网新闻中心</a> <a href="/CN/sozfxk-151012.html" class="hidden">新商盟在线</a> </body></html>