Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/pub/static/adminhtml/Magento/backend/en_US/Amasty_Base/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/pub/static/adminhtml/Magento/backend/en_US/Amasty_Base/js/extensions.js
/**
 *  Amasty Base Extensions UI Component
 */

define([
    'uiComponent',
    'mage/translate'
], function (Component, $t) {
    'use strict';

    return Component.extend({
        defaults: {
            template: 'Amasty_Base/extensions/extensions',
            templates: {
                updateButtons: 'Amasty_Base/extensions/update-buttons',
                filterButtons: 'Amasty_Base/extensions/filter-buttons',
                table: 'Amasty_Base/extensions/table'
            },
            modulesData: [],
            update: [],
            solutions: [],
            shouldRenderLicenseStatus: false,
            subscription: {
                statusTypesToCheck: ['warning', 'error'],
                url: 'https://amasty.com/amasty_recurring/customer/subscriptions',
                faqUrl: 'https://amasty.com/knowledge-base/what-does-each-product-license-status-in-the-base-extension-mean'
            },
            stateValues: {
                default: 'default',
                solutions: 'solutions',
                update: 'update'
            }
        },

        /**
         * @inheritdoc
         */
        initialize: function () {
            this._super();

            this.update = this.prepareModules(this.modulesData.filter(function (item) {
                return item.has_update;
            }));

            this.solutions = this.prepareModules(this.modulesData.filter(function (item) {
                return item.upgrade_url;
            }));

            this.modules(this.prepareModules(this.modulesData));

            this.shouldRenderLicenseStatus = this.modules().some((module) => !!module.verify_status);

            return this;
        },

        /**
         * @inheritdoc
         */
        initObservable: function () {
            return this._super()
                .observe({
                    state: 'default',
                    modules: []
                });
        },

        /**
         * Use Extensions Filter
         *
         * @param {String} state
         * @returns {void}
         */
        useGridFilter: function (state) {
            this.state(state);

            if (this.stateValues.default === state) {
                this.modules(this.prepareModules(this.modulesData));

                return;
            }

            this.modules(this[state]);
        },

        /**
         * Is filter active
         *
         * @param {String} state
         * @returns {Boolean}
         */
        isActive: function (state) {
            return this.state() === state;
        },

        /**
         * Prepare modules data
         *
         * @param {Array} data
         * @returns {Array}
         */
        prepareModules: function (data) {
            var availableUpgrade = data.filter(function (item) {
                    return item.upgrade_url;
                }),
                needUpdate = data.filter(function (item) {
                    return item.has_update && !item.upgrade_url;
                }),
                modules = data.filter(function (item) {
                    return !item.has_update && !item.upgrade_url;
                });

            return availableUpgrade.concat(needUpdate, modules);
        },

        /**
         * @param {Object} module
         * @returns {Object|null}
         */
        getActionLink: function (module) {
            const actionLinkData = {
                text: null,
                url: null
            };

            const isNeedCheckSubscription = this.isNeedCheckSubscription(module);
            if (module.upgrade_url || isNeedCheckSubscription) {
                actionLinkData.text = isNeedCheckSubscription ? $t('Check Your Subscriptions') : $t('Upgrade Your Plan');
                actionLinkData.url = isNeedCheckSubscription ? this.subscription.url : module.upgrade_url;
            }

            return actionLinkData;
        },

        /**
         * @param {Object} module
         * @returns {boolean}
         */
        isNeedCheckSubscription: function (module) {
            return this.subscription.statusTypesToCheck.includes(module.verify_status?.type);
        }
    });
});

Spamworldpro Mini