3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
- /* eslint-disable no-undef */
7
- // jscs:disable jsDoc
6
+ /* global grecaptcha */
8
7
define (
9
8
[
10
9
'uiComponent' ,
11
10
'jquery' ,
12
11
'ko' ,
12
+ 'underscore' ,
13
13
'Magento_ReCaptchaFrontendUi/js/registry' ,
14
14
'Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader' ,
15
- 'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer' ,
16
- ] ,
17
- function ( Component , $ , ko , registry , reCaptchaLoader , nonInlineReCaptchaRenderer ) {
15
+ 'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer'
16
+ ] , function ( Component , $ , ko , _ , registry , reCaptchaLoader , nonInlineReCaptchaRenderer ) {
18
17
'use strict' ;
19
18
20
19
return Component . extend ( {
@@ -24,6 +23,9 @@ define(
24
23
reCaptchaId : 'recaptcha'
25
24
} ,
26
25
26
+ /**
27
+ * @inheritdoc
28
+ */
27
29
initialize : function ( ) {
28
30
this . _super ( ) ;
29
31
this . _loadApi ( ) ;
@@ -116,7 +118,7 @@ define(
116
118
) ;
117
119
118
120
if ( parameters . size === 'invisible' && parameters . badge !== 'inline' ) {
119
- nonInlineReCaptchaRenderer . add ( $reCaptcha , parameters )
121
+ nonInlineReCaptchaRenderer . add ( $reCaptcha , parameters ) ;
120
122
}
121
123
122
124
// eslint-disable-next-line no-undef
@@ -161,6 +163,11 @@ define(
161
163
}
162
164
} ,
163
165
166
+ /**
167
+ * Validates reCAPTCHA
168
+ * @param {* } state
169
+ * @returns {jQuery }
170
+ */
164
171
validateReCaptcha : function ( state ) {
165
172
if ( ! this . getIsInvisibleRecaptcha ( ) ) {
166
173
return $ ( document ) . find ( 'input[type=checkbox].required-captcha' ) . prop ( 'checked' , state ) ;
@@ -188,5 +195,4 @@ define(
188
195
return this . reCaptchaId ;
189
196
}
190
197
} ) ;
191
- }
192
- ) ;
198
+ } ) ;
0 commit comments