@ait-co/console-cli 0.1.30 → 0.1.31

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.
package/dist/cli.mjs CHANGED
@@ -7706,6 +7706,29 @@ const FILL_AND_SUBMIT_FN = `
7706
7706
  }
7707
7707
  return null;
7708
7708
  }
7709
+ function pickByAccessibleLabel(textInputOnly, patterns) {
7710
+ const inputs = Array.from(document.querySelectorAll('input'));
7711
+ return inputs.find(i => {
7712
+ const type = (i.type || '').toLowerCase();
7713
+ if (textInputOnly && type !== 'text' && type !== 'email') return false;
7714
+ if (!textInputOnly && type !== 'password') return false;
7715
+ const label = (i.getAttribute('aria-label') || '') + ' ' + (i.placeholder || '');
7716
+ return patterns.some(p => p.test(label));
7717
+ }) || null;
7718
+ }
7719
+ function pickEmailFromPasswordForm(passwordInput) {
7720
+ const form = passwordInput && passwordInput.closest('form');
7721
+ if (!form) return null;
7722
+ const inputs = Array.from(form.querySelectorAll('input'));
7723
+ const passwordIdx = inputs.indexOf(passwordInput);
7724
+ if (passwordIdx < 0) return null;
7725
+ for (let i = 0; i < passwordIdx; i++) {
7726
+ const el = inputs[i];
7727
+ const type = (el.type || '').toLowerCase();
7728
+ if (type === 'text' || type === 'email') return el;
7729
+ }
7730
+ return null;
7731
+ }
7709
7732
  function setNative(input, value) {
7710
7733
  const proto = Object.getPrototypeOf(input);
7711
7734
  const desc = Object.getOwnPropertyDescriptor(proto, 'value');
@@ -7714,12 +7737,15 @@ const FILL_AND_SUBMIT_FN = `
7714
7737
  input.dispatchEvent(new Event('input', { bubbles: true }));
7715
7738
  input.dispatchEvent(new Event('change', { bubbles: true }));
7716
7739
  }
7717
- const emailInput =
7718
- pickByName(['email', 'loginId', 'username']) ||
7719
- pickInputByType(['email']);
7720
7740
  const passwordInput =
7721
7741
  pickByName(['password', 'loginPassword']) ||
7722
- pickInputByType(['password']);
7742
+ pickInputByType(['password']) ||
7743
+ pickByAccessibleLabel(false, [/비밀번호/, /password/i]);
7744
+ const emailInput =
7745
+ pickByName(['email', 'loginId', 'username']) ||
7746
+ pickInputByType(['email']) ||
7747
+ pickByAccessibleLabel(true, [/이메일/, /\\bID\\b/, /email/i, /로그인.{0,5}(아이디|ID)/i]) ||
7748
+ pickEmailFromPasswordForm(passwordInput);
7723
7749
  if (!emailInput) return { ok: false, stage: 'find-email' };
7724
7750
  if (!passwordInput) return { ok: false, stage: 'find-password' };
7725
7751
  setNative(emailInput, email);
@@ -7753,9 +7779,13 @@ const FORM_READY_PROBE_FN = `
7753
7779
  const type = (i.type || '').toLowerCase();
7754
7780
  const placeholder = (i.placeholder || '').toLowerCase();
7755
7781
  const id = (i.id || '').toLowerCase();
7782
+ const aria = (i.getAttribute('aria-label') || '').toLowerCase();
7756
7783
  if (name === 'email' || name === 'loginid' || name === 'username') return true;
7757
7784
  if (type === 'email') return true;
7758
- if (type === 'text' && /id|email|username/.test(name + ' ' + id + ' ' + placeholder)) return true;
7785
+ if (type === 'text') {
7786
+ const blob = name + ' ' + id + ' ' + placeholder + ' ' + aria;
7787
+ if (/id|email|username|이메일|아이디/.test(blob)) return true;
7788
+ }
7759
7789
  return false;
7760
7790
  });
7761
7791
  const hasPassword = inputs.some(i =>
@@ -9199,7 +9229,7 @@ function resolveVersion() {
9199
9229
  if (typeof injected === "string" && injected.length > 0) return injected;
9200
9230
  } catch {}
9201
9231
  try {
9202
- return "0.1.30";
9232
+ return "0.1.31";
9203
9233
  } catch {}
9204
9234
  return "0.0.0-dev";
9205
9235
  }