HEX
Server: Apache
System: Linux efa57bbe-abb1-400d-2985-3b056fbc2701.secureserver.net 6.1.147-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 12:33:32 EDT 2025 x86_64
User: root (0)
PHP: 8.0.30.4
Disabled: NONE
Upload Files
File: //var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/assets/js/woocommerce-extensions.js
/* global MWCExtensions */

(function($) {
	/**
	 * WooCommerce handlers
	 * @TODO: Should refactor to use vanilla JS here {JO 2021-02-21}
	 *
	 * @type {Object}
	 */
	var MWC = {
		hideManagedSubscriptions: function () {
			$(MWCExtensions.plugins).each(function(i, plugin) {
				if (plugin.homepageUrl) {
					$('a[href="' + plugin.homepageUrl + '"]').parents('tbody').hide();
				}
			});
		}
	};

	if (MWCExtensions.isSubscriptionsPage) {
		MWC.hideManagedSubscriptions();
	}
})(jQuery);

/**
 * Hides subscription information for GoDaddy-included extensions.
 */
document.addEventListener('DOMContentLoaded', function() {
	if (! MWCExtensions.isSubscriptionsPage) {
		return;
	}

	const subscriptions = document.querySelectorAll('.wc-subscriptions-wrap .wp-list-table');
	if (! subscriptions) {
		return;
	}

	subscriptions.forEach(function(subscription) {
		const toggleWrapper = subscription.querySelector('.form-toggle__wrapper');
		if (! toggleWrapper) {
			return;
		}

		const statusToggle = toggleWrapper.querySelector('a.active');
		if (! statusToggle || ! statusToggle.getAttribute('href')) {
			return;
		}

		// Bail if it's not a GoDaddy-included product.
		if (! statusToggle.getAttribute('href').includes('product-key=godaddymwc')) {
			return;
		}

		toggleWrapper.innerHTML = MWCExtensions.godaddyIncluded;

		// We don't need to display the description (e.g. subscription duration) for GoDaddy-included extensions.
		const description = subscription.querySelector('.wp-list-table__ext-description');
		if (description) {
			description.innerHTML = '';
		}
	});
});