Your IP : 216.73.216.43


Current Path : /home/rtorresani/www/vendor/magento/module-weee/view/frontend/web/js/view/checkout/summary/
Upload File :
Current File : //home/rtorresani/www/vendor/magento/module-weee/view/frontend/web/js/view/checkout/summary/weee.js

/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @api
 */

define([
    'Magento_Checkout/js/view/summary/abstract-total',
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/model/totals',
    'Magento_Catalog/js/price-utils'
], function (Component, quote, totals) {
    'use strict';

    return Component.extend({
        defaults: {
            template: 'Magento_Weee/checkout/summary/weee'
        },
        isIncludedInSubtotal: window.checkoutConfig.isIncludedInSubtotal,
        totals: totals.totals,

        /**
         * @returns {Number}
         */
        getWeeeTaxSegment: function () {
            var weee = totals.getSegment('weee_tax') || totals.getSegment('weee');

            if (weee !== null && weee.hasOwnProperty('value')) {
                return weee.value;
            }

            return 0;
        },

        /**
         * Get weee value
         * @returns {String}
         */
        getValue: function () {
            return this.getFormattedPrice(this.getWeeeTaxSegment());
        },

        /**
         * Weee display flag
         * @returns {Boolean}
         */
        isDisplayed: function () {
            return this.isFullMode() && this.getWeeeTaxSegment() > 0;
        }
    });
});