auto-webmcp 0.3.19 → 0.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1820,6 +1820,18 @@ function serializeFormData(form, params, fieldEls) {
1820
1820
  }
1821
1821
  return result;
1822
1822
  }
1823
+ function maybeConvertIsoDate(value, el) {
1824
+ const isoMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1825
+ if (!isoMatch)
1826
+ return value;
1827
+ if (el instanceof HTMLInputElement && el.type === "date")
1828
+ return value;
1829
+ const fieldHint = (el.name ?? el.id ?? "").toLowerCase();
1830
+ if (!/date/.test(fieldHint))
1831
+ return value;
1832
+ const [, year, month, day] = isoMatch;
1833
+ return `${month}/${day}/${year}`;
1834
+ }
1823
1835
  function fillElement(el, value) {
1824
1836
  if (el instanceof HTMLInputElement) {
1825
1837
  const type = el.type.toLowerCase();
@@ -1834,7 +1846,7 @@ function fillElement(el, value) {
1834
1846
  el.dispatchEvent(new Event("change", { bubbles: true }));
1835
1847
  }
1836
1848
  } else {
1837
- setReactValue(el, String(value ?? ""));
1849
+ setReactValue(el, maybeConvertIsoDate(String(value ?? ""), el));
1838
1850
  }
1839
1851
  } else if (el instanceof HTMLTextAreaElement) {
1840
1852
  setReactValue(el, String(value ?? ""));
@@ -1893,7 +1905,7 @@ async function fillComboboxButton(el, value) {
1893
1905
  console.log("[auto-webmcp] fillComboboxButton: clicking button, value=", JSON.stringify(text));
1894
1906
  el.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
1895
1907
  const listbox = await new Promise((resolve) => {
1896
- const deadline = Date.now() + 1e3;
1908
+ const deadline = Date.now() + 3e3;
1897
1909
  const poll = () => {
1898
1910
  const candidate = document.querySelector('[role="listbox"]') ?? document.querySelector('[role="option"]')?.closest('[role="listbox"]') ?? null;
1899
1911
  if (candidate) {