@@ -21,7 +21,7 @@ import {
21
21
22
22
import { getInputSubtype , getInputMainType , createMatching , getInputVariant , getInputType , getMainTypeFromType } from './matching.js' ;
23
23
import { getIconStylesAutofilled , getIconStylesBase , getIconStylesAlternate } from './inputStyles.js' ;
24
- import { canBeInteractedWith , getInputConfig , isFieldDecorated } from './inputTypeConfig.js' ;
24
+ import { canBeInteractedWith , getInputConfig , isEligibleCCSubType , isFieldDecorated } from './inputTypeConfig.js' ;
25
25
26
26
import {
27
27
getUnifiedExpiryDate ,
@@ -531,7 +531,7 @@ class Form {
531
531
* @param {boolean } shouldCheckForDecorate
532
532
*/
533
533
execOnInputs ( fn , inputType = 'all' , shouldCheckForDecorate = true ) {
534
- const inputs = [ ... this . inputs [ inputType ] ] ;
534
+ const inputs = this . inputs [ inputType ] ;
535
535
for ( const input of inputs ) {
536
536
let canExecute = true ;
537
537
// sometimes we want to execute even if we didn't decorate
@@ -807,12 +807,15 @@ class Form {
807
807
}
808
808
}
809
809
810
- if ( this . device . globalConfig . isExtension || this . device . globalConfig . isMobileApp ) {
810
+ const isNotTouchedAndFilled = ! this . touched . has ( input ) && ! input . classList . contains ( 'ddg-autofilled' ) ;
811
+ const isMobileApp = this . device . globalConfig . isMobileApp ;
812
+ if ( this . device . globalConfig . isExtension || isMobileApp ) {
811
813
// Don't open the tooltip on input focus whenever it's showing in-context signup
812
814
if ( isIncontextSignupAvailable ) return false ;
815
+ if ( isMobileApp && isNotTouchedAndFilled && isEligibleCCSubType ( subtype ) ) return true ;
813
816
}
814
817
815
- return ! this . touched . has ( input ) && ! input . classList . contains ( 'ddg-autofilled' ) ;
818
+ return isNotTouchedAndFilled ;
816
819
}
817
820
818
821
/**
@@ -950,15 +953,14 @@ class Form {
950
953
return isLoginOrHybrid && this . device . credentialsImport . isAvailable ( ) ;
951
954
}
952
955
953
- getFirstViableInputForType ( dataType ) {
954
- return [ ...this . inputs [ dataType ] ] . find ( ( input ) => canBeInteractedWith ( input ) && isPotentiallyViewable ( input ) ) ;
956
+ getFirstViableInputForCredentials ( ) {
957
+ return [ ...this . inputs . credentials ] . find ( ( input ) => canBeInteractedWith ( input ) && isPotentiallyViewable ( input ) ) ;
955
958
}
956
959
957
960
async promptLoginIfNeeded ( ) {
958
- const isMobileCCForm = this . isCCForm && this . device . globalConfig . isMobileApp ;
959
- if ( document . visibilityState !== 'visible' || ! ( this . isLogin || isMobileCCForm ) ) return ;
961
+ if ( document . visibilityState !== 'visible' || ! this . isLogin ) return ;
960
962
961
- const firstViableInput = this . getFirstViableInputForType ( 'credentials' ) || this . getFirstViableInputForType ( 'creditCards' ) ;
963
+ const firstViableInput = this . getFirstViableInputForCredentials ( ) ;
962
964
const input = this . activeInput || firstViableInput ;
963
965
if ( ! input ) return ;
964
966
@@ -981,14 +983,12 @@ class Form {
981
983
const topMostElementFromPoint = document . elementFromPoint ( elHCenter , elVCenter ) ;
982
984
983
985
if ( this . form . contains ( topMostElementFromPoint ) ) {
984
- const dataTypeForExec = this . isCCForm ? 'creditCards' : this . isLogin ? 'credentials' : null ;
985
986
// Add inputs to the touched set only for the dataTypeForExec, which currentl
986
- dataTypeForExec &&
987
- this . execOnInputs ( ( input ) => {
988
- if ( isPotentiallyViewable ( input ) ) {
989
- this . touched . add ( input ) ;
990
- }
991
- } , dataTypeForExec ) ;
987
+ this . execOnInputs ( ( input ) => {
988
+ if ( isPotentiallyViewable ( input ) ) {
989
+ this . touched . add ( input ) ;
990
+ }
991
+ } , 'credentials' ) ;
992
992
this . device . attachTooltip ( {
993
993
form : this ,
994
994
input,
0 commit comments