@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,95 @@
|
|
|
1
|
+
import { kEmailSelector } from "@protontech/autofill/constants/selectors";
|
|
2
|
+
import { feature, flattenFeatures } from "@protontech/autofill/features/feature";
|
|
3
|
+
import { formFeaturesComputer } from "@protontech/autofill/features/v1/abstract.form";
|
|
4
|
+
import { any } from "@protontech/autofill/utils/combinators";
|
|
5
|
+
import { matchCCFieldCandidate } from "@protontech/autofill/utils/credit-card";
|
|
6
|
+
import { getFieldHaystacks } from "@protontech/autofill/utils/extract";
|
|
7
|
+
import { getFormClassification, getParentFormFnode } from "@protontech/autofill/utils/fathom";
|
|
8
|
+
import { flagAsHidden, removeHiddenFlag } from "@protontech/autofill/utils/flags";
|
|
9
|
+
import { matchIdentityField } from "@protontech/autofill/utils/identity";
|
|
10
|
+
import { matchEmailAttr, matchSearchAction, matchUsernameAttr } from "@protontech/autofill/utils/re";
|
|
11
|
+
import { isVisible, isVisibleField } from "@protontech/autofill/utils/visible";
|
|
12
|
+
export const field = feature("field", {}, (_, fnode) => fnode.element);
|
|
13
|
+
export const value = feature("value", { field }, (p) => p.field.value);
|
|
14
|
+
export const type = feature("type", { field }, (p) => p.field.getAttribute("type"));
|
|
15
|
+
export const readonly = feature("readonly", { field }, (p) => p.field.readOnly);
|
|
16
|
+
export const required = feature("required", { field }, (p) => p.field.required);
|
|
17
|
+
export const minLength = feature("minLength", { field }, (p) => p.field.getAttribute("minlength"));
|
|
18
|
+
export const maxLength = feature("maxLength", { field }, (p) => p.field.getAttribute("maxlength"));
|
|
19
|
+
export const pattern = feature("pattern", { field }, (p) => p.field.pattern);
|
|
20
|
+
export const disabled = feature("disabled", { field }, (p) => p.field.disabled);
|
|
21
|
+
export const tabIndex = feature("tabIndex", { field }, (p) => p.field.tabIndex);
|
|
22
|
+
export const placeholder = feature("placeholder", { field }, (p) => p.field.placeholder);
|
|
23
|
+
export const typeValid = feature("typeValid", { fieldType: type }, (p) => p.type !== "hidden");
|
|
24
|
+
const parentFormFnode = feature("parentFormFnode", {}, (_, fnode) => getParentFormFnode(fnode));
|
|
25
|
+
const parentFormFeatures = feature("parentFormFeatures", { parentFormFnode }, (p) => {
|
|
26
|
+
const parent = p.parentFormFnode;
|
|
27
|
+
if (parent && !parent.hasNoteFor("form"))
|
|
28
|
+
parent.setNoteFor("form", formFeaturesComputer.compute(parent));
|
|
29
|
+
return parent === null || parent === void 0 ? void 0 : parent.noteFor("form");
|
|
30
|
+
});
|
|
31
|
+
const parentFormInputIterator = feature("parentFormInputIterator", { parentFormFeatures }, (p) => { var _a, _b; return (_b = (_a = p.parentFormFeatures) === null || _a === void 0 ? void 0 : _a.__inputIterator) !== null && _b !== void 0 ? _b : null; });
|
|
32
|
+
const formClassification = feature("formClassification", { parentFormFnode }, (p) => getFormClassification(p.parentFormFnode));
|
|
33
|
+
const isFormLogin = feature("isFormLogin", { formClassification }, (p) => p.formClassification.login);
|
|
34
|
+
const isFormRegister = feature("isFormRegister", { formClassification }, (p) => p.formClassification.register);
|
|
35
|
+
const isFormPasswordChange = feature("isFormPasswordChange", { formClassification }, (p) => p.formClassification.passwordChange);
|
|
36
|
+
const isFormRecovery = feature("isFormRecovery", { formClassification }, (p) => p.formClassification.recovery);
|
|
37
|
+
const isFormNoop = feature("isFormNoop", { formClassification }, (p) => p.formClassification.noop);
|
|
38
|
+
const autocomplete = feature("autocomplete", { field }, (p) => { var _a; return (_a = p.field.getAttribute("autocomplete")) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase(); });
|
|
39
|
+
const visible = feature("visible", { typeValid, field }, (p) => (p.typeValid ? isVisibleField(p.field) && isVisible(p.field, { opacity: false }) : false));
|
|
40
|
+
const flagHiddenFieldsSideEffect = feature("flagHiddenFieldsSideEffect", { typeValid, visible, field }, (p) => {
|
|
41
|
+
if (p.typeValid)
|
|
42
|
+
(p.visible ? removeHiddenFlag : flagAsHidden)(p.field);
|
|
43
|
+
});
|
|
44
|
+
const fieldHaystacks = feature("fieldHaystacks", { field }, (p) => getFieldHaystacks(p.field));
|
|
45
|
+
const attrs = feature("attrs", { fieldHaystacks }, (p) => p.fieldHaystacks.fieldAttrs);
|
|
46
|
+
const text = feature("text", { fieldHaystacks }, (p) => p.fieldHaystacks.fieldText);
|
|
47
|
+
const label = feature("label", { fieldHaystacks }, (p) => p.fieldHaystacks.labelText);
|
|
48
|
+
const searchField = feature("searchField", { visible, attrs, text, flagHiddenFieldsSideEffect }, (p) => p.visible && any(matchSearchAction)(p.attrs.concat(p.text)));
|
|
49
|
+
const isCC = feature("isCC", { field, visible }, (p) => matchCCFieldCandidate(p.field, { visible: p.visible }));
|
|
50
|
+
const isIdentity = feature("isIdentity", { isCC, field, visible, formClassification, searchField, fieldType: type }, (p) => !p.isCC && matchIdentityField(p.field, { visible: p.visible, form: p.formClassification, searchField: p.searchField, type: p.type }));
|
|
51
|
+
const prevInput = feature("prevInput", { typeValid, parentFormInputIterator, field }, (p) => { var _a, _b; return (p.typeValid ? ((_b = (_a = p.parentFormInputIterator) === null || _a === void 0 ? void 0 : _a.prev(p.field, "INPUT")) !== null && _b !== void 0 ? _b : null) : null); });
|
|
52
|
+
const prevField = feature("prevField", { typeValid, parentFormInputIterator, field }, (p) => { var _a, _b; return (p.typeValid ? ((_b = (_a = p.parentFormInputIterator) === null || _a === void 0 ? void 0 : _a.prev(p.field)) !== null && _b !== void 0 ? _b : null) : null); });
|
|
53
|
+
const nextField = feature("nextField", { typeValid, parentFormInputIterator, field }, (p) => { var _a, _b; return (p.typeValid ? ((_b = (_a = p.parentFormInputIterator) === null || _a === void 0 ? void 0 : _a.next(p.field)) !== null && _b !== void 0 ? _b : null) : null); });
|
|
54
|
+
export const fieldFeatures = flattenFeatures({
|
|
55
|
+
attrs,
|
|
56
|
+
autocomplete,
|
|
57
|
+
isCC,
|
|
58
|
+
isFormLogin,
|
|
59
|
+
isFormNoop,
|
|
60
|
+
isFormPasswordChange,
|
|
61
|
+
isFormRecovery,
|
|
62
|
+
isFormRegister,
|
|
63
|
+
isIdentity,
|
|
64
|
+
label,
|
|
65
|
+
nextField,
|
|
66
|
+
parentFormFeatures,
|
|
67
|
+
parentFormFnode,
|
|
68
|
+
prevField,
|
|
69
|
+
prevInput,
|
|
70
|
+
searchField,
|
|
71
|
+
text,
|
|
72
|
+
visible,
|
|
73
|
+
});
|
|
74
|
+
export const fieldFeats = feature("fieldFeats", {}, (_, fnode) => fnode.noteFor("field"));
|
|
75
|
+
export const fieldForm = feature("fieldForm", { fieldFeats }, (p) => p.fieldFeats.parentFormFnode);
|
|
76
|
+
export const fieldCC = feature("fieldCC", { fieldFeats }, (p) => p.fieldFeats.isCC);
|
|
77
|
+
export const fieldIdentity = feature("fieldIdentity", { fieldFeats }, (p) => p.fieldFeats.isIdentity);
|
|
78
|
+
export const fieldSearch = feature("isSearchField", { fieldFeats }, (p) => p.fieldFeats.searchField);
|
|
79
|
+
export const fieldAttrs = feature("fieldAttrs", { fieldFeats }, (p) => p.fieldFeats.attrs);
|
|
80
|
+
export const fieldText = feature("fieldText", { fieldFeats }, (p) => p.fieldFeats.text);
|
|
81
|
+
export const fieldLabel = feature("fieldLabel", { fieldFeats }, (p) => p.fieldFeats.label);
|
|
82
|
+
export const fieldAutocomplete = feature("fieldAutocomplete", { fieldFeats }, (p) => p.fieldFeats.autocomplete);
|
|
83
|
+
export const fieldEmailMatch = feature("emailMatch", { fieldAttrs, fieldLabel, fieldText, field }, (p) => p.field.matches(kEmailSelector) || any(matchEmailAttr)(p.fieldAttrs.concat(p.fieldText, p.fieldLabel)));
|
|
84
|
+
export const fieldAutocompleteUsername = feature("autocompleteUsername", { fieldAutocomplete, fieldEmailMatch }, (p) => { var _a, _b, _c; return !p.emailMatch && Boolean((_b = (_a = p.fieldAutocomplete) === null || _a === void 0 ? void 0 : _a.includes("username")) !== null && _b !== void 0 ? _b : (_c = p.fieldAutocomplete) === null || _c === void 0 ? void 0 : _c.includes("nickname")); });
|
|
85
|
+
export const fieldAttrEmail = feature("attrEmail", { fieldAttrs }, (p) => any(matchEmailAttr)(p.fieldAttrs));
|
|
86
|
+
export const fieldAttrUsername = feature("attrUsername", { fieldAttrs }, (p) => any(matchUsernameAttr)(p.fieldAttrs));
|
|
87
|
+
export const fieldFormFeats = feature("fieldFormFeats", { fieldFeats }, (p) => p.fieldFeats.parentFormFeatures);
|
|
88
|
+
export const fieldAutocompleteEmail = feature("autocompleteEmail", { fieldAutocomplete }, (p) => { var _a, _b; return (_b = (_a = p.fieldAutocomplete) === null || _a === void 0 ? void 0 : _a.includes("email")) !== null && _b !== void 0 ? _b : false; });
|
|
89
|
+
export const fieldAutocompleteOff = feature("autocompleteOff", { fieldAutocomplete }, (p) => p.fieldAutocomplete === "false" || p.fieldAutocomplete === "off");
|
|
90
|
+
export const fieldNext = feature("fieldNext", { fieldFeats }, (p) => p.fieldFeats.nextField);
|
|
91
|
+
export const fieldPrev = feature("fieldPrev", { fieldFeats }, (p) => p.fieldFeats.prevField);
|
|
92
|
+
export const fieldPrevInput = feature("fieldPrevInput", { fieldFeats }, (p) => p.fieldFeats.prevInput);
|
|
93
|
+
export const fieldLogin = feature("fieldLogin", { fieldFeats }, (p) => p.fieldFeats.isFormLogin);
|
|
94
|
+
export const fieldRegister = feature("fieldRegister", { fieldFeats }, (p) => p.fieldFeats.isFormRegister);
|
|
95
|
+
export const fieldExotic = feature("fieldExotic", { fieldFeats }, (p) => p.fieldFeats.isFormNoop);
|