Skip to content

Commit 07cac42

Browse files
authored
Merge pull request #1483 from brainstormforce/next-release
Version 1.7.0
2 parents 37fa9af + 51fed4a commit 07cac42

File tree

210 files changed

+24978
-18852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+24978
-18852
lines changed

.distignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ multisite.xml
4545
multisite.xml.dist
4646
phpcs.xml
4747
phpcs.xml.dist
48+
phpcs-report.xml
4849
README.md
4950
wp-cli.local.yml
5051
yarn.lock

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sureforms/
88

99
# Vscode
1010
.vscode
11+
.cursor
1112

1213
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
1314
.grunt

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ packages/block-serialization-spec-parser/parser.js
66
packages/e2e-tests/plugins
77
packages/react-native-editor/bundle
88
vendor
9-
admin
9+
./admin
1010
dist
1111
node_modules
1212

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
**Requires at least:** 6.4
55
**Tested up to:** 6.8.1
66
**Requires PHP:** 7.4
7-
**Stable tag:** 1.6.4
7+
**Stable tag:** 1.7.0
88
**License:** GPLv2 or later
99
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -260,6 +260,10 @@ Yes! You can certainly use SureForms on yours as well as your client’s website
260260
When you use SureForms, you get an easy-to-use AI-powered form builder that can be used to build your forms fast.
261261

262262
## Changelog ##
263+
### 1.7.0 - 22nd May 2025 ###
264+
* New: Revamped user interface for Dashboard and Settings with a more modern and intuitive experience.
265+
* Improvement: Improved reCAPTCHA handling by adding detailed logging for failure responses.
266+
* Improvement: Number and range components now support float values.
263267
### 1.6.4 - 14th May 2025 ###
264268
* New: Introduced Advanced Form Styling.
265269
* Improvement: Updated Phone Number field to announce the country code only once for better accessibility.

admin/admin.php

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function add_upgrade_to_pro() {
272272
* @since 0.0.1
273273
*/
274274
public function render_dashboard() {
275-
echo '<div id="srfm-dashboard-container"></div>';
275+
echo '<div id="srfm-dashboard-container" class="srfm-admin-wrapper"></div>';
276276
}
277277

278278
/**
@@ -282,7 +282,7 @@ public function render_dashboard() {
282282
* @since 0.0.1
283283
*/
284284
public function settings_page_callback() {
285-
echo '<div id="srfm-settings-container"></div>';
285+
echo '<div id="srfm-settings-container" class="srfm-admin-wrapper"></div>';
286286
}
287287

288288
/**
@@ -319,7 +319,7 @@ public function add_new_form() {
319319
* @since 0.0.1
320320
*/
321321
public function add_new_form_callback() {
322-
echo '<div id="srfm-add-new-form-container"></div>';
322+
echo '<div id="srfm-add-new-form-container" class="srfm-admin-wrapper"></div>';
323323
}
324324

325325
/**
@@ -504,6 +504,16 @@ public function enqueue_scripts() {
504504
'sureforms_pricing_page' => Helper::get_sureforms_website_url( 'pricing' ),
505505
'field_spacing_vars' => Helper::get_css_vars(),
506506
'is_ver_lower_than_6_7' => version_compare( $wp_version, '6.6.2', '<=' ),
507+
'integrations' => Helper::sureforms_get_integration(),
508+
'ajax_url' => admin_url( 'admin-ajax.php' ),
509+
'sf_plugin_manager_nonce' => wp_create_nonce( 'sf_plugin_manager_nonce' ),
510+
'plugin_installer_nonce' => wp_create_nonce( 'updates' ),
511+
'plugin_activating_text' => __( 'Activating...', 'sureforms' ),
512+
'plugin_activated_text' => __( 'Activated', 'sureforms' ),
513+
'plugin_activate_text' => __( 'Activate', 'sureforms' ),
514+
'plugin_installing_text' => __( 'Installing...', 'sureforms' ),
515+
'plugin_installed_text' => __( 'Installed', 'sureforms' ),
516+
'is_rtl' => $is_rtl,
507517
];
508518

509519
$is_screen_sureforms_menu = Helper::validate_request_context( 'sureforms_menu', 'page' );
@@ -558,20 +568,6 @@ public function enqueue_scripts() {
558568

559569
if ( $is_screen_sureforms_form_settings ) {
560570
wp_enqueue_style( SRFM_SLUG . '-settings', $css_uri . 'backend/settings' . $file_prefix . $rtl . '.css', [], SRFM_VER );
561-
562-
// if version is equal to or lower than 6.6.2 then add compatibility css.
563-
if ( version_compare( $wp_version, '6.6.2', '<=' ) ) {
564-
$srfm_inline_css = '
565-
.srfm-settings-page-container
566-
.components-toggle-control {
567-
.components-base-control__help{
568-
margin-left: 4em;
569-
}
570-
}
571-
}
572-
';
573-
wp_add_inline_style( SRFM_SLUG . '-settings', $srfm_inline_css );
574-
}
575571
}
576572

577573
// Enqueue styles for the entries page.

assets/js/unminified/form-submit.js

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,22 @@ function redirectToUrl( url ) {
250250
* @param {string} [event.detail.position='footer'] - The position to display the error message ('header' or 'footer').
251251
*/
252252
function dispatchErrorEvent( event ) {
253-
const { form, message = '', position = 'footer' } = event.detail || {};
253+
const {
254+
form,
255+
message = '',
256+
position = 'footer',
257+
log_message = null,
258+
} = event.detail || {};
254259

255260
if ( ! form ) {
256261
return;
257262
}
258263

264+
// Log the error message to the console if provided.
265+
if ( log_message ) {
266+
console.warn( log_message );
267+
}
268+
259269
const errorMessage =
260270
message ||
261271
__(
@@ -287,13 +297,19 @@ function dispatchErrorEvent( event ) {
287297
document.addEventListener( 'srfm_show_common_form_error', dispatchErrorEvent );
288298

289299
function showErrorMessage( args ) {
290-
const { form, message = '', position = 'footer' } = args;
300+
const {
301+
form,
302+
message = '',
303+
position = 'footer',
304+
log_message = null,
305+
} = args;
291306

292307
const errorEvent = new CustomEvent( 'srfm_show_common_form_error', {
293308
detail: {
294309
form,
295310
message,
296311
position,
312+
log_message,
297313
},
298314
} );
299315

@@ -540,6 +556,12 @@ function recaptchaCallback( token = '' ) {
540556
);
541557
isRecaptchaRender = true;
542558
},
559+
'error-callback': () => {
560+
showErrorMessageOnRecaptchaError( {
561+
containerSelector: '.g-recaptcha[recaptcha-type="v2-invisible"]:not(.captcha-error-added)',
562+
message: srfm_submit?.messages?.srfm_google_captcha_error_message,
563+
} );
564+
},
543565
} );
544566

545567
submitBtn.addEventListener( 'click', () => {
@@ -580,6 +602,25 @@ function recaptchaCallback( token = '' ) {
580602
} );
581603
}
582604

605+
function showErrorMessageOnRecaptchaError( args ) {
606+
const { containerSelector, message = '' } = args;
607+
608+
const getCaptchaContainer = document.querySelectorAll( containerSelector );
609+
if ( ! getCaptchaContainer ) {
610+
return;
611+
}
612+
613+
getCaptchaContainer.forEach( ( element ) => {
614+
const getTheForm = element.closest( '.srfm-form' );
615+
if ( getTheForm ) {
616+
showErrorMessage( { form: getTheForm, message } );
617+
618+
// Add class
619+
element.classList.add( 'captcha-error-added' );
620+
}
621+
} );
622+
}
623+
583624
/**
584625
* Emits a custom event to signal the successful submission of a form.
585626
*

assets/js/unminified/frontend.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,71 @@ function onSuccess( response ) {
153153
}
154154
}
155155

156+
function showErrorMessage( args ) {
157+
const { form, message = '', position = 'footer' } = args;
158+
159+
const errorEvent = new CustomEvent( 'srfm_show_common_form_error', {
160+
detail: {
161+
form,
162+
message,
163+
position,
164+
},
165+
} );
166+
167+
document.dispatchEvent( errorEvent );
168+
}
169+
170+
function showErrorMessageOnRecaptchaError( args ) {
171+
const { containerSelector, message = '' } = args;
172+
173+
const getCaptchaContainer = document.querySelectorAll( containerSelector );
174+
if ( ! getCaptchaContainer ) {
175+
return;
176+
}
177+
178+
getCaptchaContainer.forEach( ( element ) => {
179+
const getTheForm = element.closest( '.srfm-form' );
180+
if ( getTheForm ) {
181+
showErrorMessage( { form: getTheForm, message } );
182+
183+
// Add class
184+
element.classList.add( 'captcha-error-added' );
185+
}
186+
} );
187+
}
188+
189+
// eslint-disable-next-line
190+
function onTurnstileError() {
191+
showErrorMessageOnRecaptchaError( {
192+
containerSelector: '.cf-turnstile:not(.captcha-error-added)',
193+
message: srfm_submit?.messages?.srfm_turnstile_error_message,
194+
} );
195+
}
196+
197+
// eslint-disable-next-line
198+
function onGCaptchaV2CheckBoxError() {
199+
showErrorMessageOnRecaptchaError( {
200+
containerSelector: '.g-recaptcha[recaptcha-type="v2-checkbox"]:not(.captcha-error-added)',
201+
message: srfm_submit?.messages?.srfm_google_captcha_error_message,
202+
} );
203+
}
204+
205+
// eslint-disable-next-line
206+
function onGCaptchaV3Error() {
207+
showErrorMessageOnRecaptchaError( {
208+
containerSelector: '.g-recaptcha[recaptcha-type="v3-reCAPTCHA"]:not(.captcha-error-added)',
209+
message: srfm_submit?.messages?.srfm_google_captcha_error_message,
210+
} );
211+
}
212+
213+
// eslint-disable-next-line
214+
function onHCaptchaError() {
215+
showErrorMessageOnRecaptchaError( {
216+
containerSelector: '.h-captcha:not(.captcha-error-added)',
217+
message: srfm_submit?.messages?.srfm_captcha_h_error_message,
218+
} );
219+
}
220+
156221
/**
157222
* An Immediately Invoked Function Expression (IIFE) is a function that is defined
158223
* and executed immediately after its creation. It is used to create a new scope,

bin/install-wp-tests.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)