@protontech/autofill 0.0.22991789 → 0.0.33690782
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/constants/features.d.ts +1 -0
- package/constants/features.js +1 -0
- package/constants/heuristics.d.ts +5 -4
- package/constants/heuristics.js +5 -10
- package/constants/selectors.d.ts +13 -7
- package/constants/selectors.js +29 -17
- package/debug.d.ts +24 -1
- package/debug.js +15 -13
- package/dictionary/generate.js +30 -21
- package/dictionary/generated/dictionary.d.ts +18 -4
- package/dictionary/generated/dictionary.js +31 -17
- package/dictionary/source/dictionary.d.ts +4 -3
- package/dictionary/source/dictionary.js +155 -89
- package/dictionary/source/patterns.js +2 -2
- package/features/feature.d.ts +17 -0
- package/features/feature.js +72 -0
- package/features/feature.spec.d.ts +1 -0
- package/features/feature.spec.js +55 -0
- package/features/v1/abstract.field.d.ts +20401 -0
- package/features/v1/abstract.field.js +95 -0
- package/features/v1/abstract.form.d.ts +1226 -0
- package/features/v1/abstract.form.js +336 -0
- package/features/v1/field.email.d.ts +62 -0
- package/features/v1/field.email.js +27 -0
- package/features/v1/field.otp.d.ts +142 -0
- package/features/v1/field.otp.js +105 -0
- package/features/v1/field.password.d.ts +162 -0
- package/features/v1/field.password.js +81 -0
- package/features/v1/field.username-hidden.d.ts +62 -0
- package/features/v1/field.username-hidden.js +25 -0
- package/features/v1/field.username.d.ts +72 -0
- package/features/v1/field.username.js +31 -0
- package/features/v1/index.d.ts +4427 -0
- package/features/v1/index.js +22 -0
- package/features/v1/index.spec.d.ts +1 -0
- package/features/v1/index.spec.js +30 -0
- package/index.d.ts +5 -2
- package/index.js +10 -3
- package/models/perceptron/index.d.ts +2 -0
- package/models/perceptron/index.js +27 -0
- package/models/perceptron/params/email-model.json +53 -0
- package/models/perceptron/params/login-model.json +465 -0
- package/models/perceptron/params/new-password-model.json +133 -0
- package/models/perceptron/params/otp-model.json +117 -0
- package/models/perceptron/params/password-change-model.json +465 -0
- package/models/perceptron/params/password-model.json +133 -0
- package/models/perceptron/params/recovery-model.json +465 -0
- package/models/perceptron/params/register-model.json +465 -0
- package/models/perceptron/params/username-hidden-model.json +53 -0
- package/models/perceptron/params/username-model.json +61 -0
- package/models/prod_20240829/index.d.ts +2 -0
- package/models/prod_20240829/index.js +27 -0
- package/models/prod_20240829/params/email-model.json +45 -0
- package/models/prod_20240829/params/login-model.json +421 -0
- package/models/prod_20240829/params/new-password-model.json +125 -0
- package/models/prod_20240829/params/otp-model.json +153 -0
- package/models/prod_20240829/params/password-change-model.json +421 -0
- package/models/prod_20240829/params/password-model.json +125 -0
- package/models/prod_20240829/params/recovery-model.json +421 -0
- package/models/prod_20240829/params/register-model.json +421 -0
- package/models/prod_20240829/params/username-hidden-model.json +41 -0
- package/models/prod_20240829/params/username-model.json +45 -0
- package/models/random_forest/index.d.ts +2 -0
- package/models/random_forest/index.js +27 -0
- package/models/random_forest/params/email-model.json +1456 -0
- package/models/random_forest/params/login-model.json +4194 -0
- package/models/random_forest/params/new-password-model.json +1448 -0
- package/models/random_forest/params/otp-model.json +2004 -0
- package/models/random_forest/params/password-change-model.json +1422 -0
- package/models/random_forest/params/password-model.json +1292 -0
- package/models/random_forest/params/recovery-model.json +2754 -0
- package/models/random_forest/params/register-model.json +3678 -0
- package/models/random_forest/params/username-hidden-model.json +1108 -0
- package/models/random_forest/params/username-model.json +1052 -0
- package/models/v1/index.d.ts +2 -0
- package/models/v1/index.js +35 -0
- package/package.json +14 -15
- package/rules/v1/index.d.ts +3 -0
- package/rules/v1/index.js +69 -0
- package/rulesets.d.ts +2 -2
- package/rulesets.js +11 -10
- package/types/index.d.ts +72 -17
- package/types/index.js +35 -2
- package/utils/attributes.js +1 -1
- package/utils/clustering.js +18 -5
- package/utils/credit-card.d.ts +32 -0
- package/utils/credit-card.js +259 -0
- package/utils/credit-card.samples.spec.d.ts +1 -0
- package/utils/credit-card.samples.spec.js +452 -0
- package/utils/credit-card.spec.d.ts +1 -0
- package/utils/credit-card.spec.js +296 -0
- package/utils/dom.d.ts +3 -2
- package/utils/dom.js +12 -7
- package/utils/exclusion.d.ts +1 -0
- package/utils/exclusion.js +22 -10
- package/utils/extract.d.ts +1 -0
- package/utils/extract.js +26 -7
- package/utils/fathom.d.ts +10 -23
- package/utils/fathom.js +7 -12
- package/utils/field.d.ts +12 -4
- package/utils/field.js +25 -14
- package/utils/flags.d.ts +9 -3
- package/utils/flags.js +27 -9
- package/utils/form.d.ts +16 -5
- package/utils/form.js +35 -14
- package/utils/identity.d.ts +12 -21
- package/utils/identity.js +66 -41
- package/utils/identity.samples.spec.d.ts +1 -0
- package/utils/identity.samples.spec.js +28 -0
- package/utils/iframe.d.ts +2 -0
- package/utils/iframe.js +22 -0
- package/utils/overrides.d.ts +19 -0
- package/utils/overrides.js +40 -0
- package/utils/prepass.js +6 -4
- package/utils/re.d.ts +19 -4
- package/utils/re.js +22 -7
- package/utils/re.spec.d.ts +1 -0
- package/utils/re.spec.js +62 -0
- package/utils/shadow-dom.d.ts +8 -0
- package/utils/shadow-dom.js +53 -0
- package/utils/shadow-dom.spec.d.ts +1 -0
- package/utils/shadow-dom.spec.js +215 -0
- package/utils/visible.d.ts +3 -2
- package/utils/visible.js +42 -22
- package/cli.d.ts +0 -2
- package/cli.js +0 -128
- package/features/abstract.field.d.ts +0 -123
- package/features/abstract.field.js +0 -63
- package/features/abstract.form.d.ts +0 -98
- package/features/abstract.form.js +0 -281
- package/features/field.email.d.ts +0 -18
- package/features/field.email.js +0 -43
- package/features/field.otp.d.ts +0 -36
- package/features/field.otp.js +0 -116
- package/features/field.password.d.ts +0 -35
- package/features/field.password.js +0 -104
- package/features/field.username-hidden.d.ts +0 -15
- package/features/field.username-hidden.js +0 -40
- package/features/field.username.d.ts +0 -16
- package/features/field.username.js +0 -41
- package/features/form.combined.d.ts +0 -1
- package/features/form.combined.js +0 -6
- package/trainees/field.email.d.ts +0 -2
- package/trainees/field.email.js +0 -16
- package/trainees/field.identity.d.ts +0 -2
- package/trainees/field.identity.js +0 -9
- package/trainees/field.otp.d.ts +0 -2
- package/trainees/field.otp.js +0 -16
- package/trainees/field.password.current.d.ts +0 -2
- package/trainees/field.password.current.js +0 -16
- package/trainees/field.password.new.d.ts +0 -2
- package/trainees/field.password.new.js +0 -16
- package/trainees/field.username-hidden.d.ts +0 -2
- package/trainees/field.username-hidden.js +0 -22
- package/trainees/field.username.d.ts +0 -2
- package/trainees/field.username.js +0 -16
- package/trainees/form.login.d.ts +0 -2
- package/trainees/form.login.js +0 -16
- package/trainees/form.noop.d.ts +0 -1
- package/trainees/form.noop.js +0 -7
- package/trainees/form.password-change.d.ts +0 -2
- package/trainees/form.password-change.js +0 -16
- package/trainees/form.recovery.d.ts +0 -2
- package/trainees/form.recovery.js +0 -16
- package/trainees/form.register.d.ts +0 -2
- package/trainees/form.register.js +0 -16
- package/trainees/index.d.ts +0 -9
- package/trainees/index.js +0 -72
- package/trainees/results/result.email.d.ts +0 -2
- package/trainees/results/result.email.js +0 -17
- package/trainees/results/result.login.d.ts +0 -2
- package/trainees/results/result.login.js +0 -110
- package/trainees/results/result.new-password.d.ts +0 -2
- package/trainees/results/result.new-password.js +0 -36
- package/trainees/results/result.otp.d.ts +0 -2
- package/trainees/results/result.otp.js +0 -43
- package/trainees/results/result.password-change.d.ts +0 -2
- package/trainees/results/result.password-change.js +0 -110
- package/trainees/results/result.password.d.ts +0 -2
- package/trainees/results/result.password.js +0 -36
- package/trainees/results/result.recovery.d.ts +0 -2
- package/trainees/results/result.recovery.js +0 -110
- package/trainees/results/result.register.d.ts +0 -2
- package/trainees/results/result.register.js +0 -110
- package/trainees/results/result.username-hidden.d.ts +0 -2
- package/trainees/results/result.username-hidden.js +0 -15
- package/trainees/results/result.username.d.ts +0 -2
- package/trainees/results/result.username.js +0 -16
- package/utils/memoize.d.ts +0 -5
- package/utils/memoize.js +0 -12
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { kAnchorLinkSelector, kButtonSelector, kCaptchaSelector, kFieldSelector, kLayoutSelector, kPasswordSelector, kSocialSelector } from "@protontech/autofill/constants/selectors";
|
|
2
|
+
import { feature, featureCount, featureScaled, featuresProduct, flattenFeatures, getComputerForFeatures } from "@protontech/autofill/features/feature";
|
|
3
|
+
import { getFormAttributes } from "@protontech/autofill/utils/attributes";
|
|
4
|
+
import { any } from "@protontech/autofill/utils/combinators";
|
|
5
|
+
import { getCCFieldType } from "@protontech/autofill/utils/credit-card";
|
|
6
|
+
import { uniqueNodes } from "@protontech/autofill/utils/dom";
|
|
7
|
+
import { getAllFieldHaystacks, getAllNodeHaystacks, getFormText, getNearestHeadingsText, getNodeAttributes, getPageDescriptionText } from "@protontech/autofill/utils/extract";
|
|
8
|
+
import { safeInt } from "@protontech/autofill/utils/fathom";
|
|
9
|
+
import { isBtnCandidate, isEmailCandidate, isInputField, isMFACandidate, isOAuthCandidate, isSelect, isTextarea, isUsernameCandidate, splitFieldsByVisibility } from "@protontech/autofill/utils/field";
|
|
10
|
+
import { createInputIterator, getFormComplexity, getFormParent } from "@protontech/autofill/utils/form";
|
|
11
|
+
import { getIdentityFieldType } from "@protontech/autofill/utils/identity";
|
|
12
|
+
import { matchAuthenticator, matchLogin, matchMFA, matchMultiStep, matchNewsletter, matchOtpOutlier, matchOtpOutlierAction, matchPasswordConfirmAttr, matchPasswordCreateAttr, matchPasswordReset, matchPasswordResetAttr, matchRecovery, matchRegister, matchRememberMe, matchSearchAction, matchStepAction, matchTOS, matchTrouble, } from "@protontech/autofill/utils/re";
|
|
13
|
+
import { sanitizeString } from "@protontech/autofill/utils/text";
|
|
14
|
+
import { isVisibleEl, isVisibleField } from "@protontech/autofill/utils/visible";
|
|
15
|
+
const form = feature("form", {}, (_, fnode) => fnode.element);
|
|
16
|
+
const parent = feature("parent", { form }, (p) => getFormParent(p.form));
|
|
17
|
+
const doc = feature("doc", { form }, (p) => p.form.ownerDocument);
|
|
18
|
+
const __inputIterator = feature("__inputIterator", {}, (_, fnode) => createInputIterator(fnode.element));
|
|
19
|
+
const fields = feature("fields", { form }, (p) => Array.from(p.form.querySelectorAll(kFieldSelector)));
|
|
20
|
+
const visibleFields = feature("visibleFields", { fields }, (p) => p.fields.filter(isVisibleField));
|
|
21
|
+
const inputs = feature("inputs", { fields }, (p) => p.fields.filter(isInputField));
|
|
22
|
+
const hidden = feature("hidden", { inputs }, (p) => p.inputs.filter((el) => el.type === "hidden"));
|
|
23
|
+
const visibleInputs = feature("visibleInputs", { visibleFields }, (p) => p.visibleFields.filter(isInputField));
|
|
24
|
+
const fieldsets = feature("fieldsets", { form }, (p) => Array.from(p.form.querySelectorAll("fieldset")));
|
|
25
|
+
const textareas = feature("textareas", { fields }, (p) => p.fields.filter(isTextarea));
|
|
26
|
+
const selects = feature("selects", { fields }, (p) => p.fields.filter((el, i, arr) => { var _a; return isSelect(el) && ((_a = arr === null || arr === void 0 ? void 0 : arr[i + 1]) === null || _a === void 0 ? void 0 : _a.type) !== "tel"; }));
|
|
27
|
+
const texts = feature("texts", { inputs }, (p) => p.inputs.filter((el) => el.type === "text"));
|
|
28
|
+
const tels = feature("tels", { inputs }, (p) => p.inputs.filter((el) => el.type === "tel"));
|
|
29
|
+
const readOnly = feature("readOnly", { inputs }, (p) => p.inputs.filter((el) => el.readOnly));
|
|
30
|
+
const radios = feature("radios", { inputs }, (p) => p.inputs.filter((el) => el.type === "radio"));
|
|
31
|
+
const checkboxes = feature("checkboxes", { inputs }, (p) => p.inputs.filter((el) => el.type === "checkbox"));
|
|
32
|
+
const numbers = feature("numbers", { inputs }, (p) => p.inputs.filter((el) => el.type === "number"));
|
|
33
|
+
const dates = feature("dates", { inputs }, (p) => p.inputs.filter((el) => el.type === "date"));
|
|
34
|
+
const files = feature("files", { inputs }, (p) => p.inputs.filter((el) => el.type === "file"));
|
|
35
|
+
const ccInputs = feature("ccInputs", { inputs }, (p) => p.inputs.filter(getCCFieldType));
|
|
36
|
+
const ccSelects = feature("ccSelects", { selects }, (p) => p.selects.filter(getCCFieldType));
|
|
37
|
+
const ccs = feature("ccs", { ccInputs, ccSelects }, (p) => p.ccInputs.concat(p.ccSelects));
|
|
38
|
+
const identities = feature("identities", { inputs, ccs }, (p) => p.inputs.filter((el) => getIdentityFieldType(el) !== undefined));
|
|
39
|
+
const required = feature("required", { visibleInputs }, (p) => p.visibleInputs.filter((el) => el.required || el.ariaRequired));
|
|
40
|
+
const disabled = feature("disabled", { visibleInputs }, (p) => p.visibleInputs.filter((el) => el.disabled || el.ariaDisabled));
|
|
41
|
+
const autofocused = feature("autofocused", { visibleInputs }, (p) => p.visibleInputs.find((el) => el.matches("input[autofocus]:first-of-type")));
|
|
42
|
+
const usernames = feature("usernames", { inputs }, (p) => p.inputs.filter(isUsernameCandidate));
|
|
43
|
+
const emails = feature("emails", { inputs }, (p) => p.inputs.filter(isEmailCandidate));
|
|
44
|
+
const identifiers = feature("identifiers", { usernames, emails }, (p) => uniqueNodes(p.usernames, p.emails));
|
|
45
|
+
const identifiersByVisibility = feature("identifiersByVisibility", { identifiers }, (p) => splitFieldsByVisibility(p.identifiers));
|
|
46
|
+
const visibleIdentifiers = feature("visibleIdentifiers", { identifiersByVisibility }, (p) => p.identifiersByVisibility[0]);
|
|
47
|
+
const hiddenIdentifiers = feature("hiddenIdentifiers", { identifiersByVisibility }, (p) => p.identifiersByVisibility[1]);
|
|
48
|
+
const passwords = feature("passwords", { inputs }, (p) => p.inputs.filter((el) => el.matches(kPasswordSelector)));
|
|
49
|
+
const passwordsByVisibility = feature("passwordsByVisibility", { passwords }, (p) => splitFieldsByVisibility(p.passwords));
|
|
50
|
+
const visiblePasswords = feature("visiblePasswords", { passwordsByVisibility }, (p) => p.passwordsByVisibility[0]);
|
|
51
|
+
const hiddenPasswords = feature("hiddenPasswords", { passwordsByVisibility }, (p) => p.passwordsByVisibility[1]);
|
|
52
|
+
const mfaInputs = feature("mfaInputs", { inputs }, (p) => p.inputs.filter(isMFACandidate));
|
|
53
|
+
const captchas = feature("captchas", { parent }, (p) => Array.from(p.parent.querySelectorAll(kCaptchaSelector)));
|
|
54
|
+
const socials = feature("socials", { parent }, (p) => Array.from(p.parent.querySelectorAll(kSocialSelector)));
|
|
55
|
+
const submits = feature("submits", { visibleFields }, (p) => p.visibleFields.filter((el) => (el === null || el === void 0 ? void 0 : el.type) === "submit"));
|
|
56
|
+
const btns = feature("btns", { form }, (p) => Array.from(p.form.querySelectorAll(kButtonSelector)).filter(isVisibleEl));
|
|
57
|
+
const btnsTypeSubmit = feature("btnsTypeSubmit", { btns }, (p) => p.btns.filter((el) => el.matches('[type="submit"]')));
|
|
58
|
+
const candidateBtns = feature("candidateBtns", { btns }, (p) => p.btns.filter(isBtnCandidate));
|
|
59
|
+
const submitBtns = feature("submitBtns", { btns, btnsTypeSubmit, candidateBtns }, (p) => (p.btnsTypeSubmit.length > 0 ? p.btnsTypeSubmit : p.candidateBtns));
|
|
60
|
+
const anchors = feature("anchors", { form }, (p) => Array.from(p.form.querySelectorAll(kAnchorLinkSelector)).filter(isVisibleEl));
|
|
61
|
+
const oauths = feature("oauths", { socials, candidateBtns }, (p) => p.socials.concat(p.candidateBtns).filter(isOAuthCandidate));
|
|
62
|
+
const layouts = feature("layouts", { form }, (p) => Array.from(p.form.querySelectorAll(kLayoutSelector)));
|
|
63
|
+
const autofocusedIsIdentifier = feature("autofocusedIsIdentifier", { autofocused, visibleIdentifiers }, (p) => Boolean(p.autofocused && p.visibleIdentifiers.includes(p.autofocused)));
|
|
64
|
+
const autofocusedIsPassword = feature("autofocusedIsPassword", { autofocused, visiblePasswords }, (p) => Boolean(p.autofocused && p.visiblePasswords.includes(p.autofocused)));
|
|
65
|
+
const pageDescriptionText = feature("pageDescriptionText", { doc }, (p) => getPageDescriptionText(p.doc));
|
|
66
|
+
const nearestHeadingsText = feature("nearestHeadingsText", { form }, (p) => getNearestHeadingsText(p.form));
|
|
67
|
+
const formTextAttrText = feature("formTextAttrText", { form }, (p) => getFormText(p.form));
|
|
68
|
+
const formAttributes = feature("formAttributes", { form }, (p) => getFormAttributes(p.form));
|
|
69
|
+
const pwHaystack = feature("pwHaystack", { passwords }, (p) => p.passwords.flatMap(getAllFieldHaystacks));
|
|
70
|
+
const identifierHaystack = feature("identifierHaystack", { visibleIdentifiers }, (p) => p.visibleIdentifiers.flatMap(getAllFieldHaystacks));
|
|
71
|
+
const btnHaystack = feature("btnHaystack", { candidateBtns }, (p) => p.candidateBtns.flatMap(getAllFieldHaystacks));
|
|
72
|
+
const submitBtnHaystack = feature("submitBtnHaystack", { submitBtns }, (p) => p.submitBtns.flatMap(getAllFieldHaystacks));
|
|
73
|
+
const checkboxesHaystack = feature("checkboxesHaystack", { checkboxes }, (p) => p.checkboxes.flatMap(getAllFieldHaystacks));
|
|
74
|
+
const anchorsHaystack = feature("anchorsHaystack", { anchors }, (p) => p.anchors.flatMap(getAllNodeHaystacks));
|
|
75
|
+
const mfaInputsHaystack = feature("mfaInputsHaystack", { mfaInputs }, (p) => p.mfaInputs.flatMap(getAllFieldHaystacks));
|
|
76
|
+
const layoutHaystack = feature("layoutHaystack", { layouts }, (p) => p.layouts.map(getNodeAttributes));
|
|
77
|
+
const formTextHaystack = feature("formTextHaystack", { formTextAttrText, nearestHeadingsText }, (p) => [p.formTextAttrText, p.nearestHeadingsText]);
|
|
78
|
+
const pageLogin = feature("pageLogin", { pageDescriptionText }, (p) => matchLogin(p.pageDescriptionText));
|
|
79
|
+
const formTextLogin = feature("formTextLogin", { formTextAttrText }, (p) => matchLogin(p.formTextAttrText));
|
|
80
|
+
const formAttrsLogin = feature("formAttrsLogin", { formAttributes }, (p) => any(matchLogin)(p.formAttributes));
|
|
81
|
+
const headingsLogin = feature("headingsLogin", { nearestHeadingsText }, (p) => matchLogin(p.nearestHeadingsText));
|
|
82
|
+
const layoutLogin = feature("layoutLogin", { layoutHaystack }, (p) => any(matchLogin)(p.layoutHaystack));
|
|
83
|
+
const rememberMeCheckbox = feature("rememberMeCheckbox", { checkboxesHaystack }, (p) => any(matchRememberMe)(p.checkboxesHaystack));
|
|
84
|
+
const submitLogin = feature("submitLogin", { submitBtnHaystack }, (p) => any(matchLogin)(p.submitBtnHaystack));
|
|
85
|
+
const troubleLink = feature("troubleLink", { anchorsHaystack }, (p) => any(matchTrouble)(p.anchorsHaystack));
|
|
86
|
+
const pageRegister = feature("pageRegister", { pageDescriptionText }, (p) => matchRegister(p.pageDescriptionText));
|
|
87
|
+
const formTextRegister = feature("formTextRegister", { formTextAttrText }, (p) => matchRegister(p.formTextAttrText));
|
|
88
|
+
const formAttrsRegister = feature("formAttrsRegister", { formAttributes }, (p) => any(matchRegister)(p.formAttributes));
|
|
89
|
+
const headingsRegister = feature("headingsRegister", { nearestHeadingsText }, (p) => matchRegister(p.nearestHeadingsText));
|
|
90
|
+
const layoutRegister = feature("layoutRegister", { layoutHaystack }, (p) => any(matchRegister)(p.layoutHaystack));
|
|
91
|
+
const TOSRef = feature("TOSRef", { checkboxesHaystack, anchorsHaystack }, (p) => any(matchTOS)(p.checkboxesHaystack.concat(p.anchorsHaystack)));
|
|
92
|
+
const submitRegister = feature("submitRegister", { submitBtnHaystack }, (p) => any(matchRegister)(p.submitBtnHaystack));
|
|
93
|
+
const pwNewRegister = feature("pwNewRegister", { pwHaystack }, (p) => any(matchPasswordCreateAttr)(p.pwHaystack));
|
|
94
|
+
const pwConfirmRegister = feature("pwConfirmRegister", { pwHaystack }, (p) => any(matchPasswordConfirmAttr)(p.pwHaystack));
|
|
95
|
+
const buttonMultistep = feature("buttonMultistep", { submitBtnHaystack }, (p) => any(matchStepAction)(p.submitBtnHaystack));
|
|
96
|
+
const headingsMultistep = feature("headingsMultistep", { nearestHeadingsText }, (p) => matchMultiStep(p.nearestHeadingsText));
|
|
97
|
+
const multistepForm = feature("multistepForm", { buttonMultistep, headingsMultistep }, (p) => p.buttonMultistep || p.headingsMultistep);
|
|
98
|
+
const pageMultiAuth = feature("pageMultiAuth", { pageLogin, pageRegister }, (p) => p.pageLogin && p.pageRegister);
|
|
99
|
+
const submitMultiAuth = feature("submitMultiAuth", { submitRegister, submitLogin, buttonMultistep }, (p) => p.submitRegister && (p.submitLogin || p.buttonMultistep));
|
|
100
|
+
const headingsMultiAuth = feature("headingsMultiAuth", { headingsLogin, headingsRegister }, (p) => p.headingsLogin && p.headingsRegister);
|
|
101
|
+
const multiAuthForm = feature("multiAuthForm", { pageMultiAuth, headingsMultiAuth, submitMultiAuth }, (p) => p.pageMultiAuth || p.headingsMultiAuth || p.submitMultiAuth);
|
|
102
|
+
const pagePwReset = feature("pagePwReset", { pageDescriptionText }, (p) => matchPasswordReset(p.pageDescriptionText));
|
|
103
|
+
const formTextPwReset = feature("formTextPwReset", { formTextAttrText }, (p) => matchPasswordReset(p.formTextAttrText));
|
|
104
|
+
const formAttrsPwReset = feature("formAttrsPwReset", { formAttributes }, (p) => any(matchPasswordResetAttr)(p.formAttributes));
|
|
105
|
+
const headingsPwReset = feature("headingsPwReset", { nearestHeadingsText }, (p) => matchPasswordReset(p.nearestHeadingsText));
|
|
106
|
+
const layoutPwReset = feature("layoutPwReset", { layoutHaystack }, (p) => any(matchPasswordResetAttr)(p.layoutHaystack));
|
|
107
|
+
const pageRecovery = feature("pageRecovery", { pageDescriptionText }, (p) => matchRecovery(p.pageDescriptionText));
|
|
108
|
+
const formTextRecovery = feature("formTextRecovery", { formTextAttrText }, (p) => matchRecovery(p.formTextAttrText));
|
|
109
|
+
const formAttrsRecovery = feature("formAttrsRecovery", { formAttributes }, (p) => any(matchRecovery)(p.formAttributes));
|
|
110
|
+
const headingsRecovery = feature("headingsRecovery", { nearestHeadingsText }, (p) => matchRecovery(p.nearestHeadingsText));
|
|
111
|
+
const layoutRecovery = feature("layoutRecovery", { layoutHaystack }, (p) => any(matchRecovery)(p.layoutHaystack));
|
|
112
|
+
const submitRecovery = feature("submitRecovery", { submitBtnHaystack }, (p) => any(matchRecovery)(p.submitBtnHaystack));
|
|
113
|
+
const identifierRecovery = feature("identifierRecovery", { identifierHaystack }, (p) => any(matchRecovery)(p.identifierHaystack));
|
|
114
|
+
const inputsMFA = feature("inputsMFA", { mfaInputs, mfaInputsHaystack }, (p) => p.mfaInputs.some(({ autocomplete }) => autocomplete.includes("one-time-code")) || any(matchMFA)(p.mfaInputsHaystack));
|
|
115
|
+
const formAttrsMFA = feature("formAttrsMFA", { formAttributes }, (p) => any(matchMFA)(p.formAttributes));
|
|
116
|
+
const formTextMFA = feature("formTextMFA", { formTextHaystack }, (p) => any(matchMFA)(p.formTextHaystack));
|
|
117
|
+
const maybeMFA = feature("maybeMFA", { formTextMFA, formAttrsMFA, inputsMFA }, (p) => p.inputsMFA || p.formAttrsMFA || p.formTextMFA);
|
|
118
|
+
const haystackMFA = feature("haystackMFA", { formTextHaystack, maybeMFA, form }, (p) => [...p.formTextHaystack, maybeMFA ? sanitizeString(p.form.innerText) : ""]);
|
|
119
|
+
const __formTextAuthenticator = feature("__formTextAuthenticator", { haystackMFA }, (p) => any(matchAuthenticator)(p.haystackMFA));
|
|
120
|
+
const __headingsOTPOutlier = feature("__headingsOTPOutlier", { nearestHeadingsText }, (p) => matchOtpOutlier(p.nearestHeadingsText));
|
|
121
|
+
const __formOTPOutlier = feature("__formOTPOutlier", { formAttributes }, (p) => any(matchOtpOutlier)(p.formAttributes));
|
|
122
|
+
const __linkOTPOutlier = feature("__linkOTPOutlier", { anchorsHaystack, btnHaystack }, (p) => any(matchOtpOutlierAction)(p.anchorsHaystack.concat(p.btnHaystack)));
|
|
123
|
+
const __formMFA = feature("__formMFA", { formTextMFA, formAttrsMFA }, (p) => p.formAttrsMFA || p.formAttrsMFA);
|
|
124
|
+
const __formInputMFACandidates = feature("__formInputMFACandidates", { visibleInputs }, (p) => p.visibleInputs.filter(isMFACandidate).length);
|
|
125
|
+
const newsletterForm = feature("newsletterForm", { formTextHaystack }, (p) => any(matchNewsletter)(p.formTextHaystack));
|
|
126
|
+
const searchForm = feature("searchForm", { formTextHaystack }, (p) => any(matchSearchAction)(p.formTextHaystack));
|
|
127
|
+
const formComplexity = featureScaled(feature("formComplexity", { form, fields, visibleFields, hidden, anchors, candidateBtns }, (p) => getFormComplexity(p.form, {
|
|
128
|
+
fields: p.fields,
|
|
129
|
+
visibleFields: p.visibleFields.length,
|
|
130
|
+
hiddenFields: p.hidden.length,
|
|
131
|
+
nonVisibleFields: p.fields.length - p.visibleFields.length - p.hidden.length,
|
|
132
|
+
anchors: p.anchors.length,
|
|
133
|
+
buttons: p.candidateBtns.length,
|
|
134
|
+
})), 0, 50);
|
|
135
|
+
const visibleFieldsCount = featureScaled(featureCount(visibleFields), 1, 5);
|
|
136
|
+
const visibleInputsCount = featureScaled(featureCount(visibleInputs), 1, 5);
|
|
137
|
+
const fieldsetsCount = featureScaled(featureCount(fieldsets), 1, 5);
|
|
138
|
+
const textsCount = featureScaled(featureCount(texts), 0, 3);
|
|
139
|
+
const readOnlyCount = featureScaled(featureCount(readOnly), 0, 3);
|
|
140
|
+
const textareasCount = featureScaled(featureCount(textareas), 0, 2);
|
|
141
|
+
const selectsCount = featureScaled(featureCount(selects), 0, 5);
|
|
142
|
+
const disabledCount = featureScaled(featureCount(disabled), 0, 5);
|
|
143
|
+
const radiosCount = featureScaled(featureCount(radios), 0, 5);
|
|
144
|
+
const visibleIdentifiersCount = featureScaled(featureCount(visibleIdentifiers), 0, 3);
|
|
145
|
+
const hiddenIdentifiersCount = featureScaled(featureCount(hiddenIdentifiers), 0, 2);
|
|
146
|
+
const hiddenCount = featureScaled(featureCount(hidden), 0, 5);
|
|
147
|
+
const visiblePasswordsCount = featureScaled(featureCount(visiblePasswords), 0, 2);
|
|
148
|
+
const hiddenPasswordsCount = featureScaled(featureCount(hiddenPasswords), 0, 2);
|
|
149
|
+
const usernamesCount = featureScaled(featureCount(usernames), 0, 2);
|
|
150
|
+
const emailsCount = featureScaled(featureCount(emails), 0, 2);
|
|
151
|
+
const submitsCount = featureScaled(featureCount(submits), 0, 2);
|
|
152
|
+
const identitiesCount = featureScaled(featureCount(identities), 0, 5);
|
|
153
|
+
const ccsCount = featureScaled(featureCount(ccs), 0, 5);
|
|
154
|
+
const hasTels = feature("hasTels", { tels }, (p) => p.tels.length > 0);
|
|
155
|
+
const hasOAuth = feature("hasOAuth", { oauths }, (p) => p.oauths.length > 0);
|
|
156
|
+
const hasCaptchas = feature("hasCaptchas", { captchas }, (p) => p.captchas.length > 0);
|
|
157
|
+
const hasFiles = feature("hasFiles", { files }, (p) => p.files.length > 0);
|
|
158
|
+
const hasDate = feature("hasDate", { dates }, (p) => p.dates.length > 0);
|
|
159
|
+
const hasNumber = feature("hasNumber", { numbers }, (p) => p.numbers.length > 0);
|
|
160
|
+
const oneVisibleField = feature("oneVisibleField", { visibleInputs }, (p) => p.visibleInputs.length === 1);
|
|
161
|
+
const twoVisibleFields = feature("twoVisibleFields", { visibleInputs }, (p) => p.visibleInputs.length === 2);
|
|
162
|
+
const threeOrMoreVisibleFields = feature("threeOrMoreVisibleFields", { visibleInputs }, (p) => p.visibleInputs.length >= 3);
|
|
163
|
+
const noPasswords = feature("noPasswords", { visiblePasswords }, (p) => p.visiblePasswords.length === 0);
|
|
164
|
+
const onePassword = feature("onePassword", { visiblePasswords }, (p) => p.visiblePasswords.length === 1);
|
|
165
|
+
const twoPasswords = feature("twoPasswords", { visiblePasswords }, (p) => p.visiblePasswords.length === 2);
|
|
166
|
+
const threeOrMorePasswords = feature("threeOrMorePasswords", { visiblePasswords }, (p) => p.visiblePasswords.length >= 3);
|
|
167
|
+
const noIdentifiers = feature("noIdentifiers", { visibleIdentifiers }, (p) => p.visibleIdentifiers.length === 0);
|
|
168
|
+
const oneIdentifier = feature("oneIdentifier", { visibleIdentifiers }, (p) => p.visibleIdentifiers.length === 1);
|
|
169
|
+
const twoIdentifiers = feature("twoIdentifiers", { visibleIdentifiers }, (p) => p.visibleIdentifiers.length === 2);
|
|
170
|
+
const threeOrMoreIdentifiers = feature("threeOrMoreIdentifiers", { visibleIdentifiers }, (p) => p.visibleIdentifiers.length >= 3);
|
|
171
|
+
const inputRatio = feature("inputRatio", { inputs, fields }, (p) => safeInt(p.inputs.length / p.fields.length));
|
|
172
|
+
const hiddenRatio = feature("hiddenRatio", { hidden, fields }, (p) => safeInt(p.hidden.length / p.fields.length));
|
|
173
|
+
const visibleRatio = feature("visibleRatio", { visibleInputs, fields }, (p) => safeInt(p.visibleInputs.length / p.fields.length));
|
|
174
|
+
const checkboxRatio = feature("checkboxRatio", { checkboxes, fields }, (p) => safeInt(p.checkboxes.length / p.fields.length));
|
|
175
|
+
const emailRatio = feature("emailRatio", { emails, fields }, (p) => safeInt(p.emails.length / p.fields.length));
|
|
176
|
+
const usernameRatio = feature("usernameRatio", { usernames, fields }, (p) => safeInt(p.usernames.length / p.fields.length));
|
|
177
|
+
const hiddenIdentifierRatio = feature("hiddenIdentifierRatio", { hiddenIdentifiers, identifiers }, (p) => safeInt(p.hiddenIdentifiers.length / p.identifiers.length));
|
|
178
|
+
const hiddenPasswordRatio = feature("hiddenPasswordRatio", { hiddenPasswords, passwords }, (p) => safeInt(p.hiddenPasswords.length / p.passwords.length));
|
|
179
|
+
const identifierRatio = feature("identifierRatio", { visibleIdentifiers, visibleFields }, (p) => safeInt(p.visibleIdentifiers.length / p.visibleFields.length));
|
|
180
|
+
const passwordRatio = feature("passwordRatio", { visiblePasswords, visibleFields }, (p) => safeInt(p.visiblePasswords.length / p.visibleFields.length));
|
|
181
|
+
const requiredRatio = feature("requiredRatio", { required, visibleFields }, (p) => safeInt(p.required.length / p.visibleFields.length));
|
|
182
|
+
const disabledRatio = feature("disabledRatio", { disabled, visibleFields }, (p) => safeInt(p.disabled.length / p.visibleFields.length));
|
|
183
|
+
const multistepForm_multiAuthForm = featuresProduct(multistepForm, multiAuthForm);
|
|
184
|
+
const visibleRatio_visibleFieldsCount = featuresProduct(visibleRatio, visibleFieldsCount);
|
|
185
|
+
const visibleRatio_visibleIdentifiersCount = featuresProduct(visibleRatio, visibleIdentifiersCount);
|
|
186
|
+
const visibleRatio_visiblePasswordsCount = featuresProduct(visibleRatio, visiblePasswordsCount);
|
|
187
|
+
const visibleRatio_hiddenIdentifiersCount = featuresProduct(visibleRatio, hiddenIdentifiersCount);
|
|
188
|
+
const visibleRatio_hiddenPasswordsCount = featuresProduct(visibleRatio, hiddenPasswordsCount);
|
|
189
|
+
const visibleRatio_multiAuthForm = featuresProduct(visibleRatio, multiAuthForm);
|
|
190
|
+
const visibleRatio_multistepForm = featuresProduct(visibleRatio, multistepForm);
|
|
191
|
+
const identifierRatio_visibleFieldsCount = featuresProduct(identifierRatio, visibleFieldsCount);
|
|
192
|
+
const identifierRatio_visibleIdentifiersCount = featuresProduct(identifierRatio, visibleIdentifiersCount);
|
|
193
|
+
const identifierRatio_visiblePasswordsCount = featuresProduct(identifierRatio, visiblePasswordsCount);
|
|
194
|
+
const identifierRatio_hiddenIdentifiersCount = featuresProduct(identifierRatio, hiddenIdentifiersCount);
|
|
195
|
+
const identifierRatio_hiddenPasswordsCount = featuresProduct(identifierRatio, hiddenPasswordsCount);
|
|
196
|
+
const identifierRatio_multiAuthForm = featuresProduct(identifierRatio, multiAuthForm);
|
|
197
|
+
const identifierRatio_multistepForm = featuresProduct(identifierRatio, multistepForm);
|
|
198
|
+
const passwordRatio_visibleFieldsCount = featuresProduct(passwordRatio, visibleFieldsCount);
|
|
199
|
+
const passwordRatio_visibleIdentifiersCount = featuresProduct(passwordRatio, visibleIdentifiersCount);
|
|
200
|
+
const passwordRatio_visiblePasswordsCount = featuresProduct(passwordRatio, visiblePasswordsCount);
|
|
201
|
+
const passwordRatio_hiddenIdentifiersCount = featuresProduct(passwordRatio, hiddenIdentifiersCount);
|
|
202
|
+
const passwordRatio_hiddenPasswordsCount = featuresProduct(passwordRatio, hiddenPasswordsCount);
|
|
203
|
+
const passwordRatio_multiAuthForm = featuresProduct(passwordRatio, multiAuthForm);
|
|
204
|
+
const passwordRatio_multistepForm = featuresProduct(passwordRatio, multistepForm);
|
|
205
|
+
const requiredRatio_visibleFieldsCount = featuresProduct(requiredRatio, visibleFieldsCount);
|
|
206
|
+
const requiredRatio_visibleIdentifiersCount = featuresProduct(requiredRatio, visibleIdentifiersCount);
|
|
207
|
+
const requiredRatio_visiblePasswordsCount = featuresProduct(requiredRatio, visiblePasswordsCount);
|
|
208
|
+
const requiredRatio_hiddenIdentifiersCount = featuresProduct(requiredRatio, hiddenIdentifiersCount);
|
|
209
|
+
const requiredRatio_hiddenPasswordsCount = featuresProduct(requiredRatio, hiddenPasswordsCount);
|
|
210
|
+
const requiredRatio_multiAuthForm = featuresProduct(requiredRatio, multiAuthForm);
|
|
211
|
+
const requiredRatio_multistepForm = featuresProduct(requiredRatio, multistepForm);
|
|
212
|
+
export const formFeatures = flattenFeatures({
|
|
213
|
+
__formInputMFACandidates,
|
|
214
|
+
__formMFA,
|
|
215
|
+
__formOTPOutlier,
|
|
216
|
+
__formTextAuthenticator,
|
|
217
|
+
__headingsOTPOutlier,
|
|
218
|
+
__inputIterator,
|
|
219
|
+
__linkOTPOutlier,
|
|
220
|
+
visibleFieldsCount,
|
|
221
|
+
visibleInputsCount,
|
|
222
|
+
fieldsetsCount,
|
|
223
|
+
textsCount,
|
|
224
|
+
textareasCount,
|
|
225
|
+
selectsCount,
|
|
226
|
+
disabledCount,
|
|
227
|
+
radiosCount,
|
|
228
|
+
readOnlyCount,
|
|
229
|
+
formComplexity,
|
|
230
|
+
visibleIdentifiersCount,
|
|
231
|
+
hiddenIdentifiersCount,
|
|
232
|
+
usernamesCount,
|
|
233
|
+
emailsCount,
|
|
234
|
+
hiddenCount,
|
|
235
|
+
hiddenPasswordsCount,
|
|
236
|
+
submitsCount,
|
|
237
|
+
identitiesCount,
|
|
238
|
+
ccsCount,
|
|
239
|
+
hasTels,
|
|
240
|
+
hasOAuth,
|
|
241
|
+
hasCaptchas,
|
|
242
|
+
hasFiles,
|
|
243
|
+
hasDate,
|
|
244
|
+
hasNumber,
|
|
245
|
+
oneVisibleField,
|
|
246
|
+
twoVisibleFields,
|
|
247
|
+
threeOrMoreVisibleFields,
|
|
248
|
+
noPasswords,
|
|
249
|
+
onePassword,
|
|
250
|
+
twoPasswords,
|
|
251
|
+
threeOrMorePasswords,
|
|
252
|
+
noIdentifiers,
|
|
253
|
+
oneIdentifier,
|
|
254
|
+
twoIdentifiers,
|
|
255
|
+
threeOrMoreIdentifiers,
|
|
256
|
+
autofocusedIsIdentifier,
|
|
257
|
+
autofocusedIsPassword,
|
|
258
|
+
visibleRatio,
|
|
259
|
+
inputRatio,
|
|
260
|
+
hiddenRatio,
|
|
261
|
+
identifierRatio,
|
|
262
|
+
emailRatio,
|
|
263
|
+
usernameRatio,
|
|
264
|
+
passwordRatio,
|
|
265
|
+
disabledRatio,
|
|
266
|
+
requiredRatio,
|
|
267
|
+
checkboxRatio,
|
|
268
|
+
hiddenIdentifierRatio,
|
|
269
|
+
hiddenPasswordRatio,
|
|
270
|
+
pageLogin,
|
|
271
|
+
formTextLogin,
|
|
272
|
+
formAttrsLogin,
|
|
273
|
+
headingsLogin,
|
|
274
|
+
layoutLogin,
|
|
275
|
+
rememberMeCheckbox,
|
|
276
|
+
troubleLink,
|
|
277
|
+
submitLogin,
|
|
278
|
+
pageRegister,
|
|
279
|
+
formTextRegister,
|
|
280
|
+
formAttrsRegister,
|
|
281
|
+
headingsRegister,
|
|
282
|
+
layoutRegister,
|
|
283
|
+
pwNewRegister,
|
|
284
|
+
pwConfirmRegister,
|
|
285
|
+
submitRegister,
|
|
286
|
+
TOSRef,
|
|
287
|
+
pagePwReset,
|
|
288
|
+
formTextPwReset,
|
|
289
|
+
formAttrsPwReset,
|
|
290
|
+
headingsPwReset,
|
|
291
|
+
layoutPwReset,
|
|
292
|
+
pageRecovery,
|
|
293
|
+
formTextRecovery,
|
|
294
|
+
formAttrsRecovery,
|
|
295
|
+
headingsRecovery,
|
|
296
|
+
layoutRecovery,
|
|
297
|
+
identifierRecovery,
|
|
298
|
+
submitRecovery,
|
|
299
|
+
formTextMFA,
|
|
300
|
+
formAttrsMFA,
|
|
301
|
+
inputsMFA,
|
|
302
|
+
newsletterForm,
|
|
303
|
+
searchForm,
|
|
304
|
+
multistepForm,
|
|
305
|
+
multiAuthForm,
|
|
306
|
+
multistepForm_multiAuthForm,
|
|
307
|
+
visibleRatio_visibleFieldsCount,
|
|
308
|
+
visibleRatio_visibleIdentifiersCount,
|
|
309
|
+
visibleRatio_visiblePasswordsCount,
|
|
310
|
+
visibleRatio_hiddenIdentifiersCount,
|
|
311
|
+
visibleRatio_hiddenPasswordsCount,
|
|
312
|
+
visibleRatio_multiAuthForm,
|
|
313
|
+
visibleRatio_multistepForm,
|
|
314
|
+
identifierRatio_visibleFieldsCount,
|
|
315
|
+
identifierRatio_visibleIdentifiersCount,
|
|
316
|
+
identifierRatio_visiblePasswordsCount,
|
|
317
|
+
identifierRatio_hiddenIdentifiersCount,
|
|
318
|
+
identifierRatio_hiddenPasswordsCount,
|
|
319
|
+
identifierRatio_multiAuthForm,
|
|
320
|
+
identifierRatio_multistepForm,
|
|
321
|
+
passwordRatio_visibleFieldsCount,
|
|
322
|
+
passwordRatio_visibleIdentifiersCount,
|
|
323
|
+
passwordRatio_visiblePasswordsCount,
|
|
324
|
+
passwordRatio_hiddenIdentifiersCount,
|
|
325
|
+
passwordRatio_hiddenPasswordsCount,
|
|
326
|
+
passwordRatio_multiAuthForm,
|
|
327
|
+
passwordRatio_multistepForm,
|
|
328
|
+
requiredRatio_visibleFieldsCount,
|
|
329
|
+
requiredRatio_visibleIdentifiersCount,
|
|
330
|
+
requiredRatio_visiblePasswordsCount,
|
|
331
|
+
requiredRatio_hiddenIdentifiersCount,
|
|
332
|
+
requiredRatio_hiddenPasswordsCount,
|
|
333
|
+
requiredRatio_multiAuthForm,
|
|
334
|
+
requiredRatio_multistepForm,
|
|
335
|
+
});
|
|
336
|
+
export const formFeaturesComputer = getComputerForFeatures(formFeatures);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const emailFeatures: {
|
|
2
|
+
exactAttrEmail: {
|
|
3
|
+
name: "exactAttrEmail";
|
|
4
|
+
parents: import("../..").AbstractFeatures;
|
|
5
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
6
|
+
};
|
|
7
|
+
fieldAttrEmail: {
|
|
8
|
+
name: "attrEmail";
|
|
9
|
+
parents: import("../..").AbstractFeatures;
|
|
10
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
11
|
+
};
|
|
12
|
+
fieldAutocompleteEmail: {
|
|
13
|
+
name: "autocompleteEmail";
|
|
14
|
+
parents: import("../..").AbstractFeatures;
|
|
15
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
16
|
+
};
|
|
17
|
+
fieldAutocompleteOff: {
|
|
18
|
+
name: "autocompleteOff";
|
|
19
|
+
parents: import("../..").AbstractFeatures;
|
|
20
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
21
|
+
};
|
|
22
|
+
fieldCC: {
|
|
23
|
+
name: "fieldCC";
|
|
24
|
+
parents: import("../..").AbstractFeatures;
|
|
25
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
26
|
+
};
|
|
27
|
+
fieldIdentity: {
|
|
28
|
+
name: "fieldIdentity";
|
|
29
|
+
parents: import("../..").AbstractFeatures;
|
|
30
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
31
|
+
};
|
|
32
|
+
fieldSearch: {
|
|
33
|
+
name: "isSearchField";
|
|
34
|
+
parents: import("../..").AbstractFeatures;
|
|
35
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
36
|
+
};
|
|
37
|
+
labelEmail: {
|
|
38
|
+
name: "labelEmail";
|
|
39
|
+
parents: import("../..").AbstractFeatures;
|
|
40
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
41
|
+
};
|
|
42
|
+
mfaOutlier: {
|
|
43
|
+
name: "mfaOutlier";
|
|
44
|
+
parents: import("../..").AbstractFeatures;
|
|
45
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
46
|
+
};
|
|
47
|
+
placeholderEmail: {
|
|
48
|
+
name: "placeholderEmail";
|
|
49
|
+
parents: import("../..").AbstractFeatures;
|
|
50
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
51
|
+
};
|
|
52
|
+
textEmail: {
|
|
53
|
+
name: "textEmail";
|
|
54
|
+
parents: import("../..").AbstractFeatures;
|
|
55
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
56
|
+
};
|
|
57
|
+
typeEmail: {
|
|
58
|
+
name: "typeEmail";
|
|
59
|
+
parents: import("../..").AbstractFeatures;
|
|
60
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { kEmailSelector } from "@protontech/autofill/constants/selectors";
|
|
2
|
+
import { feature, flattenFeatures } from "@protontech/autofill/features/feature";
|
|
3
|
+
import { field, fieldAttrEmail, fieldAttrs, fieldAutocomplete, fieldAutocompleteEmail, fieldAutocompleteOff, fieldCC, fieldIdentity, fieldLabel, fieldSearch, fieldText, placeholder, type, } from "@protontech/autofill/features/v1/abstract.field";
|
|
4
|
+
import { any } from "@protontech/autofill/utils/combinators";
|
|
5
|
+
import { matchEmail, matchEmailValue, matchMFAAttr } from "@protontech/autofill/utils/re";
|
|
6
|
+
import { sanitizeString } from "@protontech/autofill/utils/text";
|
|
7
|
+
const typeEmail = feature("typeEmail", { fieldType: type }, (p) => p.type === "email");
|
|
8
|
+
const exactAttrEmail = feature("exactAttrEmail", { field }, (p) => p.field.matches(kEmailSelector));
|
|
9
|
+
const textEmail = feature("textEmail", { fieldText }, (p) => matchEmail(p.fieldText));
|
|
10
|
+
const labelEmail = feature("labelEmail", { fieldLabel }, (p) => matchEmail(p.fieldLabel));
|
|
11
|
+
const placeholderEmailValue = feature("placeholderEmailValue", { fieldPlaceholder: placeholder }, (p) => any(matchEmailValue)(p.placeholder.split(" ")));
|
|
12
|
+
const placeholderEmail = feature("placeholderEmail", { placeholderEmailValue, fieldPlaceholder: placeholder }, (p) => p.placeholderEmailValue || matchEmail(sanitizeString(p.placeholder)));
|
|
13
|
+
const mfaOutlier = feature("mfaOutlier", { fieldAttrs, fieldAutocomplete }, (p) => p.fieldAutocomplete === "one-time-code" || any(matchMFAAttr)(p.fieldAttrs));
|
|
14
|
+
export const emailFeatures = flattenFeatures({
|
|
15
|
+
exactAttrEmail,
|
|
16
|
+
fieldAttrEmail,
|
|
17
|
+
fieldAutocompleteEmail,
|
|
18
|
+
fieldAutocompleteOff,
|
|
19
|
+
fieldCC,
|
|
20
|
+
fieldIdentity,
|
|
21
|
+
fieldSearch,
|
|
22
|
+
labelEmail,
|
|
23
|
+
mfaOutlier,
|
|
24
|
+
placeholderEmail,
|
|
25
|
+
textEmail,
|
|
26
|
+
typeEmail,
|
|
27
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export declare const otpFeatures: {
|
|
2
|
+
attrMFA: {
|
|
3
|
+
name: "attrMFA";
|
|
4
|
+
parents: import("../..").AbstractFeatures;
|
|
5
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
6
|
+
};
|
|
7
|
+
attrOTP: {
|
|
8
|
+
name: "attrOTP";
|
|
9
|
+
parents: import("../..").AbstractFeatures;
|
|
10
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
11
|
+
};
|
|
12
|
+
autocompleteOTC: {
|
|
13
|
+
name: "autocompleteOTC";
|
|
14
|
+
parents: import("../..").AbstractFeatures;
|
|
15
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
16
|
+
};
|
|
17
|
+
fieldCC: {
|
|
18
|
+
name: "fieldCC";
|
|
19
|
+
parents: import("../..").AbstractFeatures;
|
|
20
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
21
|
+
};
|
|
22
|
+
fieldIdentity: {
|
|
23
|
+
name: "fieldIdentity";
|
|
24
|
+
parents: import("../..").AbstractFeatures;
|
|
25
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
26
|
+
};
|
|
27
|
+
formAuthenticator: {
|
|
28
|
+
name: "formAuthenticator";
|
|
29
|
+
parents: import("../..").AbstractFeatures;
|
|
30
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
31
|
+
};
|
|
32
|
+
formComplexity: {
|
|
33
|
+
name: "formComplexity";
|
|
34
|
+
parents: import("../..").AbstractFeatures;
|
|
35
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): number;
|
|
36
|
+
};
|
|
37
|
+
formMFA: {
|
|
38
|
+
name: "formMFA";
|
|
39
|
+
parents: import("../..").AbstractFeatures;
|
|
40
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
41
|
+
};
|
|
42
|
+
idMatch: {
|
|
43
|
+
name: "idMatch";
|
|
44
|
+
parents: import("../..").AbstractFeatures;
|
|
45
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
46
|
+
};
|
|
47
|
+
labelAuthenticator: {
|
|
48
|
+
name: "labelAuthenticator";
|
|
49
|
+
parents: import("../..").AbstractFeatures;
|
|
50
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
51
|
+
};
|
|
52
|
+
labelMFA: {
|
|
53
|
+
name: "labelMFA";
|
|
54
|
+
parents: import("../..").AbstractFeatures;
|
|
55
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
56
|
+
};
|
|
57
|
+
labelOTP: {
|
|
58
|
+
name: "labelOTP";
|
|
59
|
+
parents: import("../..").AbstractFeatures;
|
|
60
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
61
|
+
};
|
|
62
|
+
nameMatch: {
|
|
63
|
+
name: "nameMatch";
|
|
64
|
+
parents: import("../..").AbstractFeatures;
|
|
65
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
66
|
+
};
|
|
67
|
+
numericMode: {
|
|
68
|
+
name: "numericMode";
|
|
69
|
+
parents: import("../..").AbstractFeatures;
|
|
70
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
71
|
+
};
|
|
72
|
+
outlierAutocomplete: {
|
|
73
|
+
name: "outlierAutocomplete";
|
|
74
|
+
parents: import("../..").AbstractFeatures;
|
|
75
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
76
|
+
};
|
|
77
|
+
outlierEmailMatchScaled: {
|
|
78
|
+
name: "outlierEmailMatchScaled";
|
|
79
|
+
parents: import("../..").AbstractFeatures;
|
|
80
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): number;
|
|
81
|
+
};
|
|
82
|
+
outlierField: {
|
|
83
|
+
name: "outlierField";
|
|
84
|
+
parents: import("../..").AbstractFeatures;
|
|
85
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
86
|
+
};
|
|
87
|
+
outlierForm: {
|
|
88
|
+
name: "outlierForm";
|
|
89
|
+
parents: import("../..").AbstractFeatures;
|
|
90
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
91
|
+
};
|
|
92
|
+
outlierHeadings: {
|
|
93
|
+
name: "outlierHeadings";
|
|
94
|
+
parents: import("../..").AbstractFeatures;
|
|
95
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
96
|
+
};
|
|
97
|
+
outlierInputCount: {
|
|
98
|
+
name: "outlierInputCount";
|
|
99
|
+
parents: import("../..").AbstractFeatures;
|
|
100
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
101
|
+
};
|
|
102
|
+
outlierLink: {
|
|
103
|
+
name: "outlierLink";
|
|
104
|
+
parents: import("../..").AbstractFeatures;
|
|
105
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
106
|
+
};
|
|
107
|
+
outlierMaxLength: {
|
|
108
|
+
name: "outlierMaxLength";
|
|
109
|
+
parents: import("../..").AbstractFeatures;
|
|
110
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
111
|
+
};
|
|
112
|
+
outlierSearch: {
|
|
113
|
+
name: "outlierSearch";
|
|
114
|
+
parents: import("../..").AbstractFeatures;
|
|
115
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
116
|
+
};
|
|
117
|
+
patternOTP: {
|
|
118
|
+
name: "patternOTP";
|
|
119
|
+
parents: import("../..").AbstractFeatures;
|
|
120
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
121
|
+
};
|
|
122
|
+
siblingOfInterest: {
|
|
123
|
+
name: "siblingOfInterest";
|
|
124
|
+
parents: import("../..").AbstractFeatures;
|
|
125
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
126
|
+
};
|
|
127
|
+
singleInput: {
|
|
128
|
+
name: "singleInput";
|
|
129
|
+
parents: import("../..").AbstractFeatures;
|
|
130
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
131
|
+
};
|
|
132
|
+
textAuthenticator: {
|
|
133
|
+
name: "textAuthenticator";
|
|
134
|
+
parents: import("../..").AbstractFeatures;
|
|
135
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
136
|
+
};
|
|
137
|
+
textMFA: {
|
|
138
|
+
name: "textMFA";
|
|
139
|
+
parents: import("../..").AbstractFeatures;
|
|
140
|
+
compute(parents: import("../..").InferParentComputeType<import("../..").AbstractFeatures>, fnode: import("@protontech/fathom").Fnode): boolean;
|
|
141
|
+
};
|
|
142
|
+
};
|