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EAAMC,SAAS,cAAc1B,MAAM,CAC/B2B,QAAS,KACTC,WAAY,CACRC,WAAY,OACZC,QAAS,KAGrB,EACAhB,QAAS,SAAUW,GACfA,EAAMM,YAAY,cAAcjB,SACpC,EACAkB,KAAM,WACFzC,EAAE,yBAAyB0C,GAAG,QAAS,iCAAkCrC,KAAKH,6BAC9EF,EAAE,6BAA6B0C,GAAG,QAAS,iCAAkCrC,KAAKmB,gCACtF,GAEJvB,EAAWwC,MACf,G","sources":["webpack://advanced-coupons-premium/./packages/acfwp-cart/index.ts"],"sourcesContent":["\"use strict\";\njQuery(document).ready(function ($) {\n var eventFuncs = {\n applyNotificationCouponCart: function () {\n var _a;\n var $button = $(this);\n var couponCode = (_a = $button.val()) === null || _a === void 0 ? void 0 : _a.toString().trim();\n eventFuncs.block($(\".woocommerce-cart-form\"));\n $.post(wc_cart_params.wc_ajax_url\n .toString()\n .replace(\"%%endpoint%%\", \"apply_coupon\"), {\n coupon_code: couponCode,\n security: wc_cart_params.apply_coupon_nonce,\n }, function (response) {\n $(\".woocommerce-error, .woocommerce-message, .woocommerce-info\").remove();\n $(document.body).trigger(\"applied_coupon\", [couponCode]);\n eventFuncs.showNotice(response);\n }).always(function () {\n eventFuncs.unblock($(\".woocommerce-cart-form\"));\n $(document).trigger(\"wc_update_cart\", true);\n });\n },\n applyNotificationCouponCheckout: function () {\n var _a;\n var $button = $(this);\n var couponCode = (_a = $button.val()) === null || _a === void 0 ? void 0 : _a.toString().trim();\n var $form = $(\"form.woocommerce-checkout\");\n eventFuncs.block($form);\n $.post(wc_checkout_params.wc_ajax_url\n .toString()\n .replace(\"%%endpoint%%\", \"apply_coupon\"), {\n coupon_code: couponCode,\n security: wc_checkout_params.apply_coupon_nonce,\n }, function (code) {\n $(\".woocommerce-error, .woocommerce-message\").remove();\n eventFuncs.unblock($form);\n if (code) {\n $form.before(code);\n $(document.body).trigger(\"applied_coupon_in_checkout\", [\n couponCode,\n ]);\n $(document.body).trigger(\"update_checkout\", {\n update_shipping_method: false,\n });\n }\n });\n },\n showNotice: function (html_element, $target) {\n if ($target === void 0) { $target = null; }\n if (null !== $target) {\n $target =\n $(\".woocommerce-notices-wrapper:first\") ||\n $(\".cart-empty\").closest(\".woocommerce\") ||\n $(\".woocommerce-cart-form\");\n }\n $target === null || $target === void 0 ? void 0 : $target.prepend(html_element);\n },\n block: function ($node) {\n $node.addClass(\"processing\").block({\n message: null,\n overlayCSS: {\n background: \"#fff\",\n opacity: 0.6,\n },\n });\n },\n unblock: function ($node) {\n $node.removeClass(\"processing\").unblock();\n },\n init: function () {\n $(\"body.woocommerce-cart\").on(\"click\", \"button.acfw_apply_notification\", this.applyNotificationCouponCart);\n $(\"body.woocommerce-checkout\").on(\"click\", \"button.acfw_apply_notification\", this.applyNotificationCouponCheckout);\n },\n };\n eventFuncs.init();\n});\n"],"names":["jQuery","document","ready","$","eventFuncs","applyNotificationCouponCart","_a","couponCode","this","val","toString","trim","block","post","wc_cart_params","wc_ajax_url","replace","coupon_code","security","apply_coupon_nonce","response","remove","body","trigger","showNotice","always","unblock","applyNotificationCouponCheckout","$form","wc_checkout_params","code","before","update_shipping_method","html_element","$target","closest","prepend","$node","addClass","message","overlayCSS","background","opacity","removeClass","init","on"],"sourceRoot":""}