I have to edit the minified snippet below to: IF a message (string) is handled by the snippet containing the word API then to change the entire message to Something went wrong. Try again later. Please let me know how I can do this. Thank you!
wc_myplugin.BaseGateway.prototype.submit_error = function(t) {
var e = this.get_error_message(t);
e.indexOf("</ul>") < 0 && (e = '<div class="' + function() {
var t = "woocommerce-MyPlugin";
return this.is_current_page("checkout") && (t += " woocommerce-MyPlugin-checkout"), t
}.bind(this)() + '"><ul class="woocommerce-error"><li>' + e + "</li></ul></div>");
t = o(document.body).triggerHandler("wc_myplugin_submit_error", [e, t, this]);
e = void 0 === t ? e : t, this.submit_message(e)
I added var eMessage = e.contains('API') ? 'Something went wrong. Try again later' : e; on the third row. Basically, checks if the error message contains "API" (capital letters). If so, the error message is replaced, otherwise it remains the same.
wc_myplugin.BaseGateway.prototype.submit_error = function(t) {
var e = this.get_error_message(t);
var eMessage = e.contains('API') ? 'Something went wrong. Try again later' : e;
e.indexOf("</ul>") < 0 && (e = '<div class="' + function() {
var t = "woocommerce-MyPlugin";
return this.is_current_page("checkout") && (t += " woocommerce-MyPlugin-checkout"), t
}.bind(this)() + '"><ul class="woocommerce-error"><li>' + eMessage + "</li></ul></div>");
t = o(document.body).triggerHandler("wc_myplugin_submit_error", [e, t, this]);
e = void 0 === t ? e : t, this.submit_message(e)