From 3d6cb2119d9d2fcd07504606d249d1931e8ada56 Mon Sep 17 00:00:00 2001 From: "Kyle B. Johnson" Date: Wed, 18 Oct 2023 09:42:08 -0400 Subject: [PATCH 01/18] Refactor: Move feedback link to "more" menu (#7027) --- .../resources/js/form-builder/src/App.tsx | 2 - .../src/containers/HeaderContainer.tsx | 13 ++++- .../form-builder/src/feedback/Container.tsx | 18 ------ .../src/feedback/FeedbackButton.tsx | 21 ------- .../src/feedback/FeedbackIcon.tsx | 21 ------- .../js/form-builder/src/feedback/index.tsx | 57 ------------------- .../src/feedback/popup/CloseIcon.tsx | 9 --- .../src/feedback/popup/Container.tsx | 22 ------- .../src/feedback/popup/Content.tsx | 18 ------ .../src/feedback/popup/Header.tsx | 32 ----------- .../src/feedback/popup/HeaderIcon.tsx | 11 ---- .../form-builder/src/feedback/popup/index.ts | 9 --- .../src/styles/_block-editor.scss | 4 +- 13 files changed, 14 insertions(+), 223 deletions(-) delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/Container.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackButton.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackIcon.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/index.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/popup/CloseIcon.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/popup/Container.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/popup/Content.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/popup/Header.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/popup/HeaderIcon.tsx delete mode 100644 src/FormBuilder/resources/js/form-builder/src/feedback/popup/index.ts diff --git a/src/FormBuilder/resources/js/form-builder/src/App.tsx b/src/FormBuilder/resources/js/form-builder/src/App.tsx index 2a2897cfe0..fbbc5a739f 100644 --- a/src/FormBuilder/resources/js/form-builder/src/App.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/App.tsx @@ -3,7 +3,6 @@ import BlockEditorContainer from './containers/BlockEditorContainer'; import {FormStateProvider} from './stores/form-state'; import {Storage} from './common'; import defaultBlocks from './blocks.json'; -import Feedback from '@givewp/form-builder/feedback'; import {BlockInstance} from '@wordpress/blocks'; import './App.scss'; import FormBuilderErrorBoundary from '@givewp/form-builder/errors/FormBuilderErrorBounday'; @@ -55,7 +54,6 @@ export default function App() { - diff --git a/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx b/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx index 8bafdfa08a..d8825f8c64 100644 --- a/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx @@ -2,7 +2,7 @@ import React, {useState} from 'react'; import {EditIcon, GiveIcon} from '../components/icons'; import {drawerRight, moreVertical, external} from '@wordpress/icons'; import {setFormSettings, setTransferState, useFormState, useFormStateDispatch} from '../stores/form-state'; -import {Button, Dropdown, MenuGroup, MenuItem, TextControl} from '@wordpress/components'; +import {Button, Dropdown, ExternalLink, Icon, MenuGroup, MenuItem, TextControl} from '@wordpress/components'; import {__} from '@wordpress/i18n'; import {Header} from '../components'; import {getWindowData, Storage} from '../common'; @@ -198,7 +198,7 @@ const HeaderContainer = ({ }} renderContent={({onClose}) => (
- + { // @ts-ignore @@ -231,6 +231,15 @@ const HeaderContainer = ({ )} + + + {__('Submit Feedback', 'give')} + +
)} /> diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/Container.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/Container.tsx deleted file mode 100644 index 81c70c4438..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/Container.tsx +++ /dev/null @@ -1,18 +0,0 @@ -const Container = ({children}) => { - return ( -
- {children} -
- ) -} - -export default Container; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackButton.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackButton.tsx deleted file mode 100644 index 2d345de51b..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackButton.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import {Button} from '@wordpress/components'; -import FeedbackIcon from './FeedbackIcon'; - -const FeedbackButton = (props) => { - return ( - - ); -}; - -export default FeedbackButton; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackIcon.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackIcon.tsx deleted file mode 100644 index 743afd9098..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackIcon.tsx +++ /dev/null @@ -1,21 +0,0 @@ -const FeedbackIcon = () => { - return ( - - - - - ); -}; - -export default FeedbackIcon; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/index.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/index.tsx deleted file mode 100644 index 18676b01f1..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/index.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import React, {useEffect, useState} from 'react'; -import {__} from '@wordpress/i18n'; -import Container from './Container'; -import FeedbackButton from './FeedbackButton'; - -import {Container as PopupContainer, Content as PopupContent, Header as PopupHeader} from './popup'; -import {ExternalLink} from '@wordpress/components'; - -const feedbackUrl = 'https://docs.givewp.com/nextgenfeedback'; - -const HIDE_FEEDBACK = 'givewpNextGenHideFeedback'; - -const Feedback = () => { - const [hidden, setHidden] = useState(false); - const closeCallback = () => { - setHidden(true); - localStorage.setItem(HIDE_FEEDBACK, 'true'); - }; - - useEffect(() => { - setHidden(!!localStorage.getItem(HIDE_FEEDBACK)); - }, []); - - // @ts-ignore - return ( - - {!hidden && ( - - - -
- - {__( - 'Let us know what you think about the form builder to help improve the product experience.', - 'give' - )} - -
-
- - {__('Provide Feedback', 'give')} - -
-
-
- )} - setHidden(!hidden)}>{__('Feedback', 'give')} -
- ); -}; - -export default Feedback; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/CloseIcon.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/CloseIcon.tsx deleted file mode 100644 index 186bcd2ccc..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/CloseIcon.tsx +++ /dev/null @@ -1,9 +0,0 @@ -const CloseIcon = (props) => { - return ( - - - - ); -}; - -export default CloseIcon; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Container.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Container.tsx deleted file mode 100644 index 2d20d9c6c8..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Container.tsx +++ /dev/null @@ -1,22 +0,0 @@ -const Container = ({children}) => { - return ( -
- {children} -
- ); -} - -export default Container; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Content.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Content.tsx deleted file mode 100644 index 6d6b5cd8d8..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Content.tsx +++ /dev/null @@ -1,18 +0,0 @@ -const Content = ({children}) => { - return ( -
- {children} -
- ); -} - -export default Content; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Header.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Header.tsx deleted file mode 100644 index 755c625cc3..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Header.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import {Button, Icon} from '@wordpress/components'; -import CloseIcon from './CloseIcon'; -import HeaderIcon from './HeaderIcon'; - -const Header = ({title, closeCallback}) => { - return ( -
-
- - {title} -
-
- ); -}; - -export default Header; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/HeaderIcon.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/HeaderIcon.tsx deleted file mode 100644 index 2b2e6233c8..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/HeaderIcon.tsx +++ /dev/null @@ -1,11 +0,0 @@ -const HeaderIcon = (props) => { - return ( - - - - - - ) -} - -export default HeaderIcon; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/index.ts b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/index.ts deleted file mode 100644 index 65a0f0cae9..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Container from './Container' -import Header from './Header' -import Content from './Content' - -export { - Container, - Header, - Content, -} diff --git a/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss b/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss index 1e959c3eed..6134d4d67c 100644 --- a/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss +++ b/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss @@ -214,4 +214,6 @@ background-color: white; } - +.givewp-support-link.components-external-link > svg { + display: none; /* Hide included icon, in favor of menu item icon. */ +} From afc5b3bf4abad13a7141e1e24704a5681a3cb83f Mon Sep 17 00:00:00 2001 From: "Kyle B. Johnson" Date: Wed, 18 Oct 2023 09:42:26 -0400 Subject: [PATCH 02/18] Refactor: Remove paragraph content from inspector (#7006) --- .../src/blocks/elements/paragraph/Edit.tsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx index 927f34493e..5f9a9b85a0 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx @@ -1,7 +1,6 @@ import {BlockEditProps} from '@wordpress/blocks'; -import {RichText, InspectorControls} from '@wordpress/block-editor'; +import {RichText} from '@wordpress/block-editor'; import {__} from '@wordpress/i18n'; -import {PanelBody, PanelRow, TextareaControl, TextControl} from "@wordpress/components"; export default function Edit({attributes, setAttributes}: BlockEditProps) { const {content} = attributes; @@ -15,17 +14,6 @@ export default function Edit({attributes, setAttributes}: BlockEditProps) { onChange={(content) => setAttributes({content})} placeholder={__('Enter some text', 'give')} /> - - - - setAttributes({content})} - /> - - - ); } From c55783c6504296aa74c6d26826fbee4887f0db62 Mon Sep 17 00:00:00 2001 From: Paulo Iankoski Date: Wed, 18 Oct 2023 17:32:52 -0300 Subject: [PATCH 03/18] refactor: add support to get all gateways --- .../settings/class-settings-gateways.php | 3 +- includes/gateways/functions.php | 56 +++++++++++++------ 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/includes/admin/settings/class-settings-gateways.php b/includes/admin/settings/class-settings-gateways.php index c8b23161de..8abbbf9bf6 100644 --- a/includes/admin/settings/class-settings-gateways.php +++ b/includes/admin/settings/class-settings-gateways.php @@ -368,7 +368,8 @@ static function ($value, $key) { $gateways, give()->gateways->getPaymentGateways(2) ) - ) + ), + 2 ); // v3 gateways are gateways that are registered with updated gateway registration API. diff --git a/includes/gateways/functions.php b/includes/gateways/functions.php index 8236479608..5504457193 100644 --- a/includes/gateways/functions.php +++ b/includes/gateways/functions.php @@ -23,10 +23,8 @@ * @param int|null $version * @return array $gateways All the available gateways */ -function give_get_payment_gateways($version = 2) +function give_get_payment_gateways($version = null) { - $suffix = $version === 3 ? '_v3' : ''; - // Default, built-in gateways $gateways = apply_filters( 'give_payment_gateways', @@ -43,7 +41,14 @@ function give_get_payment_gateways($version = 2) } }); - $gatewayLabels = give_get_option('gateways_label' . $suffix, []); + $gatewayLabels = []; + if (!$version || $version === 2) { + $gatewayLabels = array_merge($gatewayLabels, (array)give_get_option('gateways_label', [])); + } + + if (!$version || $version === 3) { + $gatewayLabels = array_merge($gatewayLabels, (array)give_get_option('gateways_label_v3', [])); + } // Replace payment gateway checkout label with admin defined checkout label. if ($gatewayLabels) { @@ -67,12 +72,18 @@ function give_get_payment_gateways($version = 2) * @param int|null $version * @return array $gateway_list All the available gateways */ -function give_get_enabled_payment_gateways($form_id = 0, $version = 2) +function give_get_enabled_payment_gateways($form_id = 0, $version = null) { - $suffix = $version === 3 ? '_v3' : ''; $gateways = give_get_payment_gateways($version); - $enabled = $_POST['gateways' . $suffix] ?? give_get_option('gateways' . $suffix); + $enabled = []; + if (!$version || $version === 2) { + $enabled = array_merge($enabled, $_POST['gateways'] ?? (array)give_get_option('gateways', [])); + } + + if (!$version || $version === 3) { + $enabled = array_merge($enabled, $_POST['gateways_v3'] ?? (array)give_get_option('gateways_v3', [])); + } $gateway_list = []; @@ -91,7 +102,7 @@ function give_get_enabled_payment_gateways($form_id = 0, $version = 2) /** * Checks whether a specified gateway is activated. * - * @unlreased add $version param + * @unreleased add $version param * @since 1.0 * * @param string $gateway Name of the gateway to check for @@ -110,7 +121,7 @@ function give_is_gateway_active($gateway, $version = 2) /** * Gets the default payment gateway selected from the Give Settings * - * @unlreased add $version param + * @unreleased add $version param * @since 1.0 * * @param int|null $form_id int ID of the Give Form @@ -345,19 +356,30 @@ function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish /** * Returns a ordered list of all available gateways. * - * @unlreased add $version param + * @unreleased add $version param * @since 1.4.5 * * @param array $gateways List of payment gateways * @param int|null $version * @return array $gateways All the available gateways */ -function give_get_ordered_payment_gateways($gateways, $version = 2) +function give_get_ordered_payment_gateways($gateways, $version = null) { - $suffix = $version === 3 ? '_v3' : ''; - // Get gateways setting. - $gateways_setting = $_POST['gateways' . $suffix] ?? give_get_option('gateways' . $suffix); + $gateways_setting = []; + if (!$version || $version === 2) { + $gateways_setting = array_merge( + $gateways_setting, + $_POST['gateways'] ?? (array)give_get_option('gateways', []) + ); + } + + if (!$version || $version === 3) { + $gateways_setting = array_merge( + $gateways_setting, + $_POST['gateways_v3'] ?? (array)give_get_option('gateways_v3', []) + ); + } // Return from here if we do not have gateways setting. if ( empty( $gateways_setting ) ) { @@ -369,8 +391,7 @@ function give_get_ordered_payment_gateways($gateways, $version = 2) // Reorder gateways array foreach ( $gateways_setting as $gateway_key => $value ) { - - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; + $new_gateway_value = $gateways[$gateway_key] ?? ''; unset( $gateways[ $gateway_key ] ); if ( ! empty( $new_gateway_value ) ) { @@ -381,9 +402,10 @@ function give_get_ordered_payment_gateways($gateways, $version = 2) /** * Filter payment gateways order. * + * @unreleased add $version param * @since 1.7 * * @param array $gateways All the available gateways */ - return apply_filters('give_payment_gateways_order' . $suffix, $gateways); + return apply_filters('give_payment_gateways_order', $gateways, $version); } From 79e93c8ad40a00a95a26280923ff35bc30fa4602 Mon Sep 17 00:00:00 2001 From: Paulo Iankoski Date: Wed, 18 Oct 2023 17:36:16 -0300 Subject: [PATCH 04/18] refactor: enforce only v2 forms will be loaded on v2 forms --- includes/forms/template.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/forms/template.php b/includes/forms/template.php index a3705d20dc..c297978e53 100644 --- a/includes/forms/template.php +++ b/includes/forms/template.php @@ -1700,8 +1700,7 @@ class="give-cancel-login give-checkout-register-cancel give-btn button" name="gi * @since 1.0 */ function give_payment_mode_select( $form_id, $args ) { - - $gateways = give_get_enabled_payment_gateways( $form_id ); + $gateways = give_get_enabled_payment_gateways($form_id, 2); $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; /** From 81e60871289cddd1a314623eeb3072283473553e Mon Sep 17 00:00:00 2001 From: Paulo Iankoski Date: Wed, 18 Oct 2023 17:56:42 -0300 Subject: [PATCH 05/18] fix: keep using original gatewayId to get meta --- src/FormMigration/FormMetaDecorator.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FormMigration/FormMetaDecorator.php b/src/FormMigration/FormMetaDecorator.php index dcadd39fc8..c5da78f72d 100644 --- a/src/FormMigration/FormMetaDecorator.php +++ b/src/FormMigration/FormMetaDecorator.php @@ -476,11 +476,12 @@ public function getFeeRecoverySettings(): array if ($gateways) { foreach (array_keys($gateways) as $gatewayId) { + $v3GatewayId = $gatewayId; if (array_key_exists($gatewayId, $gatewaysMap)) { - $gatewayId = $gatewaysMap[$gatewayId]; + $v3GatewayId = $gatewaysMap[$gatewayId]; } - $perGatewaySettings[$gatewayId] = [ + $perGatewaySettings[$v3GatewayId] = [ 'enabled' => $this->getMeta('_form_gateway_fee_enable_' . $gatewayId) === 'enabled', 'feePercentage' => (float)$this->getMeta('_form_gateway_fee_percentage_' . $gatewayId), 'feeBaseAmount' => (float)$this->getMeta('_form_gateway_fee_base_amount_' . $gatewayId), From df392fa7841d97999ff26b42c94731b7144cbbfa Mon Sep 17 00:00:00 2001 From: Paulo Iankoski Date: Wed, 18 Oct 2023 17:57:04 -0300 Subject: [PATCH 06/18] refactor: set default values for gateways --- src/FormMigration/FormMetaDecorator.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/FormMigration/FormMetaDecorator.php b/src/FormMigration/FormMetaDecorator.php index c5da78f72d..b5bb6e40fb 100644 --- a/src/FormMigration/FormMetaDecorator.php +++ b/src/FormMigration/FormMetaDecorator.php @@ -483,9 +483,12 @@ public function getFeeRecoverySettings(): array $perGatewaySettings[$v3GatewayId] = [ 'enabled' => $this->getMeta('_form_gateway_fee_enable_' . $gatewayId) === 'enabled', - 'feePercentage' => (float)$this->getMeta('_form_gateway_fee_percentage_' . $gatewayId), - 'feeBaseAmount' => (float)$this->getMeta('_form_gateway_fee_base_amount_' . $gatewayId), - 'maxFeeAmount' => (float)$this->getMeta('_form_gateway_fee_maximum_fee_amount_' . $gatewayId), + 'feePercentage' => (float)$this->getMeta('_form_gateway_fee_percentage_' . $gatewayId, 2.9), + 'feeBaseAmount' => (float)$this->getMeta('_form_gateway_fee_base_amount_' . $gatewayId, 0.30), + 'maxFeeAmount' => (float)$this->getMeta( + '_form_gateway_fee_maximum_fee_amount_' . $gatewayId, + give_format_decimal(['amount' => '0.00']) + ), ]; } } From 2415b547381ef8c6f7bfad61bb01eae982ae6962 Mon Sep 17 00:00:00 2001 From: Paulo Iankoski Date: Wed, 18 Oct 2023 18:11:16 -0300 Subject: [PATCH 07/18] doc: set unreleased tag --- src/FormMigration/FormMetaDecorator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FormMigration/FormMetaDecorator.php b/src/FormMigration/FormMetaDecorator.php index b5bb6e40fb..f036a2e35d 100644 --- a/src/FormMigration/FormMetaDecorator.php +++ b/src/FormMigration/FormMetaDecorator.php @@ -448,6 +448,7 @@ public function getFormFieldsPlacement(): string } /** + * @unreleased set correct $gatewayId to be used in getMeta calls * @since 3.0.0 */ public function getFeeRecoverySettings(): array From 08fbab2fcdd384ae5c6550d00056edc5ee3ef7dc Mon Sep 17 00:00:00 2001 From: Paulo Iankoski Date: Wed, 18 Oct 2023 18:23:32 -0300 Subject: [PATCH 08/18] refactor: cast $_POST value --- includes/gateways/functions.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/gateways/functions.php b/includes/gateways/functions.php index 5504457193..551b020156 100644 --- a/includes/gateways/functions.php +++ b/includes/gateways/functions.php @@ -78,11 +78,13 @@ function give_get_enabled_payment_gateways($form_id = 0, $version = null) $enabled = []; if (!$version || $version === 2) { - $enabled = array_merge($enabled, $_POST['gateways'] ?? (array)give_get_option('gateways', [])); + $gatewaysFromPostRequest = isset($_POST['gateways']) ? (array)$_POST['gateways'] : null; + $enabled = array_merge($enabled, $gatewaysFromPostRequest ?? (array)give_get_option('gateways', [])); } if (!$version || $version === 3) { - $enabled = array_merge($enabled, $_POST['gateways_v3'] ?? (array)give_get_option('gateways_v3', [])); + $gatewaysFromPostRequest = isset($_POST['gateways_v3']) ? (array)$_POST['gateways_v3'] : null; + $enabled = array_merge($enabled, $gatewaysFromPostRequest ?? (array)give_get_option('gateways_v3', [])); } $gateway_list = []; @@ -368,16 +370,18 @@ function give_get_ordered_payment_gateways($gateways, $version = null) // Get gateways setting. $gateways_setting = []; if (!$version || $version === 2) { + $gatewaysFromPostRequest = isset($_POST['gateways']) ? (array)$_POST['gateways'] : null; $gateways_setting = array_merge( $gateways_setting, - $_POST['gateways'] ?? (array)give_get_option('gateways', []) + $gatewaysFromPostRequest ?? (array)give_get_option('gateways', []) ); } if (!$version || $version === 3) { + $gatewaysFromPostRequest = isset($_POST['gateways_v3']) ? (array)$_POST['gateways_v3'] : null; $gateways_setting = array_merge( $gateways_setting, - $_POST['gateways_v3'] ?? (array)give_get_option('gateways_v3', []) + $gatewaysFromPostRequest ?? (array)give_get_option('gateways_v3', []) ); } From d21d3138f2ea536351aa6a766e1f3be6627600a1 Mon Sep 17 00:00:00 2001 From: Angela Blake <35241639+angelablake@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:08:05 -0500 Subject: [PATCH 09/18] chore: prepare for 3.0.2 release --- give.php | 4 ++-- readme.txt | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/give.php b/give.php index 90819819a0..61f79765a7 100644 --- a/give.php +++ b/give.php @@ -6,7 +6,7 @@ * Description: The most robust, flexible, and intuitive way to accept donations on WordPress. * Author: GiveWP * Author URI: https://givewp.com/ - * Version: 3.0.1 + * Version: 3.0.2 * Requires at least: 6.0 * Requires PHP: 7.2 * Text Domain: give @@ -391,7 +391,7 @@ private function setup_constants() { // Plugin version. if (!defined('GIVE_VERSION')) { - define('GIVE_VERSION', '3.0.1'); + define('GIVE_VERSION', '3.0.2'); } // Plugin Root File. diff --git a/readme.txt b/readme.txt index ec928249bc..b5814d9244 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.2 -Stable tag: 3.0.1 +Stable tag: 3.0.2 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -262,6 +262,8 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri 10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on. == Changelog == += 3.0.2: October 19th, 2023 = +* Fix: Stripe per-form settings are included when migrating a form to the Visual Donation Form Builder = 3.0.1: October 17th, 2023 = * Fix: Resolved a conflict with Matomo plugin that was causing a fatal error From b750575ee64ff82ff6e4a7b4c9f89c4cb5beb150 Mon Sep 17 00:00:00 2001 From: Angela Blake <35241639+angelablake@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:25:12 -0500 Subject: [PATCH 10/18] chore: prepare for 3.0.2 release --- src/FormMigration/FormMetaDecorator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FormMigration/FormMetaDecorator.php b/src/FormMigration/FormMetaDecorator.php index f036a2e35d..b37410d2fe 100644 --- a/src/FormMigration/FormMetaDecorator.php +++ b/src/FormMigration/FormMetaDecorator.php @@ -448,7 +448,7 @@ public function getFormFieldsPlacement(): string } /** - * @unreleased set correct $gatewayId to be used in getMeta calls + * @since 3.0.2 set correct $gatewayId to be used in getMeta calls * @since 3.0.0 */ public function getFeeRecoverySettings(): array From de04c0a8e0fe99123a1bab2e890e5cc7ec74f83d Mon Sep 17 00:00:00 2001 From: Angela Blake <35241639+angelablake@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:25:45 -0500 Subject: [PATCH 11/18] chore: prepare for 3.0.2 release --- give.php | 4 ++-- includes/gateways/functions.php | 8 ++++---- readme.txt | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/give.php b/give.php index 90819819a0..61f79765a7 100644 --- a/give.php +++ b/give.php @@ -6,7 +6,7 @@ * Description: The most robust, flexible, and intuitive way to accept donations on WordPress. * Author: GiveWP * Author URI: https://givewp.com/ - * Version: 3.0.1 + * Version: 3.0.2 * Requires at least: 6.0 * Requires PHP: 7.2 * Text Domain: give @@ -391,7 +391,7 @@ private function setup_constants() { // Plugin version. if (!defined('GIVE_VERSION')) { - define('GIVE_VERSION', '3.0.1'); + define('GIVE_VERSION', '3.0.2'); } // Plugin Root File. diff --git a/includes/gateways/functions.php b/includes/gateways/functions.php index 551b020156..1d473fbeb7 100644 --- a/includes/gateways/functions.php +++ b/includes/gateways/functions.php @@ -104,7 +104,7 @@ function give_get_enabled_payment_gateways($form_id = 0, $version = null) /** * Checks whether a specified gateway is activated. * - * @unreleased add $version param + * @since 3.0.2 add $version param * @since 1.0 * * @param string $gateway Name of the gateway to check for @@ -123,7 +123,7 @@ function give_is_gateway_active($gateway, $version = 2) /** * Gets the default payment gateway selected from the Give Settings * - * @unreleased add $version param + * @since 3.0.2 add $version param * @since 1.0 * * @param int|null $form_id int ID of the Give Form @@ -358,7 +358,7 @@ function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish /** * Returns a ordered list of all available gateways. * - * @unreleased add $version param + * @since 3.0.2 add $version param * @since 1.4.5 * * @param array $gateways List of payment gateways @@ -406,7 +406,7 @@ function give_get_ordered_payment_gateways($gateways, $version = null) /** * Filter payment gateways order. * - * @unreleased add $version param + * @since 3.0.2 add $version param * @since 1.7 * * @param array $gateways All the available gateways diff --git a/readme.txt b/readme.txt index ec928249bc..7fe07a80fe 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.2 -Stable tag: 3.0.1 +Stable tag: 3.0.2 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -262,6 +262,9 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri 10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on. == Changelog == += 3.0.2: October 19th, 2023 = +* Fix: Gateways are properly separated in the settings page and Global Settings for Fee Recovery shows all gateways when you select per gateway + = 3.0.1: October 17th, 2023 = * Fix: Resolved a conflict with Matomo plugin that was causing a fatal error From 7395e6656140956c909ff601b39855e1e25e33c8 Mon Sep 17 00:00:00 2001 From: Glauber Silva Date: Thu, 19 Oct 2023 18:32:24 -0300 Subject: [PATCH 12/18] Hot Fix: Prevent fatal errors on legacy forms (v2) when it has 'post_content' populated --- src/DonationForms/FormPage/TemplateHandler.php | 15 +++++++++++++-- .../Repositories/DonationFormRepository.php | 6 +++--- src/FormBuilder/Routes/EditFormRoute.php | 4 +++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/DonationForms/FormPage/TemplateHandler.php b/src/DonationForms/FormPage/TemplateHandler.php index c809e30105..6c5ae01d45 100644 --- a/src/DonationForms/FormPage/TemplateHandler.php +++ b/src/DonationForms/FormPage/TemplateHandler.php @@ -2,8 +2,12 @@ namespace Give\DonationForms\FormPage; +use Give\Helpers\Form\Utils; use WP_Post as Post; +/** + * @since 3.0.0 + */ class TemplateHandler { /** @@ -22,6 +26,9 @@ public function __construct( $post, string $formPageTemplatePath ) $this->formPageTemplatePath = $formPageTemplatePath; } + /** + * @since 3.0.0 + */ public function handle($template) { return $this->isNextGenForm() @@ -29,10 +36,14 @@ public function handle($template) : $template; } + /** + * @unreleased Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder + * @since 3.0.0 + */ protected function isNextGenForm(): bool { return $this->post - && $this->post->post_content - &&'give_forms' === $this->post->post_type; + && Utils::isV3Form($this->post->ID) + && 'give_forms' === $this->post->post_type; } } diff --git a/src/DonationForms/Repositories/DonationFormRepository.php b/src/DonationForms/Repositories/DonationFormRepository.php index 35d1d606e6..c7db596e27 100644 --- a/src/DonationForms/Repositories/DonationFormRepository.php +++ b/src/DonationForms/Repositories/DonationFormRepository.php @@ -19,6 +19,7 @@ use Give\Framework\PaymentGateways\PaymentGateway; use Give\Framework\PaymentGateways\PaymentGatewayRegister; use Give\Framework\Support\Facades\DateTime\Temporal; +use Give\Helpers\Form\Utils; use Give\Helpers\Hooks; use Give\Log\Log; @@ -477,13 +478,12 @@ function ($value, Closure $fail, string $key, array $values) use ($formId) { } /** + * @unreleased Use isV3Form() method instead of 'post_content' to check if it's a legacy form * @since 3.0.0 */ public function isLegacyForm(int $formId): bool { - $form = DB::table('posts')->select(['post_content', 'data'])->where('ID', $formId)->get(); - - return empty($form->data); + return ! Utils::isV3Form($formId); } /** diff --git a/src/FormBuilder/Routes/EditFormRoute.php b/src/FormBuilder/Routes/EditFormRoute.php index 9122287d43..5050b99eca 100644 --- a/src/FormBuilder/Routes/EditFormRoute.php +++ b/src/FormBuilder/Routes/EditFormRoute.php @@ -3,6 +3,7 @@ namespace Give\FormBuilder\Routes; use Give\FormBuilder\FormBuilderRouteBuilder; +use Give\Helpers\Form\Utils; /** * Route to edit an existing form @@ -10,6 +11,7 @@ class EditFormRoute { /** + * @unreleased Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder * @since 3.0.0 * * @return void @@ -18,7 +20,7 @@ public function __invoke() { if (isset($_GET['post'], $_GET['action']) && 'edit' === $_GET['action']) { $post = get_post(abs($_GET['post'])); - if ('give_forms' === $post->post_type && $post->post_content) { + if ('give_forms' === $post->post_type && Utils::isV3Form($post->ID)) { wp_redirect(FormBuilderRouteBuilder::makeEditFormRoute($post->ID)); exit(); } From 587287fbe1152df9e123b955a935ca9f9b142b3e Mon Sep 17 00:00:00 2001 From: Glauber Silva Date: Fri, 20 Oct 2023 14:18:19 -0300 Subject: [PATCH 13/18] fix: return empty array instead of false --- src/MultiFormGoals/ProgressBar/Model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MultiFormGoals/ProgressBar/Model.php b/src/MultiFormGoals/ProgressBar/Model.php index de4f7a1bf5..52a6a875b6 100644 --- a/src/MultiFormGoals/ProgressBar/Model.php +++ b/src/MultiFormGoals/ProgressBar/Model.php @@ -38,6 +38,7 @@ public function __construct(array $args) /** * Get forms associated with Progress Bar * + * @unreleased Return empty array instead of false * @since 2.9.0 */ public function getForms(): array @@ -78,7 +79,7 @@ public function getForms(): array return $query->posts; } else { - return false; + return []; } } From a2bc9af1f1d326c2d518c563aba22d7f6eb767eb Mon Sep 17 00:00:00 2001 From: Angela Blake <35241639+angelablake@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:01:08 -0500 Subject: [PATCH 14/18] chore: prepare for 3.0.3 release --- give.php | 4 ++-- readme.txt | 5 ++++- src/DonationForms/FormPage/TemplateHandler.php | 2 +- src/DonationForms/Repositories/DonationFormRepository.php | 2 +- src/FormBuilder/Routes/EditFormRoute.php | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/give.php b/give.php index 90819819a0..8cc9b7f5e1 100644 --- a/give.php +++ b/give.php @@ -6,7 +6,7 @@ * Description: The most robust, flexible, and intuitive way to accept donations on WordPress. * Author: GiveWP * Author URI: https://givewp.com/ - * Version: 3.0.1 + * Version: 3.0.3 * Requires at least: 6.0 * Requires PHP: 7.2 * Text Domain: give @@ -391,7 +391,7 @@ private function setup_constants() { // Plugin version. if (!defined('GIVE_VERSION')) { - define('GIVE_VERSION', '3.0.1'); + define('GIVE_VERSION', '3.0.3'); } // Plugin Root File. diff --git a/readme.txt b/readme.txt index ec928249bc..05f66ff0de 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.2 -Stable tag: 3.0.1 +Stable tag: 3.0.3 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -262,6 +262,9 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri 10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on. == Changelog == += 3.0.3: October 20th, 2023 = +* Fix: Forms no longer have fatal errors on Elementor websites when the Display Content option is enabled + = 3.0.1: October 17th, 2023 = * Fix: Resolved a conflict with Matomo plugin that was causing a fatal error diff --git a/src/DonationForms/FormPage/TemplateHandler.php b/src/DonationForms/FormPage/TemplateHandler.php index 6c5ae01d45..8f286371d1 100644 --- a/src/DonationForms/FormPage/TemplateHandler.php +++ b/src/DonationForms/FormPage/TemplateHandler.php @@ -37,7 +37,7 @@ public function handle($template) } /** - * @unreleased Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder + * @since 3.0.3 Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder * @since 3.0.0 */ protected function isNextGenForm(): bool diff --git a/src/DonationForms/Repositories/DonationFormRepository.php b/src/DonationForms/Repositories/DonationFormRepository.php index c7db596e27..4e2dc185d5 100644 --- a/src/DonationForms/Repositories/DonationFormRepository.php +++ b/src/DonationForms/Repositories/DonationFormRepository.php @@ -478,7 +478,7 @@ function ($value, Closure $fail, string $key, array $values) use ($formId) { } /** - * @unreleased Use isV3Form() method instead of 'post_content' to check if it's a legacy form + * @since 3.0.3 Use isV3Form() method instead of 'post_content' to check if it's a legacy form * @since 3.0.0 */ public function isLegacyForm(int $formId): bool diff --git a/src/FormBuilder/Routes/EditFormRoute.php b/src/FormBuilder/Routes/EditFormRoute.php index 5050b99eca..a72aaff071 100644 --- a/src/FormBuilder/Routes/EditFormRoute.php +++ b/src/FormBuilder/Routes/EditFormRoute.php @@ -11,7 +11,7 @@ class EditFormRoute { /** - * @unreleased Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder + * @since 3.0.3 Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder * @since 3.0.0 * * @return void From c75f4f5900f4cb6860c5f37006fce7e47de911d5 Mon Sep 17 00:00:00 2001 From: Angela Blake <35241639+angelablake@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:52:25 -0500 Subject: [PATCH 15/18] chore: prepare for 3.0.3 release --- give.php | 4 ++-- readme.txt | 5 ++++- src/MultiFormGoals/ProgressBar/Model.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/give.php b/give.php index 61f79765a7..8cc9b7f5e1 100644 --- a/give.php +++ b/give.php @@ -6,7 +6,7 @@ * Description: The most robust, flexible, and intuitive way to accept donations on WordPress. * Author: GiveWP * Author URI: https://givewp.com/ - * Version: 3.0.2 + * Version: 3.0.3 * Requires at least: 6.0 * Requires PHP: 7.2 * Text Domain: give @@ -391,7 +391,7 @@ private function setup_constants() { // Plugin version. if (!defined('GIVE_VERSION')) { - define('GIVE_VERSION', '3.0.2'); + define('GIVE_VERSION', '3.0.3'); } // Plugin Root File. diff --git a/readme.txt b/readme.txt index a3ad65a791..a8de6b6aa4 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.2 -Stable tag: 3.0.2 +Stable tag: 3.0.3 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -262,6 +262,9 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri 10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on. == Changelog == += 3.0.3: October 20th, 2023 = +* Fix: Using the multi-form shortcode with the ids attribute no longer causes a fatal error + = 3.0.2: October 19th, 2023 = * Fix: Stripe per-form settings are included when migrating a form to the Visual Donation Form Builder * Fix: Gateways are properly separated in the settings page and Global Settings for Fee Recovery shows all gateways when you select per gateway diff --git a/src/MultiFormGoals/ProgressBar/Model.php b/src/MultiFormGoals/ProgressBar/Model.php index 52a6a875b6..22b1b87db2 100644 --- a/src/MultiFormGoals/ProgressBar/Model.php +++ b/src/MultiFormGoals/ProgressBar/Model.php @@ -38,7 +38,7 @@ public function __construct(array $args) /** * Get forms associated with Progress Bar * - * @unreleased Return empty array instead of false + * @since 3.0.3 Return empty array instead of false * @since 2.9.0 */ public function getForms(): array From 465f5686ea7d59ea6b26d86044ef9ca11f029314 Mon Sep 17 00:00:00 2001 From: Glauber Silva Date: Fri, 20 Oct 2023 16:14:14 -0300 Subject: [PATCH 16/18] refactor: use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus --- src/MultiFormGoals/MultiFormGoal/Shortcode.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MultiFormGoals/MultiFormGoal/Shortcode.php b/src/MultiFormGoals/MultiFormGoal/Shortcode.php index f3b2ddce89..aa8701380a 100644 --- a/src/MultiFormGoals/MultiFormGoal/Shortcode.php +++ b/src/MultiFormGoals/MultiFormGoal/Shortcode.php @@ -26,6 +26,7 @@ public function addShortcode() /** * Returns Shortcode markup * + * @unreleased Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus * @since 2.9.0 **/ public function renderCallback($attributes) @@ -49,7 +50,12 @@ public function renderCallback($attributes) $multiFormGoal = new MultiFormGoal( [ - 'ids' => array_map('_give_redirect_form_id', $attributes['ids']), + 'ids' => array_map( + static function ($id) { + _give_redirect_form_id($id); + }, + $attributes['ids'] + ), 'tags' => $attributes['tags'], 'categories' => $attributes['categories'], 'goal' => $attributes['goal'], From 4ed0ba960659efbb9514f572db3432414be9025e Mon Sep 17 00:00:00 2001 From: Angela Blake <35241639+angelablake@users.noreply.github.com> Date: Fri, 20 Oct 2023 17:51:45 -0500 Subject: [PATCH 17/18] chore: prepare for 3.0.3 release again --- src/MultiFormGoals/MultiFormGoal/Shortcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MultiFormGoals/MultiFormGoal/Shortcode.php b/src/MultiFormGoals/MultiFormGoal/Shortcode.php index aa8701380a..e3a12f35be 100644 --- a/src/MultiFormGoals/MultiFormGoal/Shortcode.php +++ b/src/MultiFormGoals/MultiFormGoal/Shortcode.php @@ -26,7 +26,7 @@ public function addShortcode() /** * Returns Shortcode markup * - * @unreleased Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus + * @since 3.0.3 Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus * @since 2.9.0 **/ public function renderCallback($attributes) From 3e9a81f1e7e146dcb3ce6378ee615f03396351c8 Mon Sep 17 00:00:00 2001 From: Jason Adams Date: Wed, 25 Oct 2023 10:33:51 -0600 Subject: [PATCH 18/18] Feature: Use currency control for goal amount (#7022) Co-authored-by: Jon Waldstein --- .../ViewModels/FormBuilderViewModel.php | 14 +++++++++--- .../form-builder/src/common/getWindowData.ts | 1 + .../src/settings/donation-goal/index.tsx | 22 ++++++++++++++----- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/FormBuilder/ViewModels/FormBuilderViewModel.php b/src/FormBuilder/ViewModels/FormBuilderViewModel.php index 3eea00928e..b3fa40ea25 100644 --- a/src/FormBuilder/ViewModels/FormBuilderViewModel.php +++ b/src/FormBuilder/ViewModels/FormBuilderViewModel.php @@ -87,12 +87,18 @@ public function isRecurringEnabled(): bool /** * @since 3.0.0 */ - public function getGoalTypeOption(string $value, string $label, string $description): array + public function getGoalTypeOption( + string $value, + string $label, + string $description, + bool $isCurrency = false + ): array { return [ 'value' => $value, 'label' => $label, 'description' => $description, + 'isCurrency' => $isCurrency, ]; } @@ -105,7 +111,8 @@ public function getGoalTypeOptions(): array $this->getGoalTypeOption( GoalType::AMOUNT, __('Amount Raised', 'give'), - __('The total amount raised for the form', 'give') + __('The total amount raised for the form', 'give'), + true ), $this->getGoalTypeOption( GoalType::DONATIONS, @@ -124,7 +131,8 @@ public function getGoalTypeOptions(): array $this->getGoalTypeOption( GoalType::AMOUNT_FROM_SUBSCRIPTIONS, __('Subscription Amount Raised', 'give'), - __('The total amount raised for the form through subscriptions', 'give') + __('The total amount raised for the form through subscriptions', 'give'), + true ), $this->getGoalTypeOption( GoalType::SUBSCRIPTIONS, diff --git a/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts b/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts index 557ff8a253..d15ace1536 100644 --- a/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts +++ b/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts @@ -14,6 +14,7 @@ type GoalTypeOption = { value: string; label: string; description: string; + isCurrency: boolean; }; /** diff --git a/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx b/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx index 4304686b89..c31b5b18af 100644 --- a/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx @@ -10,6 +10,7 @@ import { } from '@wordpress/components'; import debounce from 'lodash.debounce'; import {getFormBuilderWindowData} from '@givewp/form-builder/common/getWindowData'; +import {CurrencyControl} from '@givewp/form-builder/components/CurrencyControl'; const {goalTypeOptions} = getFormBuilderWindowData(); @@ -69,12 +70,21 @@ const DonationGoalSettings = () => { /> - dispatch(setFormSettings({goalAmount})), 100)} - /> + {selectedGoalType.isCurrency ? ( + dispatch(setFormSettings({goalAmount})), 500)} + /> + ) : ( + dispatch(setFormSettings({goalAmount}))} + /> + )} )}