Your IP : 216.73.216.220


Current Path : /proc/thread-self/cwd/static/frontend/Magento/luma/it_IT/Amasty_Rewards/js/view/
Upload File :
Current File : //proc/thread-self/cwd/static/frontend/Magento/luma/it_IT/Amasty_Rewards/js/view/balance.js

define([
    'uiComponent',
    'Magento_Customer/js/customer-data'
], function (Component, customerData) {
    'use strict';

    return Component.extend({
        defaults: {
            visible: false,
            balance: 0,
            captionText: false
        },

        initObservable: function () {
            this._super().observe('visible balance captionText');

            return this;
        },

        initialize: function () {
            this._super();
            var rewardsData = customerData.get('rewards');

            if (rewardsData().balance) {
                this.balance(rewardsData().balance);
            }

            rewardsData.subscribe(function (rewardsData) {
                this.balance(rewardsData.balance);
            }.bind(this));

            this.visible(true);
        },
    });
});