ÿØÿà JFIF H H ÿÛ C GIF89;
| System: Linux server378.web-hosting.com 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64 Current Path : /home/aliyykcz/public_html/wp-content/plugins_old/yaycurrency/src/helpers/ |
| Current File : /home/aliyykcz/public_html/wp-content/plugins_old/yaycurrency/src/helpers/blocks.helper.min.js |
!function (e, r) { YayCurrency_Blocks = r.YayCurrency_Blocks || {}, YayCurrency_Blocks.Helper = { detectCheckoutBlocks: function () { var r = !1; return e(yay_currency_data_args.blocks_data_args.checkout).length && (r = !0), yayCurrencyHooks.applyFilters("yayCurrencyDetectCheckoutBlocks", r) }, detectCartBlocks: function () { var r = !1; return e(yay_currency_data_args.blocks_data_args.cart).length && (r = !0), yayCurrencyHooks.applyFilters("yayCurrencyDetectCartBlocks", r) }, debounce: function (e, r) { let c; return function (...t) { clearTimeout(c), c = setTimeout(() => e.apply(this, t), r) } }, waitForElement: function (e, r, c = 1e4) { const t = document.querySelector(e); if (t) return void r(t); const n = Date.now(), o = () => { const t = document.querySelector(e); t ? r(t) : Date.now() - n < c && requestAnimationFrame(o) }; requestAnimationFrame(o) }, handleParsePrice: function (e) { let r = e.replace(/[^0-9\s_,.]/g, "").trim(); if (!r) return 0; let c = r.split(/[\s_,.]+/); if (c.length < 1) return parseFloat(r) || 0; let t = c.pop() || "0", n = c.join(""); return parseFloat(n + (t ? "." + t : "")) || 0 }, approximatePriceHTML: function (e, r) { return " <span class='yay-currency-checkout-converted-approximately'>(~" + YayCurrency_Callback.Helper.formatPriceByCurrency(e, !0, r) + ")</span>" }, reCalculateCartSubtotalCheckoutBlocksPage: function () { if (YayCurrency_Blocks.Helper.detectCheckoutBlocks() && yayCurrency.checkout_notice_html) { "" != yayCurrency.checkout_notice_html && e(yay_currency_data_args.blocks_data_args.checkout).before(yayCurrency.checkout_notice_html); const r = yay_currency_data_args.common_data_args.yayCurrencyCartContents; e(document.body).on("wc_fragments_refreshed", function () { e.ajax({ url: yayCurrency.ajaxurl, type: "POST", data: { action: "yayCurrency_get_cart_subtotal_default_blocks", nonce: yayCurrency.nonce }, beforeSend: function (e) { YayCurrency_Callback.Helper.blockLoading(r) }, xhrFields: { withCredentials: !0 }, success: function (c) { YayCurrency_Callback.Helper.unBlockLoading(r), c.success && c.data.cart_subtotal && e(r).find(".woocommerce-Price-amount.amount").html(c.data.cart_subtotal) }, error: function (e, c, t) { YayCurrency_Callback.Helper.unBlockLoading(r), console.log("Error responseText: ", e.responseText) } }) }) } }, isTurnOffCheckout: function (e) { const r = YayCurrency_Callback.Helper.getCurrentCurrency(e); return !!("0" === yayCurrency.checkout_diff_currency && yayCurrency.default_currency_code !== r.currency || "1" === yayCurrency.checkout_diff_currency && "0" === r.status) }, handleFormatPriceCartCheckoutBlocks: function (e) { const r = new WeakSet; document.querySelectorAll(".wc-block-formatted-money-amount, .wc-block-components-product-price__regular, .wc-block-components-product-price__value.is-discounted").forEach(c => { if (r.has(c)) return; const t = c.textContent.trim(), n = YayCurrency_Blocks.Helper.handleParsePrice(t); if (isNaN(n)) return; const o = YayCurrency_Callback.Helper.formatPriceByCurrency(n, !1, e); t !== o && (c.textContent = o, r.add(c)) }) }, detectSpecialCurrencyNotAllowFormat: function (e) { return !!["SAR", "BHD", "AED", "KWD", "QAR", "OMR", "JOD", "TND"].includes(e.currency) && ("right" === e.currencyPosition || "right_space" === e.currencyPosition) }, formatPriceCartCheckoutBlocks: function (e) { if (!YayCurrency_Blocks.Helper.detectCartBlocks() && !YayCurrency_Blocks.Helper.detectCheckoutBlocks()) return; const c = YayCurrency_Callback.Helper.getCurrentCurrency(e); if (!c) return; if (YayCurrency_Blocks.Helper.detectSpecialCurrencyNotAllowFormat(c)) return; if (!c || c.currencyPosition === r.yayCurrency.currency_symbol_position) return; const t = YayCurrency_Blocks.Helper.isTurnOffCheckout(e); if (YayCurrency_Blocks.Helper.detectCheckoutBlocks() && t) return; const n = YayCurrency_Blocks.Helper.debounce(YayCurrency_Blocks.Helper.handleFormatPriceCartCheckoutBlocks.bind(this, c), 100); YayCurrency_Blocks.Helper.waitForElement(".wc-block-cart,.wc-block-checkout", e => { const c = new MutationObserver(n); c.observe(e, { childList: !0, subtree: !0, characterData: !0 }), n(), r.addEventListener("beforeunload", () => c.disconnect(), { once: !0 }) }) }, approximatePriceHTML: function (e, r) { return " <span class='yay-currency-checkout-converted-approximately'>(~" + YayCurrency_Callback.Helper.formatPriceByCurrency(e, !0, r) + ")</span>" }, approximatePriceCheckoutBlocks: function (c) { if (YayCurrency_Blocks.Helper.detectCheckoutBlocks()) { const t = YayCurrency_Callback.Helper.getCurrentCurrency(c); if ("0" === yayCurrency.checkout_diff_currency && yayCurrency.default_currency_code !== t.currency || "1" === yayCurrency.checkout_diff_currency && "0" === t.status) { YayCurrency_Blocks.Helper.handleAddApproximatePrices(t); const c = new MutationObserver(function (e) { YayCurrency_Blocks.Helper.handleAddApproximatePrices(t) }); c.observe(document.querySelector(".wc-block-checkout"), { childList: !0, subtree: !0 }), e(r).on("unload", function () { c.disconnect() }) } } }, handleAddApproximatePrices: function (r) { e(".wc-block-formatted-money-amount, .wc-block-components-product-price__regular, .wc-block-components-product-price__value.is-discounted").each(function () { if (!e(this).find(".yay-currency-checkout-converted-approximately").length) { const c = e(this).text().trim(); let t = YayCurrency_Blocks.Helper.handleParsePrice(c); if (!isNaN(t)) { const c = YayCurrency_Blocks.Helper.approximatePriceHTML(t, r); e(this).append(c) } } }) }, setHeaderParamToDetectCartOrCheckoutBlocks: function () { const e = r.fetch; r.fetch = function (r, c) { (c = c || {}).headers = c.headers || {}; const t = "string" == typeof r ? r : r.url; if (t && t.includes("/wc/store/v1/")) { let e = ""; document.body.classList.contains("woocommerce-cart") && (e = "cart"), document.body.classList.contains("woocommerce-checkout") && (e = "checkout"), c.headers["YayCurrency-WC-Blocks-Context"] = e } return e(r, c) } } } }(jQuery, window);