NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Seller appeals // @namespace http://amazon.in // @version 0.2 // @description Identifies incorrect inputs from TT page // @author stthorve - Shrikant Thorve // @match https://*.tt.amazon.com/* // @match https://tt.amazon.com/* // @updateURL https://openuserjs.org/meta/kalpdev.1/Seller_appeals.meta.js // @downloadURL https://openuserjs.org/install/kalpdev.1/Seller_appeals.user.js // @require https://code.jquery.com/jquery-3.3.1.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.es6.min.js // @require https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js // @require https://unpkg.com/sweetalert/dist/sweetalert.min.js // @license MIT // ==/UserScript== function testAlert(){ $("#save-button").before('<a class="tt_button orange_button" id="check-button"><span>Save</span></a>'); $("#save-button").hide(); $("#tabstrip").after('<br><br><button id="Error_count" class="a-button-text" type="button">Show Error Count</button>'); $('#Error_count').click(function(event) { var condition1_errcnt = localStorage.getItem("cndn1_err_cnt"); var condition2_errcnt = localStorage.getItem("cndn2_err_cnt"); var condition3_errcnt = localStorage.getItem("cndn3_err_cnt"); var condition4_errcnt = localStorage.getItem("cndn4_err_cnt"); var condition5_errcnt = localStorage.getItem("cndn5_err_cnt"); var condition8_errcnt = localStorage.getItem("cndn8_err_cnt"); var condition9_errcnt = localStorage.getItem("cndn9_err_cnt"); var condition10_errcnt = localStorage.getItem("cndn10_err_cnt"); var condition11_errcnt = localStorage.getItem("cndn11_err_cnt"); condition1_errcnt = (condition1_errcnt == null) ? 0 : condition1_errcnt; condition2_errcnt = (condition2_errcnt == null) ? 0 : condition2_errcnt; condition3_errcnt = (condition3_errcnt == null) ? 0 : condition3_errcnt; condition4_errcnt = (condition4_errcnt == null) ? 0 : condition4_errcnt; condition5_errcnt = (condition5_errcnt == null) ? 0 : condition5_errcnt; condition8_errcnt = (condition8_errcnt == null) ? 0 : condition8_errcnt; condition9_errcnt = (condition9_errcnt == null) ? 0 : condition9_errcnt; condition10_errcnt = (condition10_errcnt == null) ? 0 : condition10_errcnt; condition11_errcnt = (condition11_errcnt == null) ? 0 : condition11_errcnt; swal({ title: "Error Count", text: "Condition 1 : " + condition1_errcnt + "\nCondition 2 : " + condition2_errcnt + "\nCondition 3 : " + condition3_errcnt + "\nCondition 4 : " + condition4_errcnt + "\nCondition 5 : " + condition5_errcnt + "\nCondition 8 : " + condition8_errcnt + "\nCondition 9 : " + condition9_errcnt + "\nCondition 10 : " + condition10_errcnt + "\nCondition 11 : " + condition11_errcnt, button: "OK" }); }); $('#check-button').click(function(event) { var root_cause = document.getElementById('root_cause').value; if(root_cause.includes("Re-Open")==true) { $("#save-button").click(); //alert("valid"); } else { var correspondence_text = document.getElementById('correspondence').value; var lowercase_string_check = correspondence_text.toLowerCase(); var rootCause = document.getElementById('root_cause').value; var lowercase_rootCause = rootCause.toLowerCase(); var error_check = ""; var error_string = ""; var error_string_1 = ""; var flag_1 = 0; var flag_2 = 0; var cndn_2_check = ""; var cndn_3_check = ""; var cndn_4_check = ""; var cndn_8_check = ""; var cndn_9_check = ""; var cndn_10_check = ""; var cndn_11_check = ""; //condition 5 if(lowercase_string_check.includes("has been reinstated")==true) { if(lowercase_rootCause.includes("resolved (incorrectly bulk restricted)")==false && lowercase_rootCause.includes("resolved (approved from quarantine)")==false && lowercase_rootCause.includes("resolved (content ok)")==false && lowercase_rootCause.includes("resolved (incorrectly restricted by c-ops-rp)")==false && lowercase_rootCause.includes("resolved (incorrectly restricted by auto-review)")==false && lowercase_rootCause.includes("resolved (keyword string - asin reinstated)")==false && lowercase_rootCause.includes("resolved (legal confirmed product ok for sale)")==false && lowercase_rootCause.includes("resolved (seller provided proof)")==false && lowercase_rootCause.includes("resolved (seller made changes)")==false && lowercase_rootCause.includes("resolved (rule update)")==false && lowercase_rootCause.includes("resolved (seller's proof reviewed- reinstated)")==false) { flag_2 = 1; if(localStorage.getItem("cndn5_err_cnt") === null) { localStorage.setItem("cndn5_err_cnt", 1); } else{ localStorage.cndn5_err_cnt = Number(localStorage.cndn5_err_cnt) + 1; } //condition 1 if(lowercase_string_check.includes("\"\"")==true) { flag_1 = 1; error_string_1 = "\n* Fill Content In The Codes"; if(localStorage.getItem("cndn1_err_cnt") === null) { localStorage.setItem("cndn1_err_cnt", 1); } else{ localStorage.cndn1_err_cnt = Number(localStorage.cndn1_err_cnt) + 1; } } } else { //condition 1 if(lowercase_string_check.includes("\"\"")==true) { flag_1 = 1; error_string_1 = "\n* Fill Content In The Codes"; if(localStorage.getItem("cndn1_err_cnt") === null) { localStorage.setItem("cndn1_err_cnt", 1); } else{ localStorage.cndn1_err_cnt = Number(localStorage.cndn1_err_cnt) + 1; } } } } else { //condition 1 if(lowercase_string_check.includes("\"\"")==true) { flag_1 = 1; error_string_1 = "\n* Fill Content In The Codes"; if(localStorage.getItem("cndn1_err_cnt") === null) { localStorage.setItem("cndn1_err_cnt", 1); } else{ localStorage.cndn1_err_cnt = Number(localStorage.cndn1_err_cnt) + 1; } } //condition 2 if(lowercase_string_check.includes("cannot be reinstated")==true) { if(lowercase_rootCause.includes("resolved (asin correctly bulk restricted)")==false && lowercase_rootCause.includes("resolved (seller's proof reviewed- restricted)")==false && lowercase_rootCause.includes("resolved (asin correctly restricted)")==false && lowercase_rootCause.includes("resolved (incorrectly approved by c-ops-rp)")==false && lowercase_rootCause.includes("resolved (incorrectly approved by auto-review)")==false && lowercase_rootCause.includes("resolved (keyword string - restricted asin)")==false) { if(lowercase_string_check.includes("bad detail page")==true) { cndn_3_check = cndtn_3(); } if(lowercase_string_check.includes("provide the asin")==true) { cndn_4_check = cndtn_4(); } if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true) { cndn_8_check = cndtn_8(); } if(lowercase_string_check.includes("new ticket has been created")==true) { cndn_9_check = cndtn_9(); } if(lowercase_string_check.includes("already live on site")==true) { cndn_10_check = cndtn_10(); } if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true) { cndn_11_check = cndtn_11(); } if(cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid") { //alert("No Error"); } else { flag_2 = 1; if(localStorage.getItem("cndn2_err_cnt") === null) { localStorage.setItem("cndn2_err_cnt", 1); } else{ localStorage.cndn2_err_cnt = Number(localStorage.cndn2_err_cnt) + 1; } } } } //condition 3 if(lowercase_string_check.includes("bad detail page")==true) { if(lowercase_rootCause.includes("resolved (bad detail page)")==false) { if(lowercase_string_check.includes("cannot be reinstated")==true) { cndn_2_check = cndtn_2(); } if(lowercase_string_check.includes("provide the asin")==true) { cndn_4_check = cndtn_4(); } if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true) { cndn_8_check = cndtn_8(); } if(lowercase_string_check.includes("new ticket has been created")==true) { cndn_9_check = cndtn_9(); } if(lowercase_string_check.includes("already live on site")==true) { cndn_10_check = cndtn_10(); } if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true) { cndn_11_check = cndtn_11(); } if(cndn_2_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid") { //alert("No Error"); } else { flag_2 = 1; if(localStorage.getItem("cndn3_err_cnt") === null) { localStorage.setItem("cndn3_err_cnt", 1); } else{ localStorage.cndn3_err_cnt = Number(localStorage.cndn3_err_cnt) + 1; } } } } //condition 4 if(lowercase_string_check.includes("provide the asin")==true) { if(lowercase_rootCause.includes("resolved (incomplete information)")==false) { if(lowercase_string_check.includes("cannot be reinstated")==true) { cndn_2_check = cndtn_2(); } if(lowercase_string_check.includes("bad detail page")==true) { cndn_3_check = cndtn_3(); } if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true) { cndn_8_check = cndtn_8(); } if(lowercase_string_check.includes("new ticket has been created")==true) { cndn_9_check = cndtn_9(); } if(lowercase_string_check.includes("already live on site")==true) { cndn_10_check = cndtn_10(); } if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true) { cndn_11_check = cndtn_11(); } if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid") { //alert("No Error"); } else { flag_2 = 1; if(localStorage.getItem("cndn4_err_cnt") === null) { localStorage.setItem("cndn4_err_cnt", 1); } else{ localStorage.cndn4_err_cnt = Number(localStorage.cndn4_err_cnt) + 1; } } } } //condition 8 if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true) { if(lowercase_rootCause.includes("resolved (duplicate tt)")==false) { if(lowercase_string_check.includes("cannot be reinstated")==true) { cndn_2_check = cndtn_2(); } if(lowercase_string_check.includes("bad detail page")==true) { cndn_3_check = cndtn_3(); } if(lowercase_string_check.includes("provide the asin")==true) { cndn_4_check = cndtn_4(); } if(lowercase_string_check.includes("new ticket has been created")==true) { cndn_9_check = cndtn_9(); } if(lowercase_string_check.includes("already live on site")==true) { cndn_10_check = cndtn_10(); } if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true) { cndn_11_check = cndtn_11(); } if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid") { //alert("No Error"); } else { flag_2 = 1; if(localStorage.getItem("cndn8_err_cnt") === null) { localStorage.setItem("cndn8_err_cnt", 1); } else{ localStorage.cndn8_err_cnt = Number(localStorage.cndn8_err_cnt) + 1; } } } } //condition 9 if(lowercase_string_check.includes("new ticket has been created")==true) { if(lowercase_rootCause.includes("resolved (tt to legal - rationale states legal handles appeal)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller has appealed multiple times)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller provided additional documentation)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller removed/added claim on detail page)")==false && lowercase_rootCause.includes("resolved (tt to legal - unable to take decision)")==false && lowercase_rootCause.includes("resolved (new tt assigned to other team)")==false) { if(lowercase_string_check.includes("cannot be reinstated")==true) { cndn_2_check = cndtn_2(); } if(lowercase_string_check.includes("bad detail page")==true) { cndn_3_check = cndtn_3(); } if(lowercase_string_check.includes("provide the asin")==true) { cndn_4_check = cndtn_4(); } if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true) { cndn_8_check = cndtn_8(); } if(lowercase_string_check.includes("already live on site")==true) { cndn_10_check = cndtn_10(); } if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true) { cndn_11_check = cndtn_11(); } if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_10_check=="valid" || cndn_11_check=="valid") { //alert("No Error"); } else { flag_2 = 1; if(localStorage.getItem("cndn9_err_cnt") === null) { localStorage.setItem("cndn9_err_cnt", 1); } else{ localStorage.cndn9_err_cnt = Number(localStorage.cndn9_err_cnt) + 1; } } } } //condition 10 if(lowercase_string_check.includes("already live on site")==true) { if(lowercase_rootCause.includes("resolved (asin live)")==false) { if(lowercase_string_check.includes("cannot be reinstated")==true) { cndn_2_check = cndtn_2(); } if(lowercase_string_check.includes("bad detail page")==true) { cndn_3_check = cndtn_3(); } if(lowercase_string_check.includes("provide the asin")==true) { cndn_4_check = cndtn_4(); } if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true) { cndn_8_check = cndtn_8(); } if(lowercase_string_check.includes("new ticket has been created")==true) { cndn_9_check = cndtn_9(); } if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true) { cndn_11_check = cndtn_11(); } if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_11_check=="valid") { //alert("No Error"); } else { flag_2 = 1; if(localStorage.getItem("cndn10_err_cnt") === null) { localStorage.setItem("cndn10_err_cnt", 1); } else{ localStorage.cndn10_err_cnt = Number(localStorage.cndn10_err_cnt) + 1; } } } } //condition 11 if(lowercase_string_check.includes("not been suppressed")==true || lowercase_string_check.includes("manually yanked from website")==true || lowercase_string_check.includes('reviewed under "sexual product rules"')==true) { if(lowercase_rootCause.includes("resolved (wrong cti)")==false) { if(lowercase_string_check.includes("cannot be reinstated")==true) { cndn_2_check = cndtn_2(); } if(lowercase_string_check.includes("bad detail page")==true) { cndn_3_check = cndtn_3(); } if(lowercase_string_check.includes("provide the asin")==true) { cndn_4_check = cndtn_4(); } if(lowercase_string_check.includes("already being worked")==true || lowercase_string_check.includes("already worked")==true) { cndn_8_check = cndtn_8(); } if(lowercase_string_check.includes("new ticket has been created")==true) { cndn_9_check = cndtn_9(); } if(lowercase_string_check.includes("already live on site")==true) { cndn_10_check = cndtn_10(); } if(cndn_2_check=="valid" || cndn_3_check=="valid" || cndn_4_check=="valid" || cndn_8_check=="valid" || cndn_9_check=="valid" || cndn_10_check=="valid") { //alert("No Error"); } else { flag_2 = 1; if(localStorage.getItem("cndn11_err_cnt") === null) { localStorage.setItem("cndn11_err_cnt", 1); } else{ localStorage.cndn11_err_cnt = Number(localStorage.cndn11_err_cnt) + 1; } } } } function cndtn_2(){ if(lowercase_rootCause.includes("resolved (asin correctly bulk restricted)")==false && lowercase_rootCause.includes("resolved (seller's proof reviewed- restricted)")==false && lowercase_rootCause.includes("resolved (asin correctly restricted)")==false && lowercase_rootCause.includes("resolved (incorrectly approved by c-ops-rp)")==false && lowercase_rootCause.includes("resolved (incorrectly approved by auto-review)")==false && lowercase_rootCause.includes("resolved (keyword string - restricted asin)")==false) { return "incorrect"; } else { return "valid"; } } function cndtn_3(){ if(lowercase_rootCause.includes("resolved (bad detail page)")==false) { return "incorrect"; } else { return "valid"; } } function cndtn_4(){ if(lowercase_rootCause.includes("resolved (incomplete information)")==false) { return "incorrect"; } else { return "valid"; } } function cndtn_8(){ if(lowercase_rootCause.includes("resolved (duplicate tt)")==false) { return "incorrect"; } else { return "valid"; } } function cndtn_9(){ if(lowercase_rootCause.includes("resolved (tt to legal - rationale states legal handles appeal)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller has appealed multiple times)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller provided additional documentation)")==false && lowercase_rootCause.includes("resolved (tt to legal - seller removed/added claim on detail page)")==false && lowercase_rootCause.includes("resolved (tt to legal - unable to take decision)")==false && lowercase_rootCause.includes("resolved (new tt assigned to other team)")==false) { return "incorrect"; } else { return "valid"; } } function cndtn_10(){ if(lowercase_rootCause.includes("resolved (asin live)")==false) { return "incorrect"; } else { return "valid"; } } function cndtn_11(){ if(lowercase_rootCause.includes("resolved (wrong cti)")==false) { return "incorrect"; } else { return "valid"; } } } if(flag_2!="0" || flag_1!="0") { if(flag_2!="0") { error_string = "\n* Incorrect Root Cause Selected"; } var msg = error_string_1 + error_string; swal({ title: "Alert", text: "Following errors has been observed :\n" + msg, button: "OK" }); } else if(error_check=="") { $("#save-button").click(); //alert("valid"); } } }); } window.onLoad = testAlert();