summaryrefslogtreecommitdiffstats
path: root/toolkit/components/formautofill/Constants.ios.mjs
blob: 619c1b9aadb90cdf2e8318bde047f0bc533d6e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const IOS_DEFAULT_PREFERENCES = {
  "extensions.formautofill.creditCards.heuristics.mode": 1,
  "extensions.formautofill.creditCards.heuristics.fathom.confidenceThreshold": 0.5,
  "extensions.formautofill.creditCards.heuristics.fathom.highConfidenceThreshold": 0.95,
  "extensions.formautofill.creditCards.heuristics.fathom.testConfidence": 0,
  "extensions.formautofill.creditCards.heuristics.fathom.types":
    "cc-number,cc-name",
  "extensions.formautofill.loglevel": "Warn",
  "extensions.formautofill.firstTimeUse": true,
  "extensions.formautofill.addresses.supported": "off",
  "extensions.formautofill.creditCards.supported": "detect",
  "browser.search.region": "US",
  "extensions.formautofill.creditCards.supportedCountries": "US,CA,GB,FR,DE",
  "extensions.formautofill.addresses.enabled": false,
  "extensions.formautofill.addresses.capture.enabled": false,
  "extensions.formautofill.addresses.capture.v2.enabled": false,
  "extensions.formautofill.addresses.supportedCountries": "",
  "extensions.formautofill.creditCards.enabled": true,
  "extensions.formautofill.reauth.enabled": true,
  "extensions.formautofill.creditCards.hideui": false,
  "extensions.formautofill.supportRTL": false,
  "extensions.formautofill.creditCards.ignoreAutocompleteOff": true,
  "extensions.formautofill.addresses.ignoreAutocompleteOff": true,
  "extensions.formautofill.heuristics.enabled": true,
  "extensions.formautofill.section.enabled": true,
  // WebKit doesn't support the checkVisibility API, setting the threshold value to 0 to esnure
  // `IsFieldVisible` function doesn't use it
  "extensions.formautofill.heuristics.visibilityCheckThreshold": 0,
  "extensions.formautofill.focusOnAutofill": false,
};

// Used Mimic the behavior of .getAutocompleteInfo()
// List from: https://searchfox.org/mozilla-central/source/dom/base/AutocompleteFieldList.h#89-149
// Also found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
const VALID_AUTOCOMPLETE_FIELDS = [
  "off",
  "on",
  "name",
  "honorific-prefix",
  "given-name",
  "additional-name",
  "family-name",
  "honorific-suffix",
  "nickname",
  "email",
  "username",
  "new-password",
  "current-password",
  "one-time-code",
  "organization-title",
  "organization",
  "street-address",
  "address-line1",
  "address-line2",
  "address-line3",
  "address-level4",
  "address-level3",
  "address-level2",
  "address-level1",
  "country",
  "country-name",
  "postal-code",
  "cc-name",
  "cc-given-name",
  "cc-additional-name",
  "cc-family-name",
  "cc-number",
  "cc-exp",
  "cc-exp-month",
  "cc-exp-year",
  "cc-csc",
  "cc-type",
  "transaction-currency",
  "transaction-amount",
  "language",
  "bday",
  "bday-day",
  "bday-month",
  "bday-year",
  "sex",
  "tel",
  "tel-country-code",
  "tel-national",
  "tel-area-code",
  "tel-local",
  "tel-extension",
  "impp",
  "url",
  "photo",
];

export const IOSAppConstants = Object.freeze({
  platform: "ios",
  prefs: IOS_DEFAULT_PREFERENCES,
  validAutocompleteFields: VALID_AUTOCOMPLETE_FIELDS,
});

export default IOSAppConstants;