File "discount-notice.ts"

Full Path: /home/jlklyejr/public_html/post-date/wp-content/plugins/kirki/kirki-packages/settings/src/discount-notice.ts
File size: 702 bytes
MIME-type: text/x-java
Charset: utf-8

import { getClosest } from "./utils";
import jQuery from "jquery";

declare var ajaxurl: string;

(function () {
	function init() {
		jQuery(document).on(
			"click",
			".kirki-discount-notice.is-dismissible .notice-dismiss",
			dismiss
		);
	}

	function dismiss(e: JQuery.ClickEvent) {
		const notice = getClosest(this, ".kirki-discount-notice");
		if (!notice) return;
		let nonce = notice.dataset.dismissNonce;
		nonce = nonce ? nonce : "";

		jQuery
			.ajax({
				url: ajaxurl,
				type: "post",
				data: {
					action: "kirki_dismiss_discount_notice",
					nonce: nonce,
					dismiss: 1,
				},
			})
			.always(function (r) {
				if (r.success) console.log(r.data);
			});
	}

	init();
})();