aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/otps
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-03-27 14:21:49 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-03-27 14:25:45 +0530
commit5955bd821303cffa35263c41286339fb28e7536b (patch)
tree98344fe12d6fc4b6003ec1fdcafbc61fc613510c /src/scripts/otps
parent84f86da2faab3af73e3a55ab576ca14a0d38259e (diff)
downloadbanglar-bhumi-utils-5955bd821303cffa35263c41286339fb28e7536b.tar.gz
banglar-bhumi-utils-5955bd821303cffa35263c41286339fb28e7536b.zip
Added auto fill otp for mutation application.
Scoping the outputs of all scripts in iife. Using webpack-merge to merge configuration options.
Diffstat (limited to 'src/scripts/otps')
-rw-r--r--src/scripts/otps/grievance-application.ts26
-rw-r--r--src/scripts/otps/mutation-application.ts6
2 files changed, 11 insertions, 21 deletions
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]"]
+]);
diff --git a/src/scripts/otps/mutation-application.ts b/src/scripts/otps/mutation-application.ts
new file mode 100644
index 0000000..ecf6aaa
--- /dev/null
+++ b/src/scripts/otps/mutation-application.ts
@@ -0,0 +1,6 @@
+import { addAutofillOtps } from "@/shared/autofill-otp";
+
+addAutofillOtps([
+ ["muteSmsSend.action", "#mobile_CodeMute"],
+ ["muteEmailSend.action", "#txtemail_CodeMute"]
+]);