Skip to content

Commit c454fc7

Browse files
authored
[Autofill] Add new autofill sub-feature (duckduckgo#2917)
* feat: add new autofill subfeature * update types * add to all overrides * feat: make boundary single string * feat: update config to remove javascriptConfig
1 parent 9d031b9 commit c454fc7

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

overrides/android-override.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,31 @@
362362
]
363363
}
364364
},
365+
"siteSpecificFixes": {
366+
"state": "enabled",
367+
"settings": {
368+
"domains": [
369+
{
370+
"domain": ["estore.archives.gov", "localhost"],
371+
"patchSettings": [
372+
{
373+
"path": "",
374+
"op": "add",
375+
"value": {
376+
"formTypeSettings": [
377+
{
378+
"selector": "fieldset[id='ucContentMiddleCenter_fldLogin']",
379+
"type": "login"
380+
}
381+
],
382+
"formBoundarySelector": "#ucContentMiddleCenter_fldLogin"
383+
}
384+
}
385+
]
386+
}
387+
]
388+
}
389+
},
365390
"canImportFromGooglePasswordManager": {
366391
"state": "enabled",
367392
"settings": {

schema/features/android-browser-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CSSInjectFeatureSettings, Feature, SubFeature } from '../feature';
1+
import { Feature, SubFeature } from '../feature';
22

33
// Type of the feature `settings` object
44
type SettingsType = undefined;

schema/features/autofill.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CSSInjectFeatureSettings, Feature, SubFeature } from '../feature';
1+
import { Feature, SubFeature } from '../feature';
22
import { Operation } from '../json-patch';
33

44
// Type of the feature `settings` object
@@ -17,6 +17,16 @@ type ImportFromGooglePasswordManager = {
1717
signInButton: ButtonConfig;
1818
};
1919

20+
type FormTypeSetting = {
21+
selector: string;
22+
type: 'login' | 'signup';
23+
};
24+
25+
export type SiteSpecificFixes = {
26+
formBoundarySelector?: string;
27+
formTypeSettings?: FormTypeSetting[];
28+
};
29+
2030
// Any subfeatures that have typed `settings` should be defined here.
2131
// Subfeatures without settings (or just string:string mappings for settings) will be automatically validated.
2232
type SubFeatures<VersionType> = {
@@ -32,6 +42,15 @@ type SubFeatures<VersionType> = {
3242
};
3343
}
3444
>;
45+
siteSpecificFixes?: SubFeature<
46+
VersionType,
47+
{
48+
domains: {
49+
domain: string | string[];
50+
patchSettings: Operation<SiteSpecificFixes>[];
51+
}[];
52+
}
53+
>;
3554
};
3655

3756
export type AutofillFeature<VersionType> = Feature<

schema/features/duckplayer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Feature, CSSInjectFeatureSettings } from '../feature';
2-
import { Operation } from '../json-patch';
32

43
type State = 'enabled' | 'disabled';
54
type StateObject = {

schema/features/webcompat.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Feature, CSSInjectFeatureSettings } from '../feature';
2-
import { Operation } from '../json-patch';
32

43
type StateToggle = 'enabled' | 'disabled';
54
type FullWebCompatOptions = CSSInjectFeatureSettings<{

0 commit comments

Comments
 (0)