All files / src/types cart-item.js

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                                      6x                    
/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
/* Copyright (c) 2018 Mobify Research & Development Inc. All rights reserved. */
/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
 
import PropTypes from 'prop-types'
import {PositiveInteger} from './positive-integer'
 
/**
 * @memberOf module:types
 * @typedef {Object} CartItem
 * @property {String} id The cart id.
 * @property {String} productId The id of the product.
 * @property {String} productName The name of the product.
 * @property {module:types.PositiveInteger} quantity The number of this product that is in the cart.
 * @property {Number} baseItemPrice The price of one of this product before discounts
 * @property {Number} baseLinePrice The price of all of this product before discounts (usually baseItemPrice multiplied by quantity)
 * @property {Number} itemPrice The price of one of these items after discounts
 * @property {Number} linePrice The price of all of this product after discounts (usually baseItemPrice multiplied by quantity)
 */
export const CartItem = {
    id: PropTypes.string.isRequired,
    productId: PropTypes.string.isRequired,
    productName: PropTypes.string,
    quantity: PositiveInteger.isRequired,
    baseItemPrice: PropTypes.number.isRequired,
    baseLinePrice: PropTypes.number.isRequired,
    itemPrice: PropTypes.number.isRequired,
    linePrice: PropTypes.number.isRequired,
}