1/** 2 * Copyright © Signature, Inc. All rights reserved. 3 * See COPYING.txt for license details. 4 */ 5 6/** 7 * @api 8 */ 9 10function initMiniCartHyva(removeItemMessage) { 11 const cartActions = initCartAction(); 12 const miniCart = initEdeaCart(); 13 const baseEdeaCartInitialize = miniCart.initialize; 14 15 return Object.assign(miniCart, { 16 confirmMessage: removeItemMessage, 17 isLoading: false, 18 open: false, 19 edeaCartConfigUrl: function () { 20 return { 21 'checkout': window.edeaCartConfig.shoppingCartUrl, 22 'remove': window.edeaCartConfig.removeItemUrl, 23 'empty': window.edeaCartConfig.emptyCartUrl 24 } 25 }, 26 initializeMinicart: function () { 27 const self = this; 28 if (!this.isLoading) { 29 this.isLoading = true; 30 this.cartActionsAjax(function () { 31 self.isLoading = false; 32 }); 33 } 34 35 return baseEdeaCartInitialize(); 36 }, 37 deleteItemFromCart: function (event) { 38 let elem = event.currentTarget; 39 const productName = elem.dataset.itemName; 40 event.stopPropagation(); 41 if (confirm(this.confirmMessage.replace('%1', productName))) { 42 this.removeItem(event.currentTarget); 43 } 44 event.stopImmediatePropagation(); 45 }, 46 removeItem: function (elem) { 47 var line = elem.dataset.cartLine, 48 item = null; 49 50 this.cart.items.forEach(element => { 51 if (element.base.TransactionLineID == line) { 52 item = element.base; 53 item['brand'] = element.extra.brand; 54 item['edea_category'] = element.extra.edea_category; 55 } 56 }); 57 58 if (item) { 59 cartActions.ajax(window.edeaCartConfig.removeItemUrl, {'item': item}, '', cartActions._ajaxAfter, '', ''); 60 } 61 }, 62 cartActionsAjax: function (callback) { 63 cartActions.ajax(window.edeaCartConfig.minicartEdeaUrl, {}, '', cartActions._ajaxAfter, '', '').then( 64 function (value) { 65 callback() 66 }, 67 function (error) { 68 callback() 69 } 70 ); 71 }, 72 getSchool: function (txt) { 73 const text = txt.replace("_", " "); 74 if (text.indexOf('|') !== -1) { 75 var arr = text.split('|'); 76 var code = arr[0]; 77 var name = arr[1]; 78 var city = arr[2]; 79 return city + "-" + name; 80 } 81 return ''; 82 } 83 }) 84}
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.