(function ($) {

	const STORAGE_KEY = 'pixelio_update_popup_hidden_until';

	$(document).on(
		'click',
		'.pixelio-cart-abandon-recovery-more-close-update-popup',
		function (e) {

			e.preventDefault();

			localStorage.setItem(
				STORAGE_KEY,
				Date.now() + (60 * 60 * 1000) // 1 heure
			);

			$('#pixelio-cart-abandon-recovery-more-update-popup-container')
				.fadeOut(200);
		}
	);

	$(function () {

		const hiddenUntil = parseInt(
			localStorage.getItem(STORAGE_KEY) || '0',
			10
		);

		if (hiddenUntil > Date.now()) {
			$('#pixelio-cart-abandon-recovery-more-update-popup-container')
				.hide();
		}
	});

})(jQuery);
