# app/components/Domain/CartWidget/index.coffee module.exports = name: 'cart-widget' props: items: type: Array default: -> [] computed: itemsCount: -> @items.reduce ((total, item) -> total + (item.quantity or 1)), 0 totalPrice: -> @items.reduce ((total, item) -> total + (item.price * (item.quantity or 1))), 0 methods: goToCart: -> @$emit 'go-to-cart' updateCart: (items) -> @$emit 'update-cart', items render: (new Function '_ctx', '_cache', globalThis.renderFns['app/components/Domain/CartWidget/index.pug'])()