From 5955bd821303cffa35263c41286339fb28e7536b Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Mon, 27 Mar 2023 14:21:49 +0530 Subject: Added auto fill otp for mutation application. Scoping the outputs of all scripts in iife. Using webpack-merge to merge configuration options. --- src/scripts/otps/grievance-application.ts | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'src/scripts/otps/grievance-application.ts') diff --git a/src/scripts/otps/grievance-application.ts b/src/scripts/otps/grievance-application.ts index 140504c..10d38ef 100644 --- a/src/scripts/otps/grievance-application.ts +++ b/src/scripts/otps/grievance-application.ts @@ -1,22 +1,6 @@ -document.addEventListener("DOMContentLoaded", () => { - const proxiedPost = $.post; +import { addAutofillOtps } from "@/shared/autofill-otp"; - $.post = function() { - let element: HTMLInputElement | null = null; - if (arguments[0].endsWith("MISPetitionSmsSend.action")) { - element = document.querySelector("input[name=mobile_Code]") as HTMLInputElement; - } else if (arguments[0].endsWith("MISPetitionEmailSend.action")) { - element = document.querySelector("input[name=txtemail_Code]") as HTMLInputElement; - } - - if (element) { - const callback = arguments[2]; - arguments[2] = (data: any) => { - element!.value = data?.messageShow || ""; - callback(data); - }; - } - - return proxiedPost.apply(this, Array.from(arguments) as any); - }; -}); +addAutofillOtps([ + ["MISPetitionSmsSend.action", "input[name=mobile_Code]"], + ["MISPetitionEmailSend.action", "input[name=txtemail_Code]"] +]); -- cgit v1.2.3