
define(
    ['underscore'],
    function(_) {
        'use strict';

        var code = 'subscribe_pro';

        return {
            getCode: function () {
                return code;
            },

            getVaultCode: function () {
                return this.getConfig().vaultCode;
            },

            isActive: function () {
                return this.getConfig().isActive;
            },

            isThreeDSActive: function () {
                return this.getConfig().isThreeDSActive;
            },

            getBrowserSize: function () {
                return this.getConfig().browserSize;
            },

            getAcceptHeader: function () {
                return this.getConfig().acceptHeader;
            },

            getEnvironmentKey: function () {
                return this.getConfig().environmentKey;
            },

            hasVerification: function () {
                return this.getConfig().hasVerification;
            },

            getIcons: function () {
                return this.getConfig().icons;
            },

            getAvailableCardTypes: function () {
                return this.getConfig().availableCardTypes;
            },

            getCcTypesMapper: function () {
                return this.getConfig().ccTypesMapper;
            },

            getCvvImageUrl: function () {
                return this.getConfig().cvvImageUrl;
            },

            getConfig: function () {
                var config = {};
                let storeId = window.order.storeId;
                if (window['checkoutConfig'] != undefined) {
                    config = window.checkoutConfig.payment[code];
                } else if (window['subscribeProPaymentConfig'] != undefined) {
                    config = window.subscribeProPaymentConfig[storeId];
                }
                return config;
            }
        };
    }
);


define(
    ['underscore'],
    function(_) {
        'use strict';

        var code = 'subscribe_pro';

        return {
            getCode: function () {
                return code;
            },

            getVaultCode: function () {
                return this.getConfig().vaultCode;
            },

            isActive: function () {
                return this.getConfig().isActive;
            },

            isThreeDSActive: function () {
                return this.getConfig().isThreeDSActive;
            },

            getBrowserSize: function () {
                return this.getConfig().browserSize;
            },

            getAcceptHeader: function () {
                return this.getConfig().acceptHeader;
            },

            getEnvironmentKey: function () {
                return this.getConfig().environmentKey;
            },

            hasVerification: function () {
                return this.getConfig().hasVerification;
            },

            getIcons: function () {
                return this.getConfig().icons;
            },

            getAvailableCardTypes: function () {
                return this.getConfig().availableCardTypes;
            },

            getCcTypesMapper: function () {
                return this.getConfig().ccTypesMapper;
            },

            getCvvImageUrl: function () {
                return this.getConfig().cvvImageUrl;
            },

            getConfig: function () {
                var config = {};
                if (window['checkoutConfig'] != undefined) { // frontend checkout
                    config = window.checkoutConfig.payment[code];
                } else if (window['subscribeProPaymentConfig'] != undefined && window.order) { // backend checkout
                    config = window.subscribeProPaymentConfig[window.order.storeId];
                } else if (window['subscribeProPaymentConfig'] != undefined ) { // ading a card in My Stored Methods
                    config = window.subscribeProPaymentConfig;
                }
                return config;
            }
        };
    }
);

Fix M2 Admin store selection refresh loop
SPRO-37: Fix M2 Admin store selection refresh loop

Make sure adding a card in Stored Payment Methods works as well
