PageSourceSearch

https://essexmonastery.com/wp-content/plugins/yaycurrency-pro/src/helpers/blocks.helper.min.js?ver=3.3.5

js essexmonastery.com collected 2026-09-24 20:40:12 UTC 11,007 bytes, 1 lines download raw bytes

1!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 (...o) { clearTimeout(c), c = setTimeout(() => e.apply(this, o), r) } }, waitForElement: function (e, r, c = 1e4) { const o = document.querySelector(e); if (o) return void r(o); const a = Date.now(), t = () => { const o = document.querySelector(e); o ? r(o) : Date.now() - a < c && requestAnimationFrame(t) }; requestAnimationFrame(t) }, 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 o = c.pop() || "0", a = c.join(""); return parseFloat(a + (o ? "." + o : "")) || 0 }, isTurnOffCheckout: function (e) { const r = YayCurrency_Callback.Helper.getCurrentCurrency(e); if (!("0" === yayCurrency.checkout_diff_currency && yayCurrency.default_currency_code !== r.currency || "1" === yayCurrency.checkout_diff_currency && "0" === r.status)) return !1; const { fallback_currency_code: c, default_currency_code: o } = yayCurrency; return !(c !== o) || r.currency !== c }, detectForcePaymentInitDomChanges: function (e) { r.onload = function () { const r = yayCurrency.total_block_class ?? (yayCurrency.cart_page ? yay_currency_data_args.blocks_data_args.totalCart : yay_currency_data_args.blocks_data_args.totalCheckout); var c = document.querySelector(r); if (c) { new MutationObserver(function (r, c) { for (var o of r) "characterData" === o.type && YayCurrency_Callback.Helper.reRenderHTMLAfterForceCountryCode(e, !0) }).observe(c, { characterData: !0, subtree: !0 }) } } }, detectApplyCurrencyForceCountryCode: function (c) { const o = YayCurrency_Callback.Helper.getCookie(yay_currency_data_args.cookies_data_args.blocksForceNoticeHtml); if (o && (e(yay_currency_data_args.blocks_data_args.checkout).before(o), YayCurrency_Callback.Helper.deleteCookie(yay_currency_data_args.cookies_data_args.blocksForceNoticeHtml)), yayCurrency.currency_code) { const o = yayCurrency.currency_code; let a = null; r.yayCurrency.converted_currency.forEach(e => { e.currency != o || (a = e) }), a && a.ID !== +c && e.ajax({ url: yayCurrency.ajaxurl, type: "POST", data: { action: "yayCurrency_recalculate_apply_currency_from_blocks", nonce: yayCurrency.nonce, currencyID: c, currentCurrency: a }, beforeSend: function (e) { YayCurrency_Callback.Helper.blockLoading(yay_currency_data_args.blocks_data_args.checkout) }, xhrFields: { withCredentials: !0 }, success: function (e) { e.success ? (e.data.force_payment_notice && YayCurrency_Callback.Helper.setCookie(yay_currency_data_args.cookies_data_args.blocksForceNoticeHtml, e.data.force_payment_notice, +yayCurrency.cookie_lifetime_days), location.reload()) : YayCurrency_Callback.Helper.unBlockLoading(yay_currency_data_args.blocks_data_args.checkout) }, error: function (e, r, c) { YayCurrency_Callback.Helper.unBlockLoading(yay_currency_data_args.blocks_data_args.checkout), console.log("Error responseText: ", e.responseText) } }) } }, forcePaymentOnCheckoutBlocksPage: function (e) { YayCurrency_Blocks.Helper.detectForcePaymentInitDomChanges(e), YayCurrency_Blocks.Helper.detectApplyCurrencyForceCountryCode(e), yayCurrencyHooks.doAction("yayCurrencyHandleForcePaymentBlocksCheckoutPage", [{ data_args: yay_currency_data_args, oldCurrencyID: e }]) }, reloadPageAfterForcePaymentCountryFound: function (c = 0) { "undefined" != typeof wp && wp.data && wp.data.subscribe && wp.data.subscribe(() => { const o = wp.data.select("wc/store/cart").getCartData(); if (o && o.reload && o.forcePaymentCountryFound) { const a = o.forceFoundApplyCurrency || !1; if (a) { const t = a.ID || !1, n = o.forcePaymentCountryFound || !1; if (t && n && yayCurrency.country_code !== n) { const y = YayCurrency_Blocks.Helper.isTurnOffCheckout(c), u = YayCurrency_Blocks.Helper.isTurnOffCheckout(t);
1 if ("yes" === (o.forcePaymentCountryForAllPages || "no")) { YayCurrency_Callback.Helper.setCookie(yayCurrency.cookie_name, t); YayCurrency_Callback.Helper.getCookie(yayCurrency.cookie_switcher_name) && YayCurrency_Callback.Helper.setCookie(yayCurrency.cookie_switcher_name, t) } if (y || u || "yes" === o.reload) r.location.reload(); else { yayCurrency.country_code = n, yayCurrency.currency_code = a.currency; const r = o.forcePaymentNoticeHtml || !1, t = o.forcePaymentNoticeWrapper || !1; if (r && t) { const c = YayCurrency_Callback.yay_force_payment_data_args; e(c.yayCurrencyForcePaymentNotice).length ? e(c.yayCurrencyForcePaymentNotice).html(r) : e(yay_currency_data_args.blocks_data_args.checkout).before(t) } YayCurrency_Callback.Helper.reRenderHTMLAfterForceCountryCode(c), e(document.body).trigger("wc_fragment_refresh") } } } } }) }, reloadPageAfterForcePaymentMethodFound: function (c) { if ("undefined" != typeof wp && wp.data && wp.data.subscribe) { const o = r.fetch; r.fetch = async function (a, t) { const n = await o(a, t); if (a.includes("/wc/store/v1/checkout?__experimental_calc_totals=true")) try { const o = n.clone(), a = await o.json(); if ("payment" === (a.forceCurrencyType || "")) { const o = a.forceFoundApplyCurrency || !1; if (!o) return; const t = o.ID || !1, n = "yes" === a.reload; if (t) { const o = YayCurrency_Blocks.Helper.isTurnOffCheckout(c), y = YayCurrency_Blocks.Helper.isTurnOffCheckout(t); if ("yes" === (a.forcePaymentCountryForAllPages || "no")) { YayCurrency_Callback.Helper.setCookie(yayCurrency.cookie_name, t); YayCurrency_Callback.Helper.getCookie(yayCurrency.cookie_switcher_name) && YayCurrency_Callback.Helper.setCookie(yayCurrency.cookie_switcher_name, t) } o || y || n ? r.location.reload() : (YayCurrency_Callback.Helper.reRenderHTMLAfterForceCountryCode(c), e(document.body).trigger("wc_fragment_refresh")) } } } catch (e) { console.error("Error parsing API response:", e) } return n } } }, forcePaymentOnCartBlocksPage: function (e) { YayCurrency_Blocks.Helper.detectForcePaymentInitDomChanges(e), yayCurrencyHooks.doAction("yayCurrencyHandleForcePaymentBlocksCartPage", [{ data_args: yay_currency_data_args, oldCurrencyID: e }]) }, wooCommerceBlocksForcePayment: function (r) { YayCurrency_Blocks.Helper.detectCheckoutBlocks() && (yayCurrency.force_payment && (YayCurrency_Blocks.Helper.forcePaymentOnCheckoutBlocksPage(r), YayCurrency_Blocks.Helper.reloadPageAfterForcePaymentCountryFound(r)), yayCurrency.force_currency && YayCurrency_Blocks.Helper.reloadPageAfterForcePaymentMethodFound(r), yayCurrency.checkout_notice_html && "" != yayCurrency.checkout_notice_html && e(yay_currency_data_args.blocks_data_args.checkout).before(yayCurrency.checkout_notice_html)), YayCurrency_Blocks.Helper.detectCartBlocks() && yayCurrency.force_payment && YayCurrency_Blocks.Helper.forcePaymentOnCartBlocksPage(r), yayCurrencyHooks.doAction("yayCurrencyHandleForcePaymentBlocks", [{ data_args: yay_currency_data_args, oldCurrencyID: r }]) }, 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 o = c.textContent.trim(), a = YayCurrency_Blocks.Helper.handleParsePrice(o); if (isNaN(a)) return; const t = YayCurrency_Callback.Helper.formatPriceByCurrency(a, !1, e); o !== t && (c.textContent = t, 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; if (yayCurrency.force_payment || yayCurrency.force_currency) return; const c = YayCurrency_Callback.Helper.getCurrentCurrency(e); if (!c) return; if (YayCurrency_Blocks.Helper.detectSpecialCurrencyNotAllowFormat(c)) return; const o = r.yayCurrency.currency_symbol_position; if (!c || c.currencyPosition === o && "not_display" === c.currencyCodePosition) return; const a = YayCurrency_Blocks.Helper.isTurnOffCheckout(e); if (YayCurrency_Blocks.Helper.detectCheckoutBlocks() && a) return; const t = 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(t); c.observe(e, { childList: !0, subtree: !0, characterData: !0 }), t(), r.addEventListener("beforeunload", () => c.disconnect(), { once: !0 }) }) }, approximatePriceHTML: function (e, c) { const { default_currency_code: o, fallback_currency_code: a } = r.yayCurrency; if (o !== a) { const r = YayCurrency_Callback.Helper.getCurrentCurrencyByCode(a); e = YayCurrency_Callback.Helper.handelRevertPrice(e, r) } return " <span class='yay-currency-checkout-converted-approximately'>(~" + YayCurrency_Callback.Helper.formatPriceByCurrency(e, !0, c) + ")</span>" }, 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 o = YayCurrency_Blocks.Helper.handleParsePrice(c); if (!isNaN(o)) { const c = YayCurrency_Blocks.Helper.approximatePriceHTML(o, r); e(this).append(c) } } }) }, approximatePriceCheckoutBlocks: function (c) { if (!YayCurrency_Blocks.Helper.detectCheckoutBlocks()) return; const o = YayCurrency_Callback.Helper.getCurrentCurrency(c), a = YayCurrency_Blocks.Helper.isTurnOffCheckout(c), t = r.yayCurrency.fixed_product_price_enable ?? "0"; if (a && "0" === t) { YayCurrency_Blocks.Helper.handleAddApproximatePrices(o); const c = new MutationObserver(function (e) { YayCurrency_Blocks.Helper.handleAddApproximatePrices(o) }); c.observe(document.querySelector(".wc-block-checkout"), { childList: !0, subtree: !0 }), e(r).on("unload", function () { c.disconnect() }) } }, setHeaderParamToDetectCartOrCheckoutBlocks: function () { const e = r.fetch; r.fetch = function (r, c) { const o = "string" == typeof r ? r : r?.url; if (!o || !o.includes("/wc/store/v1/")) return e(r, c); (c = c || {}).headers = c.headers || {}; let a = ""; return document.body.classList.contains("woocommerce-cart") && (a = "cart"), document.body.classList.contains("woocommerce-checkout") && (a = "checkout"), c.headers["YayCurrency-WC-Blocks-Context"] = a, e(r, c) } } } }(jQuery, window);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.