PageSourceSearch

https://www.mordorintelligence.com/v7.0.0/express-js/contact-form.js?q=21

js mordorintelligence.com collected 2026-10-01 07:18:26 UTC 17,999 bytes, 481 lines download raw bytes

1window.translationTextMapping = {
2  ...(window.translationTextMapping || {}),
3  "Please enter valid phone number": {
4    es: "Por favor, inserte un número de teléfono válido",
5    ar: "يُرجى ادخال رقم هاتف صحيح",
6    fr: "Veuillez saisir un numéro de téléphone valide",
7    vi: "Vui lòng nhập số điện thoại hợp lệ",
8    zh: "请输入有效的电话号码",
9    pt: "Por favor, digite um número de telefone válido",
10    de: "Bitte geben Sie eine gültige Telefonnummer ein",
11    ru: "Пожалуйста, введите действительный номер телефона",
12    ja: "有効な電話番号を入力してください",
13    en: "Please enter valid phone number",
14  },
15};
16if (/staging\.mordorintelligence/gim.test(window.location.href))
17  base_url_for_contact = "https://staging.mordorintelligence.com";
18else if (/mordorlabs/gim.test(window.location.href))
19  base_url_for_contact = "https://www.mordorlabs.com";
20else if (
21  /mordorintelligence\.online/gim.test(window.location.href) ||
22  /localhost/gim.test(window.location.href)
23)
24  base_url_for_contact = "http://localhost:8080";
25else if (/mordorintelligence/gim.test(window.location.href))
26  base_url_for_contact = "https://www.mordorintelligence.com";
27
28let contact_form_err = false;
29const regex_email =
30  /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
31const phone_regex = /^[0-9+-]{6,15}$/;
32
33function verifyGenericEmail(email) {
34  var domain_full = email.split("@")[1];
35  var domain_name = domain_full.split(".")[0];
36  var domain_surname =
37    domain_full.split(".")[domain_full.split(".").length - 1];
38  var domain_arr = [
39    "gmail",
40    "yahoo",
41    "hotmail",
42    "aol",
43    "msn",
44    "wanadoo",
45    "orange",
46    "comcast",
47    "live",
48    "rediffmail",
49    "free",
50    "gmx",
51    "web",
52    "yandex",
53    "ymail",
54    "libero",
55    "outlook",
56    "mail",
57    "googlemail",
58    "rocketmail",
59    "freenet",
60    "mac",
61    "icloud",
62  ];
63  var list_of_generic_emails = domain_arr;
64  if (
65    list_of_generic_emails.indexOf(domain_name) !== -1 ||
66    email.indexOf("naver") !== -1
67  ) {
68    return "generic";
69  } else if (
70    domain_surname === "edu" ||
71    domain_full.indexOf(".ac.") !== -1 ||
72    email.indexOf("student") !== -1
73  ) {
74    return "educational";
75  } else return "valid";
76}
77
78if (window.location.href.includes("/contact-us")) {
79  var countryFlag;
80  async function fetchCountryFlagData() {
81    try {
82      let data;
83      let country_flag_uri = `${base_url_for_contact}/country-flag-list`;
84      const response = await fetch(country_flag_uri);
85      data = await response.json();
86      countryFlag = data;
87      return data;
88    } catch (error) {
89      // Handle errors
90      console.error("Error fetching data:", error);
91      //   throw error;
92    }
93  }
94  fetchCountryFlagData();
95  fetch(`${base_url}/api/leads/country`)
96    .then((resp) => resp.json())
97    .then(function (res) {
98      defaultCountry = res.country;
99      if (window.location.href.includes("mordorintelligence.kr/")) {
100        defaultCountry = "South Korea";
101      }
102      console.log("defaultCountry", defaultCountry);
103      if (countryFlag && defaultCountry) {
104        let initial_calligCode = countryFlag.filter((code) => {
105          return code.country_name == defaultCountry;
106        });
107        $(".country-code-cust").val("+" + initial_calligCode[0]?.calling_code);
108        document.querySelector(".clickcountryImg-cust").src =
109          `https://s3.mordorintelligence.com/flags/${initial_calligCode[0].country_name.toLowerCase()}.svg`;
110      }
111    });
112
113  let search,
114    showContrySelect = false;
115  let flagSearchInput,
116    newlist = [],
117    filterdList = [];
118  document.querySelector(".select-cntry-cust").style.display = "none";
119  $("#country-btn-cust").on("click", function (e) {
120    if (!showContrySelect) {
121      showContrySelect = true;
122      document.querySelector(".select-cntry-cust").style.display = "block";
123
124      if (countryFlag) {
125        countrylist(countryFlag);
126        $("#searchinput-cust").on("input", function (e) {
127          flagSearchInput = e.target.value;
128          if (e.target.value !== "") {
129            document.querySelector(".search-close-cust").style.display =
130              "block";
131            newlist = countryFlag.filter(function (item) {
132              const lc = item.country_name.toLowerCase();
133              const filter = e.target.value.toLowerCase();
134              return lc.includes(filter);
135            });
136            filterdList = newlist.length ? newlist : [];
137            countrylist(filterdList);
138          } else {
139            document.querySelector(".search-close-cust").style.display = "none";
140            countrylist(countryFlag);
141          }
142        });
143      }
144    } else {
145      showContrySelect = false;
146      // $('.select-cntry-cust').hide();
147      document.querySelector(".select-cntry-cust").style.display = "none";
148    }
149  });
150
151  $(".country-code-cust").on("input", function (e) {
152    document.querySelector(".select-cntry-cust").style.display = "none";
153    showContrySelect = false;
154    let flagBasedOnCodeChange = countryFlag.filter((code) => {
155      return (
156        code?.calling_code == e.target.value ||
157        code?.calling_code == "+" + e.target.value ||
158        "+" + code?.calling_code == e.target.value
159      );
160    });
161
162    if (flagBasedOnCodeChange.length) {
163      let flag = document.querySelector(".clickcountryImg-cust");
164      flag.src = `https://s3.mordorintelligence.com/flags/${flagBasedOnCodeChange[0].country_name.toLowerCase()}.svg`;
165      document.querySelector(".phone-error").style.display = "none";
166      error = false;
167    } else {
168      let flag = document.querySelector(".clickcountryImg-cust");
169      flag.src = "";
170      document.querySelector(".phone-error").style.display = "block";
171      document.querySelector(".phone-error").innerText =
172        "Please enter country code";
173      error = true;
174    }
175  });
176
177  $(".search-close-cust").on("click", function (e) {
178    if (countryFlag) {
179      countrylist(countryFlag);
180      $("#searchinput-cust").val("");
181      document.querySelector(".search-close-cust").style.display = "none";
182    }
183  });
184
185  function countrylist(list) {
186    const myNode = document.querySelector("#custom-select-cust");
187    myNode.innerHTML = "";
188    if (list.length) {
189      var countryName = list.map(function (country) {
190        let option, flag_img, classname, text;
191        option = document.createElement("div");
192        option.classList.add("customListItem");
193        option.setAttribute("id", country.country_name.split(" ").join(""));
194
195        if ($(".country-code-cust").val() == country?.calling_code) {
196          option.classList.add("active");
197        } else {
198          option.classList.remove("active");
199        }
200        flag_img = document.createElement("img");
201
202        option.appendChild(flag_img);
203        // flag_img.src = `https://s3.mordorintelligence.com/flags/${country.country_name.toLowerCase()}.svg`;
204        flag_img.alt = "img";
205        classname = "imgstyle";
206        var arr = flag_img.className.split(" ");
207        if (arr.indexOf(classname) == -1) {
208          flag_img.className += " " + classname;
209        }
210        text = document.createTextNode(
211          country.country_name + "(" + "+" + country?.calling_code + ")",
212        );
213        option.appendChild(text);
214        document.querySelector("#custom-select-cust").appendChild(option);
215        return country.country_name;
216      });
217
218      $(".customListItem").click(function (e) {
219        let selected_country_name = $(this).text().split("(")[0];
220        defaultCountry = selected_country_name;
221        document.querySelector(".clickcountryImg-cust").src =
222          `https://s3.mordorintelligence.com/flags/${selected_country_name.toLowerCase()}.svg`;
223        let country = countryFlag.filter((code) => {
224          return code.country_name == selected_country_name;
225        });
226        $("#ds_countrycode-cust").val("+" + country[0]?.calling_code);
227        // document.querySelector('.country-code-cust').value = "+" + country[0]?.calling_code;
228        showContrySelect = false;
229        // $('.select-cntry-cust').hide();
230        document.querySelector(".select-cntry-cust").style.display = "none";
231      });
232      addintersectionObserver();
233    } else {
234      let option;
235      option = document.createElement("div");
236      option.innerText = "data not found";
237      document.querySelector("#custom-select-cust").appendChild(option);
238    }
239  }
240
241  function addintersectionObserver() {
242    setTimeout(function () {
243      let items = document.getElementsByClassName("customListItem");
244      for (let item of items) {
245        const options = {
246          root: null,
247          rootMargin: "0px 0px 0px 0px",
248        };
249        var observer = new IntersectionObserver((entries) => {
250          if (entries[0].isIntersecting) {
251            const country_name = entries[0].target.innerText
252              .split("(")[0]
253              .toLowerCase();
254            let src = `https://s3.mordorintelligence.com/flags/${country_name}.svg`;
255            entries[0].target.childNodes[0].src = src;
256          }
257        }, options);
258        observer.observe(item);
259      }
260    }, 100);
261  }
262}
263
264// verifying name
265$("#contact_name").on("input", function (e) {
266  e.preventDefault();
267  if (!e.target.value.length) {
268    contact_form_err = true;
269    document.querySelector(".contact-name-error").style.display = "block";
270  } else {
271    document.querySelector(".contact-name-error").style.display = "none";
272    contact_form_err = false;
273  }
274});
275
276//  Verifying email
277$("#contact_email").on("input", function (e) {
278  e.preventDefault();
279  let helperText = "";
280  if (e.target.value && !regex_email.test(e.target.value)) {
281    document.querySelector(".contact-email-error").style.display = "block";
282    helperText = "Please enter a valid email";
283    document.querySelector(".contact-email-error").innerText = helperText;
284    contact_form_err = true;
285  } else if (e.target.value.length) {
286    let genericEmail = verifyGenericEmail(e.target.value);
287    if (["generic"].indexOf(genericEmail) > -1) {
288      document.querySelector(".contact-email-error").style.display = "block";
289      helperText = "Please enter your business email";
290      document.querySelector(".contact-email-error").innerText = helperText;
291      contact_form_err = false;
292    } else {
293      contact_form_err = false;
294      document.querySelector(".contact-email-error").style.display = "none";
295    }
296  } else if (!e.target.value && !e.target.value.trim().length) {
297    document.querySelector(".contact-email-error").style.display = "block";
298    helperText = "Please enter a valid email id";
299    document.querySelector(".contact-email-error").innerText = helperText;
300    contact_form_err = true;
301  }
302});
303
304// verifying phone
305$("#contact_phone").on("input", function (event) {
306  let helperText = "";
307  // COMMENTED TO MAKE PHONE NUMBER OPTIONAL
308  // if (event.target.value && !phone_regex.test(event.target.value)) {
309  //   document.querySelector(".contact-phone-error").style.display = "block";
310  //   helperText =
311  //   translationTextMapping["Please enter valid phone number"][lang];
312  //   contact_form_err = true;
313  //   document.querySelector(".contact-phone-error").innerText = helperText;
314  // } else  if (!event.target.value && !event.target.value.trim().length) {
315  //   document.querySelector(".contact-phone-error").style.display = "block";
316  //   helperText =
317  //   translationTextMapping["Please enter valid phone number"][lang];
318  //   contact_form_err = true;
319  //   document.querySelector(".contact-phone-error").innerText = helperText;
320  // }  else {
321  // }
322  document.querySelector(".contact-phone-error").style.display = "none";
323  contact_form_err = false;
324});
325
326// verifying message
327$("#contact_message").on("input", function (e) {
328  e.preventDefault();
329  if (!e.target.value.length) {
330    contact_form_err = true;
331    document.querySelector(".contact-message-error").style.display = "block";
332  } else {
333    document.querySelector(".contact-message-error").style.display = "none";
334    contact_form_err = false;
335  }
336});
337
338$("#talk-to-analyst-contact-us").on("click", function (e) {
339  function pushLeadFailureToDataLayer() {
340    window.dataLayer = window.dataLayer || [];
341    window.dataLayer.push({
342      event: "Download_sample_Faliure_Tracks",
343      scroll_depth: window?._getScrollDepth?.() || null,
344    });
345
346    window._hsq = window._hsq || [];
347    window._hsq.push([
348      "trackCustomBehavioralEvent",
349      {
350        name: "pe242391144_download_sample_faliure_tracks",
351        properties: {},
352      },
353    ]);
354  }
355
356  e.preventDefault();
357  document.getElementById("talk-to-analyst-contact-us").disabled = true;
358
359  let c_name, c_email, c_phone, c_message;
360  c_name = $("#contact_name").val();
361  c_email = $("#contact_email").val();
362  c_phone = $("#contact_phone").val();
363  c_message = $("#contact_message").val();
364
365  if (c_name == "") {
366    contact_form_err = true;
367    document.querySelector(".contact-name-error").style.display = "block";
368    document.getElementById("talk-to-analyst-contact-us").disabled = false;
369  }
370  if (c_email == "") {
371    contact_form_err = true;
372    document.querySelector(".contact-email-error").style.display = "block";
373    document.getElementById("talk-to-analyst-contact-us").disabled = false;
374  }
375  // COMMENTED TO MAKE PHONE OPTIONAL
376  // if (c_phone == "") {
377  // contact_form_err = true;
378  // document.querySelector(".contact-phone-error").style.display = "block";
379  // document.getElementById("talk-to-analyst-contact-us").disabled = false;
380  // }
381  if (c_message == "") {
382    contact_form_err = true;
383    document.querySelector(".contact-message-error").style.display = "block";
384    document.getElementById("talk-to-analyst-contact-us").disabled = false;
385  }
386
387  if (!contact_form_err) {
388    document.querySelector("#submit_btn_loader").style.display = "block";
389    let body;
390    body = JSON.stringify({
391      name: $("#contact_name").val().trim(),
392      cta: "contact_us",
393      url: window.location.href,
394      source_url: getUpdatedSourceUrl(),
395      email: $("#contact_email").val().trim(),
396      is_blog_lead: JSON.parse(localStorage.getItem("visited_blog")) || false,
397      phone: $("#contact_phone").val().trim() || "0",
398      desc: $("#contact_message").val().trim(),
399      query_url: "/contact-us",
400      form_type: "Contact-us",
401      source_lead_event: "contact_us",
402    });
403
404    fetch(`${base_url_for_contact}/api/leads`, {
405      method: "post",
406      body,
407    })
408      .then((res) => {
409        if (res.ok && res.status === 200) {
410          return res.json();
411        } else {
412          throw new Error("Something went wrong");
413        }
414      })
415      .then((res) => {
416        const sourceLeadEvent = window.location.href.includes(
417          "/custom-research",
418        )
419          ? "custom-research"
420          : "contact-us";
421        handleFormSubmitEvent(sourceLeadEvent || null, res?.lead_id || null);
422        document.querySelector("#submit_btn_loader").style.display = "none";
423        showThankYou(JSON.parse(body).email);
424        // $('#successModal').modal('show');
425        document.querySelector(".success_content").innerText =
426          "Thank you for getting in touch. We will get back to you shortly.";
427        document.querySelector(".contact-email-error").style.display = "none";
428        document.getElementById("talk-to-analyst-contact-us").disabled = false;
429        document.querySelector(".contact-email-error").innerText = "";
430        const countryCodeLabel = document.querySelector(
431          ".contact-us-country-code-label",
432        );
433        let countryCodeLabelValue;
434        if (countryCodeLabel) {
435          countryCodeLabelValue = countryCodeLabel.value;
436        }
437        document.querySelector(".contact-form").reset();
438        if (countryCodeLabel && countryCodeLabelValue) {
439          countryCodeLabel.value = countryCodeLabelValue;
440        }
441        let wisepop = document.getElementById("wisepops-root");
442        if (wisepop) {
443          wisepop.style.display = "none";
444        }
445      })
446      .catch((error) => {
447        pushLeadFailureToDataLayer();
448        console.log("Error in Leads API...", error);
449        document.querySelector("#submit_btn_loader").style.display = "none";
450        document.getElementById("talk-to-analyst-contact-us").disabled = false;
451        $("#failureModal").modal("show");
452        document.querySelector(".failure_content").innerText =
453          "Something went wrong. Please try again later or refresh.";
454      });
455  }
456});
457
458function getUpdatedSourceUrl() {
459  function getCookie(name) {
460    const match = document.cookie.match(
461      new RegExp("(^| )" + name + "=([^;]+)"),
462    );
463    return match ? decodeURIComponent(match[2]) : null;
464  }
465
466  const utmQueryString = getCookie("utm_query_string");
467  if (!utmQueryString) return window.location.href;
468
469  // Merge, never concatenate: the page may already carry a query string (?page=2,
470  // ?session_id=... on the checkout return), and `href + "?" + utms` would produce a URL with
471  // two question marks. Params already on the page win — they are the more specific context.
472  try {
473    const url = new URL(window.location.href);
474    new URLSearchParams(utmQueryString).forEach((value, key) => {
475      if (!url.searchParams.has(key)) url.searchParams.set(key, value);
476    });
477    return url.toString();
478  } catch (error) {
479    return window.location.href;
480  }
481}

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.