PageSourceSearch

https://electricalsuppliesaustralia.com.au/wp-content/plugins/aust…ausmypost_cart_checkout_script.js?ver=2.0.0

js electricalsuppliesaustralia.com.au collected 2026-10-08 19:55:12 UTC 2,774 bytes, 78 lines download raw bytes

1jQuery(document).ready(function(){
2  
3    jQuery(document.body).on("updated_checkout", async function () {
4      console.clear();
5      await getMypostRatesRequestLogs();
6    });
7    
8    jQuery(document.body).on("updated_cart_totals", async function () {
9      console.clear();
10      await getMypostRatesRequestLogs();
11    });
12    });
13    async function getMypostRatesRequestLogs() {
14        const response = await jQuery.ajax({
15          type: "get",
16          url:mypost_cart_checkout.ajax_url,
17          data: {
18            action:"mypost_get_rates_request_logs",
19            _ajax_nonce:mypost_cart_checkout.nonce,
20          },
21          dataType: "json",
22        });
23        if (response?.success && response?.data) {
24          const responseData = response?.data;
25    
26      
27          if (responseData?.mypost_rates_logs) {
28            
29            console.log(
30              responseData?.mypost_rates_logs
31                ?.replaceAll("%colored_text_start%", "%c")
32                ?.replaceAll("%colored_text_end%", "%c"),
33              responseData?.mypost_rates_logs?.includes("%colored_text_start%")
34                ? "color: red"
35                : "",
36              responseData?.mypost_rates_logs?.includes("%colored_text_end%")
37                ? "color: initial"
38                : ""
39            );
40          }
41        }
42      }
43
44      jQuery(document).ready(function () {
45       // Save a reference to the original fetch function
46        const originalFetch = window.fetch;
47
48        // Create a Proxy to intercept calls to fetch
49        window.fetch = new Proxy(originalFetch, {
50          apply: async function (target, thisArg, argumentsList) {
51            // Get the URL and options from the fetch arguments
52            const url = argumentsList[0];
53            const options = argumentsList[1];
54
55            // Check if the URL matches the target URL and the method is POST
56            // The url is called when the cart/checkout data is updated.
57            if (
58              url.includes("/wp-json/wc/store/") &&
59              options &&
60              options.method === "POST"
61            ) {
62              // Make the actual fetch request and get the response
63              const response = await target.apply(thisArg, argumentsList);
64
65              // Check if we are in cart/checkout context and fetch the rates request log.
66              if (window?.wp?.data?.select("wc/store/cart")?.getCartData()) {
67                getMypostRatesRequestLogs();
68              }
69
70              // Return the response
71              return response;
72            } else {
73              // If the URL or method does not match, proceed with the original fetch
74              return target.apply(thisArg, argumentsList);
75            }
76          },
77        });
78      });

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.