"use strict"; var get_bot_type=cwginstock.get_bot_type, recaptcha_enabled=cwginstock.enable_recaptcha, is_v3_recaptcha=cwginstock.is_v3_recaptcha, recaptcha_site_key=cwginstock.recaptcha_site_key, turnstile_enabled=cwginstock.enable_turnstile, turnstile_site_key=cwginstock.turnstile_site_key, gtoken="", popup_notifier={ init: function (){ jQuery(document).on("click", ".cwg_popup_submit", (function (){ jQuery.blockUI({ message: null });var t=jQuery(this), e={ action: "cwg_trigger_popup_ajax", product_id: t.attr("data-product_id"), variation_id: t.attr("data-variation_id"), quantity: t.attr("data-quantity"), security: t.attr("data-security") }; return "recaptcha"==get_bot_type&&"1"==recaptcha_enabled&&"yes"==is_v3_recaptcha ? popup_notifier.popup_generate_v3_response(this):popup_notifier.perform_ajax(e), !1 })) }, popup_generate_v3_response: function (t){ "recaptcha"==get_bot_type&&"1"==recaptcha_enabled&&"yes"==is_v3_recaptcha&&grecaptcha.ready((function (){ grecaptcha.execute(recaptcha_site_key, { action: "popup_form" }).then((function (e){ var c=jQuery(t), a={ action: "cwg_trigger_popup_ajax", product_id: c.attr("data-product_id"), variation_id: c.attr("data-variation_id"), quantity: c.attr("data-quantity"), security: e }; popup_notifier.perform_ajax(a), gtoken=e })) })) }, perform_ajax: function (t){ jQuery.ajax({ type: "post", url: cwginstock.default_ajax_url, data: t, success: function (t){ jQuery.unblockUI(), Swal.fire({ html: t, showCloseButton: !0, showConfirmButton: !1, willOpen: function (){ "recaptcha"==get_bot_type ? "1"==recaptcha_enabled&&(jQuery(".g-recaptcha").before('<div id="cwg-google-recaptcha"></div>'), jQuery(".g-recaptcha").remove()):"1"==turnstile_enabled&&turnstile.render(".cf-turnstile", { sitekey: turnstile_site_key, theme: "light", callback: function (t){ cwginstock_turnstile_callback(t) }}) }, didOpen: function (){ jQuery(document).trigger("cwginstock_popup_open_callback") }, willClose: function (){ jQuery(document).trigger("cwginstock_popup_close_callback") }}) }, error: function (t, e, c){ jQuery.unblockUI() }}) }}; popup_notifier.init(), jQuery(document).on("cwginstock_popup_open_callback", (function (){ instock_notifier.onloadcallback(), instock_notifier.initialize_phone() })), jQuery(document).on("cwginstock_popup_close_callback", (function (){ instock_notifier.resetcallback() }));