diff --git a/Includes/Modules/CountdownTimer/assets/src/components/DesignTab.js b/Includes/Modules/CountdownTimer/assets/src/components/DesignTab.js index 934571a6..74bffcbf 100644 --- a/Includes/Modules/CountdownTimer/assets/src/components/DesignTab.js +++ b/Includes/Modules/CountdownTimer/assets/src/components/DesignTab.js @@ -21,28 +21,36 @@ function DesignTab( props ) { noop, options, handleSelect, + undoHandler, + showUndoIcon } = props; return ( @@ -53,20 +61,11 @@ function DesignTab( props ) { /> - - - {/**/} - {/*
*/} - {/* {options.map((option, index) => (*/} - {/* handleSelect(option.theme)}*/} - {/* isSelected={option.theme === formData.selected_theme}*/} - {/* />*/} - {/* ))}*/} - {/*
*/} - {/*
*/} +
); } diff --git a/Includes/Modules/CountdownTimer/assets/src/components/SalesCountdownLayout.js b/Includes/Modules/CountdownTimer/assets/src/components/SalesCountdownLayout.js index 9023c517..bffc7fb2 100644 --- a/Includes/Modules/CountdownTimer/assets/src/components/SalesCountdownLayout.js +++ b/Includes/Modules/CountdownTimer/assets/src/components/SalesCountdownLayout.js @@ -58,6 +58,7 @@ function SalesCountdownLayout({ navigate, useSearchParams ,moduleId}) { const onFormReset = () => { setFormData({ ...initialSalesCountdownData }); + setShowUndo( false ); }; const changeTab = (key) => { @@ -96,8 +97,10 @@ function SalesCountdownLayout({ navigate, useSearchParams ,moduleId}) { data: data, }) .success(() => { + setShowUndo(false); setButtonLoading(false); notificationMessage(type); + setUndoData({ ...formData }); }); }; @@ -116,6 +119,7 @@ function SalesCountdownLayout({ navigate, useSearchParams ,moduleId}) { .success((response) => { if (response.success) { setFormData({ ...formData, ...response.data }); + setUndoData({ ...undoData, ...response.data }); setTimeout(() => setPageLoading(false), 500); } }); @@ -129,8 +133,40 @@ function SalesCountdownLayout({ navigate, useSearchParams ,moduleId}) { onFieldChange("selected_theme", theme); }; + const [showUndo, setShowUndo] = useState({ + border_color : false, + heading_text_color : false, + widget_background_color : false + }); + + const [undoData, setUndoData] = useState({ + ...initialSalesCountdownData, + }); + + const colorKeyStack = [ + 'border_color', + 'heading_text_color', + 'widget_background_color' + ]; + const onFieldChange = (key, value) => { setFormData({ ...formData, [key]: value }); + if ( colorKeyStack?.includes( key ) ) { + setShowUndo({ ...showUndo, [key]: true }); + } + }; + + const onUndoClick = ( key ) => { + if ( colorKeyStack?.includes( key ) ) { + setShowUndo({ + ...showUndo, + [key]: false, + }); + setFormData({ + ...formData, + [key]: undoData?.[key], + }); + } }; const noop = () => {}; @@ -166,6 +202,8 @@ function SalesCountdownLayout({ navigate, useSearchParams ,moduleId}) { title: __("Design", "storegrowth-sales-booster"), panel: ( {showPreview && tabName && ( diff --git a/Includes/Modules/CountdownTimer/assets/src/components/Templates.js b/Includes/Modules/CountdownTimer/assets/src/components/Templates.js index c6530632..f899875e 100644 --- a/Includes/Modules/CountdownTimer/assets/src/components/Templates.js +++ b/Includes/Modules/CountdownTimer/assets/src/components/Templates.js @@ -7,7 +7,7 @@ import {applyFilters} from "@wordpress/hooks"; import RadioTemplate from "sales-booster/src/components/settings/Panels/PanelSettings/Fields/RadioTemplate"; import CountDownTwo from "./Templates/CountDownTwo"; -const Templates = ( { formData, setFormData } ) => { +const Templates = ( { formData, setFormData, showUndoIcon } ) => { let templates = [ { key: 'ct-layout-1', component: }, { key: 'ct-layout-2', component: }, @@ -41,6 +41,10 @@ const Templates = ( { formData, setFormData } ) => { ); const onTemplateChange = ( name, value ) => { + for ( let key in showUndoIcon ) { + showUndoIcon[key] = false; + } + setFormData( { ...formData, ...templateStyles?.[ value ] diff --git a/Includes/Modules/DirectCheckout/Includes/EnqueueScript.php b/Includes/Modules/DirectCheckout/Includes/EnqueueScript.php index 155affa9..615505a3 100644 --- a/Includes/Modules/DirectCheckout/Includes/EnqueueScript.php +++ b/Includes/Modules/DirectCheckout/Includes/EnqueueScript.php @@ -194,6 +194,13 @@ private function dc_button_inline_styles() { '; } - wp_add_inline_style( 'sgsb-button-style', $custom_css ); + wp_add_inline_style( + 'sgsb-button-style', + apply_filters( + 'sgsb_direct_checkout_button_inline_styles', + $custom_css, + $settings + ) + ); } } diff --git a/Includes/Modules/DirectCheckout/assets/src/components/Design.js b/Includes/Modules/DirectCheckout/assets/src/components/Design.js index 012603be..d5cff8eb 100644 --- a/Includes/Modules/DirectCheckout/assets/src/components/Design.js +++ b/Includes/Modules/DirectCheckout/assets/src/components/Design.js @@ -6,6 +6,8 @@ import Number from "../../../../../../assets/src/components/settings/Panels/Pane import ColourPicker from "../../../../../../assets/src/components/settings/Panels/PanelSettings/Fields/ColorPicker"; import ActionsHandler from "sales-booster/src/components/settings/Panels/PanelSettings/ActionsHandler"; import { createDirectCheckoutForm } from "../helper"; +import Switcher from "sales-booster/src/components/settings/Panels/PanelSettings/Fields/Switcher"; +import { applyFilters } from "@wordpress/hooks"; function Design({ onFormSave, upgradeTeaser }) { const { setCreateFromData } = useDispatch("sgsb_direct_checkout"); @@ -33,57 +35,76 @@ function Design({ onFormSave, upgradeTeaser }) { return ( - - + { Boolean( createDirectCheckoutFormData.button_style ) && ( + + - + - + + + + + { applyFilters( + "sgsb_after_direct_checkout_button_design_settings", + "", + createDirectCheckoutFormData, + onFieldChange, + ) } + + ) } { + const buttonStyles = applyFilters( + "sgsb_direct_checkout_button_preview_styles", + { + color : storeData?.text_color, + height : 'fit-content', + padding : '10px 30px', + fontSize : storeData?.font_size, + fontWeight : '600', + borderColor : storeData?.button_color, + borderRadius : storeData?.button_border_radius, + backgroundColor : storeData?.button_color + }, + storeData + ); + return (
- diff --git a/Includes/Modules/DirectCheckout/assets/src/helper.js b/Includes/Modules/DirectCheckout/assets/src/helper.js index 20d09c8b..cc649144 100644 --- a/Includes/Modules/DirectCheckout/assets/src/helper.js +++ b/Includes/Modules/DirectCheckout/assets/src/helper.js @@ -1,14 +1,21 @@ import { __ } from '@wordpress/i18n'; export const createDirectCheckoutForm = { - buy_now_button_setting: __( 'cart-with-buy-now', 'storegrowth-sales-booster' ), - buy_now_button_label: __( 'Buy Now', 'storegrowth-sales-booster' ), - checkout_redirect: 'legacy-checkout', - shop_page_checkout_enable: true, - product_page_checkout_enable: true, - button_color: "#008dff", - text_color: "#ffffff", - font_size: 16, - button_border_radius: 5, - generated_link:"example", + font_size : 16, + text_color : "#ffffff", + font_family : "poppins", + button_style : true, + button_color : "#008dff", + border_color : "#008dff", + border_width : 1, + paddingXaxis : 20, + paddingYaxis : 10, + generated_link : "example", + checkout_redirect : 'legacy-checkout', + button_border_style : "solid", + button_border_radius : 5, + buy_now_button_label : __( 'Buy Now', 'storegrowth-sales-booster' ), + buy_now_button_setting : __( 'cart-with-buy-now', 'storegrowth-sales-booster' ), + shop_page_checkout_enable : true, + product_page_checkout_enable : true, }; diff --git a/Includes/Modules/ProgressiveDiscountBanner/Includes/EnqueueScript.php b/Includes/Modules/ProgressiveDiscountBanner/Includes/EnqueueScript.php index 7a0e9d3e..9117deac 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/Includes/EnqueueScript.php +++ b/Includes/Modules/ProgressiveDiscountBanner/Includes/EnqueueScript.php @@ -81,6 +81,11 @@ public function admin_enqueue_scripts( $hook ) { $settings_file['version'], false ); + + // Pass the Cart URL to the JavaScript file + wp_localize_script('sgsb-pd-banner-settings', 'sgsbFsbData', array( + 'cartUrl' => wc_get_cart_url(), // WooCommerce Cart URL + )); } } diff --git a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DesignTab.js b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DesignTab.js index 1dd88277..7de427a1 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DesignTab.js +++ b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DesignTab.js @@ -11,6 +11,7 @@ import Templates from './Templates'; function DesignTab(props) { const { + isValid, formData, setFormData, onFieldChange, @@ -18,6 +19,8 @@ function DesignTab(props) { buttonLoading, fontFamily, onFormReset, + undoHandler, + showUndoIcon } = props; return ( @@ -50,41 +53,75 @@ function DesignTab(props) { ) } + { Boolean( formData.btn_style ) && ( + + + + + ) } - + ); diff --git a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DiscountBanner.js b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DiscountBanner.js index 0b927e78..d4acbf9b 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DiscountBanner.js +++ b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/DiscountBanner.js @@ -1,5 +1,6 @@ import { Fragment } from "react"; import { __ } from "@wordpress/i18n"; +import { useState } from "@wordpress/element"; import { applyFilters } from '@wordpress/hooks'; import SelectBox from "../../../../../../assets/src/components/settings/Panels/PanelSettings/Fields/SelectBox"; import Number from "../../../../../../assets/src/components/settings/Panels/PanelSettings/Fields/Number"; @@ -7,9 +8,11 @@ import TextAreaBox from "../../../../../../assets/src/components/settings/Panels import SettingsSection from "../../../../../../assets/src/components/settings/Panels/PanelSettings/SettingsSection"; import BarIcon from "./BarIcon"; import SettingInstruction from "./SettingInstruction"; +import Switcher from "sales-booster/src/components/settings/Panels/PanelSettings/Fields/Switcher"; +import TextInput from "sales-booster/src/components/settings/Panels/PanelSettings/Fields/TextInput"; function DiscountBanner(props) { - const { formData, setFormData, onFieldChange } = props; + const { isValid, formData, setFormData, setShowUndo, onFieldChange } = props; const barTypes = [ { @@ -57,13 +60,13 @@ function DiscountBanner(props) { { key: iconStyleName, value: } ) ); - const onBarChange = ( key, value ) => { setFormData( { ...formData, [ key ]: value, progressive_banner_custom_icon : '', } ); + setShowUndo( true ); }; return ( @@ -180,6 +183,50 @@ function DiscountBanner(props) { "storegrowth-sales-booster" )} /> + + + + { Boolean( formData.btn_style ) && ( + + + + + ) } { applyFilters( diff --git a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/FreeShippingBarLayout.js b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/FreeShippingBarLayout.js index ec5c1ec4..93922ddf 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/FreeShippingBarLayout.js +++ b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/FreeShippingBarLayout.js @@ -24,17 +24,22 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod let [searchParams, setSearchParams] = useSearchParams("general"); const tabName = searchParams.get("tab_name") || "general"; const initialShipData = { + btn_text : 'Cart', bar_type : "normal", user_type : "both", font_size : 20, + btn_style : true, + btn_color : "#ffffff", text_color : "#ffffff", icon_color : "#ffffff", + btn_target : sgsbFsbData?.cartUrl, font_family : "poppins", banner_delay : 7, bar_position : "top", bar_template : 'shipping_bar_one', discount_type : "free-shipping", banner_height : 60, + btn_text_color : "#073b4c", banner_trigger : "after-few-seconds", close_icon_color : "#ffffff", background_color : "#0875FF", @@ -55,6 +60,7 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod const onFormReset = () => { setFormData({ ...initialShipData }); + setShowUndo( false ); }; const fontFamily = [ @@ -97,6 +103,7 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod .success((response) => { if (response.success && response.data) { setFormData({ ...formData, ...response.data }); + setUndoData({ ...undoData, ...response.data }); setTimeout(() => setPageLoading(false), 500); } }); @@ -106,12 +113,68 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod getSettings(); }, []); + const [ isValidUrl, setIsValidUrl ] = useState( true ); + + const validateURL = ( input ) => { + const pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol + '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name + '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address + '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path + '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string + '(\\#[-a-z\\d_]*)?$','i'); // fragment locator + return !!pattern.test( input ); + }; + + const [showUndo, setShowUndo] = useState({ + btn_color : false, + text_color : false, + icon_color : false, + btn_text_color : false, + close_icon_color : false, + background_color : false, + }); + + const [undoData, setUndoData] = useState({ + ...initialShipData, + }); + + const colorKeyStack = [ + 'btn_color', + 'text_color', + 'icon_color', + 'btn_text_color', + 'close_icon_color', + 'background_color' + ]; + const onFieldChange = (key, value) => { + if ( key === 'btn_target' ) { + setIsValidUrl( validateURL( value ) ); + } + setFormData({ ...formData, [key]: value, }); + + if ( colorKeyStack?.includes( key ) ) { + setShowUndo({ ...showUndo, [key]: true }); + } }; + + const onUndoClick = ( key ) => { + if ( colorKeyStack?.includes( key ) ) { + setShowUndo({ + ...showUndo, + [key]: false, + }); + setFormData({ + ...formData, + [key]: undoData?.[key], + }); + } + }; + const changeTab = (key) => { navigate("/progressive-discount-banner?tab_name=" + key); }; @@ -148,8 +211,10 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod data, }) .success(() => { + setShowUndo(false); setButtonLoading(false); notificationMessage(type); + setUndoData({ ...formData }); }); }; @@ -160,7 +225,9 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod panel: ( onFormSave("banner_settings")} buttonLoading={buttonLoading} @@ -173,7 +240,10 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod title: __("Design", "storegrowth-sales-booster"), panel: ( onFormSave("design")} @@ -195,10 +265,12 @@ function FreeShippingBarLayout({ outlet: Outlet, navigate, useSearchParams , mod {showPreview && tabName && ( diff --git a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Preview.js b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Preview.js index b69fd311..9e57907f 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Preview.js +++ b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Preview.js @@ -1,6 +1,7 @@ import React from 'react'; import BarIcon from "./BarIcon"; import {__} from "@wordpress/i18n"; +import {extractedTitle} from "sales-booster/src/utils/helper"; const Preview = ( { isProActive, formData, fontFamily } ) => { const bannerStyle = { @@ -59,8 +60,24 @@ const Preview = ( { isProActive, formData, fontFamily } ) => { fontSize: formData.font_size, }} > - {dynamicText} + { Boolean( formData.btn_style ) ? extractedTitle( dynamicText, 19 ) : dynamicText } + { Boolean( formData.btn_style ) && ( + + { extractedTitle( formData?.btn_text, 15 ) } + + ) }
{ }} onClick={() => window.open( - "https://storegrowth.io/docs/free-shipping-bar/", + "https://storegrowth.io/docs/free-shipping-bar-setting/", "_blank" ) } > - Documentaion + Documentation
diff --git a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/SettingsTab.js b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/SettingsTab.js index 3f71d143..3b3ededb 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/SettingsTab.js +++ b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/SettingsTab.js @@ -6,19 +6,23 @@ import {Fragment} from "react"; function SettingsTab(props) { const { + isValid, formData, setFormData, onFieldChange, onFormSave, buttonLoading, - onFormReset + onFormReset, + setShowUndo } = props; return ( @@ -26,7 +30,7 @@ function SettingsTab(props) {

Note: Please clear your cart in order to see the updates when you update diff --git a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates.js b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates.js index 082cc2bb..fb2c6fd2 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates.js +++ b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates.js @@ -6,7 +6,7 @@ import ShippingBarOne from "./Templates/ShippingBarOne"; import {applyFilters} from "@wordpress/hooks"; import RadioTemplate from "sales-booster/src/components/settings/Panels/PanelSettings/Fields/RadioTemplate"; -const Templates = ( { formData, setFormData } ) => { +const Templates = ( { formData, setFormData, showUndoIcon } ) => { let templates = [ { key: 'shipping_bar_one', component: }, ]; @@ -19,12 +19,17 @@ const Templates = ( { formData, setFormData } ) => { let templateStyles = { shipping_bar_one: { + btn_text : __( 'Cart', 'storegrowth-sales-booster' ), font_size : 20, + btn_style : true, + btn_color : "#ffffff", text_color : "#ffffff", icon_color : "#ffffff", + btn_target : sgsbFsbData?.cartUrl, font_family : "poppins", bar_template : 'shipping_bar_one', banner_height : 60, + btn_text_color : "#073b4c", close_icon_color : "#ffffff", background_color : "#0875FF", cart_minimum_amount : 10, @@ -41,6 +46,10 @@ const Templates = ( { formData, setFormData } ) => { ); const onTemplateChange = ( name, value ) => { + for ( let key in showUndoIcon ) { + showUndoIcon[key] = false; + } + setFormData( { ...formData, ...templateStyles?.[ value ] diff --git a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates/ShippingBarOne.js b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates/ShippingBarOne.js index 6c241896..47b8d797 100644 --- a/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates/ShippingBarOne.js +++ b/Includes/Modules/ProgressiveDiscountBanner/assets/src/components/Templates/ShippingBarOne.js @@ -1,5 +1,6 @@ import React from "react"; import { __ } from "@wordpress/i18n"; +import { extractedTitle } from "sales-booster/src/utils/helper"; const ShippingBarOne = () => { return ( @@ -73,9 +74,23 @@ const ShippingBarOne = () => { position : 'relative', }} > - { __( 'Add more $10 to get FREE SHIPPING.', 'storegrowth-sales-booster' ) } + { __( 'Add more $10 to get...', 'storegrowth-sales-booster' ) } + + { __( 'Cart', 'storegrowth-sales-booster' ) } +

@@ -59,16 +64,24 @@
- +
+ + /** + * Banner text filter. + * + * @since 1.0.0 + */ + echo wp_kses_post( apply_filters( 'sales_boster_pd_banner_text', $banner_text ) ); + ?> + + + + + +
diff --git a/Includes/Modules/UpsellOrderBump/Includes/OrderBump.php b/Includes/Modules/UpsellOrderBump/Includes/OrderBump.php index 844c570e..549fc74d 100644 --- a/Includes/Modules/UpsellOrderBump/Includes/OrderBump.php +++ b/Includes/Modules/UpsellOrderBump/Includes/OrderBump.php @@ -43,7 +43,6 @@ public function bump_product_frontend_view() { 'posts_per_page' => -1, ); $bump_list = get_posts( $args_bump ); - $showed_bump_product_id = array(); foreach ( $all_cart_products as $value ) { $cat_ids = $value['data']->get_category_ids(); @@ -91,29 +90,19 @@ public function bump_product_frontend_view() { // don't show the offer if the 'offer product' is already added in the cart from the shop page with regular price. continue; } - if ( - $bump_info->target_products - && - count( $all_cart_product_ids ) !== count( array_diff( $all_cart_product_ids, $bump_info->target_products ) ) - && - ! in_array( $offer_product_id, $showed_bump_product_id, true ) - ) { - include __DIR__ . '/../templates/bump-product-front-view.php'; - - $showed_bump_product_id[] = $offer_product_id; - } - - if ( - isset( $bump_info->target_categories ) - && count( $all_cart_category_ids ) !== count( array_diff( $all_cart_category_ids, $bump_info->target_categories ) ) - && ! in_array( $offer_product_id, $showed_bump_product_id, true ) - ) { - - include __DIR__ . '/../templates/bump-product-front-view.php'; - - $showed_bump_product_id[] = $offer_product_id; - } + $bump_type = ! empty( $bump_info->bump_type ) ? esc_html( $bump_info->bump_type ) : 'products'; + if ( $bump_type === 'products' ) { + $target_products = ! empty( $bump_info->target_products ) ? wc_clean( $bump_info->target_products ) : array(); + if ( $target_products && ( count( $all_cart_product_ids ) !== count( array_diff( $all_cart_product_ids, $target_products ) ) ) ) { + include __DIR__ . '/../templates/bump-product-front-view.php'; + } + } else { + $target_categories = ! empty( $bump_info->target_categories ) ? wc_clean( $bump_info->target_categories ) : array(); + if ( $target_categories && ( count( $all_cart_category_ids ) !== count( array_diff( $all_cart_category_ids, $target_categories ) ) ) ) { + include __DIR__ . '/../templates/bump-product-front-view.php'; + } + } } } diff --git a/Includes/Modules/UpsellOrderBump/assets/src/components/BasicInfo.js b/Includes/Modules/UpsellOrderBump/assets/src/components/BasicInfo.js index 252436ce..46fc6fde 100644 --- a/Includes/Modules/UpsellOrderBump/assets/src/components/BasicInfo.js +++ b/Includes/Modules/UpsellOrderBump/assets/src/components/BasicInfo.js @@ -11,6 +11,7 @@ import MultiSelectBox from "sales-booster/src/components/settings/Panels/PanelSe import SectionHeader from "sales-booster/src/components/settings/Panels/SectionHeader"; import SelectBox from "sales-booster/src/components/settings/Panels/PanelSettings/Fields/SelectBox"; import OfferField from "./OfferField"; +import TextRadioBox from "sales-booster/src/components/settings/Panels/PanelSettings/Fields/TextRadioBox"; const BasicInfo = ({ clearErrors }) => { @@ -108,6 +109,11 @@ const BasicInfo = ({ clearErrors }) => { } }; + const orderBumpDeal = [ + { key: 'products', value: __('Products', 'storegrowth-sales-booster') }, + { key: 'categories', value: __('Categories', 'storegrowth-sales-booster') }, + ]; + return ( @@ -122,36 +128,48 @@ const BasicInfo = ({ clearErrors }) => { "storegrowth-sales-booster" )} /> - - + {createBumpData?.bump_type !== "categories" ? ( + + ) : ( + + )} - {productList && ( +function TargetProductAndCategory({ type, catList, productList }) { + return ( + + {type === 'products' && productList && (
{__("Target Products", "storegrowth-sales-booster")}
@@ -136,7 +136,7 @@ function TargetProductAndCategory({ catList, productList }) {
)} - {catList && ( + {type === 'categories' && catList && (
{__("Target Categories", "storegrowth-sales-booster")}
@@ -146,7 +146,7 @@ function TargetProductAndCategory({ catList, productList }) {
)} - + ); } @@ -186,7 +186,7 @@ function OrderBumpList({ navigate }) { align: "left", }, { - title: "Target Product(s) and Categories", + title: "Target Product(s) or Categories", dataIndex: "product_category", }, { @@ -230,10 +230,10 @@ function OrderBumpList({ navigate }) { key: item, name: item.name_of_order_bump, product_category: ( - + ), offers: , - action: , + action: , }; } diff --git a/Includes/Modules/UpsellOrderBump/assets/src/helper.js b/Includes/Modules/UpsellOrderBump/assets/src/helper.js index 652c42da..d2fccb17 100644 --- a/Includes/Modules/UpsellOrderBump/assets/src/helper.js +++ b/Includes/Modules/UpsellOrderBump/assets/src/helper.js @@ -65,6 +65,7 @@ export const createBumpForm = { smart_offer: false, offer_product: '', offer_type: [], + bump_type: 'products', offer_amount: '', box_border_style: 'solid', box_border_color: '#32DBBE', diff --git a/assets/src/admin.scss b/assets/src/admin.scss index 3cb0f83f..9b1ec54d 100644 --- a/assets/src/admin.scss +++ b/assets/src/admin.scss @@ -2033,6 +2033,15 @@ End Settings Sidebar .settings-panel { margin-right: 32px; + .dashicons { + color: #0875ff; + cursor: pointer; + &.dashicons-undo { + color: #0875ff; + cursor: pointer; + } + } + .sgsb-settings-card { height: 100%; border-radius: 5px; @@ -2265,6 +2274,10 @@ End Settings Sidebar &.field-gap { margin-bottom: 15px; } + + &.error { + border-color: red; + } } &.textarea-field { @@ -3120,4 +3133,4 @@ End Settings Sidebar font-size: 14px; } } -} \ No newline at end of file +} diff --git a/assets/src/components/pro-previews/Modules/DirectCheckout/index.js b/assets/src/components/pro-previews/Modules/DirectCheckout/index.js index 7754d198..4064cd21 100644 --- a/assets/src/components/pro-previews/Modules/DirectCheckout/index.js +++ b/assets/src/components/pro-previews/Modules/DirectCheckout/index.js @@ -2,6 +2,10 @@ import { __ } from '@wordpress/i18n'; import { addFilter } from '@wordpress/hooks'; import TextInput from "../../../settings/Panels/PanelSettings/Fields/TextInput"; import SingleCheckBox from "../../../settings/Panels/PanelSettings/Fields/SingleCheckBox"; +import {Fragment} from "react"; +import {SelectBox} from "../../../settings/Panels"; +import InputNumber from "../../../settings/Panels/PanelSettings/Fields/Number"; +import ColourPicker from "../../../settings/Panels/PanelSettings/Fields/ColorPicker"; // Handle direct checkout modules pro settings prompts. addFilter( @@ -95,3 +99,98 @@ addFilter( ); } ); +addFilter( + 'sgsb_after_direct_checkout_button_design_settings', + 'sgsb_after_direct_checkout_button_design_settings_callback', + () => { + const fontFamily = [ + { + value: 'poppins', + label: __('Poppins', 'storegrowth-sales-booster'), + } + ]; + + const borders = [ + { value: 'dotted', label: __( 'Dotted', 'storegrowth-sales-booster' ) } + ]; + + return ( + + + + + + + + + + + + + + ); + } +); diff --git a/assets/src/components/pro-previews/Modules/SalesPop/index.js b/assets/src/components/pro-previews/Modules/SalesPop/index.js index 6a501df2..331c8d93 100644 --- a/assets/src/components/pro-previews/Modules/SalesPop/index.js +++ b/assets/src/components/pro-previews/Modules/SalesPop/index.js @@ -7,7 +7,7 @@ import InputNumber from '../../../settings/Panels/PanelSettings/Fields/Number'; import TextAreaBox from '../../../settings/Panels/PanelSettings/Fields/TextAreaBox'; import SettingsSection from '../../../settings/Panels/PanelSettings/SettingsSection'; import ColourPicker from "../../../settings/Panels/PanelSettings/Fields/ColorPicker"; -import VisibilityControl from 'sales-booster-sales-notification/src/components/VisibilityControl'; +import VisibilityControl from '../../../../../../Includes/Modules/SalesPop/assets/src/components/VisibilityControl'; // Handle sales pop modules pro settings prompts. addFilter( diff --git a/assets/src/components/settings/Panels/PanelSettings/Fields/ColorPicker.js b/assets/src/components/settings/Panels/PanelSettings/Fields/ColorPicker.js index 2fc1b48c..92fa9334 100644 --- a/assets/src/components/settings/Panels/PanelSettings/Fields/ColorPicker.js +++ b/assets/src/components/settings/Panels/PanelSettings/Fields/ColorPicker.js @@ -10,10 +10,12 @@ const ColourPicker = ( { name, title, tooltip, + undoHandler, changeHandler, colSpan = 24, fieldValue = '#82B9FF', - needUpgrade = false + needUpgrade = false, + showUndoIcon = false, } ) => { const colors = [ '#000000', @@ -64,16 +66,26 @@ const ColourPicker = ( {
- {/* Handle settings color-picker field by using dynamic props */} - changeHandler( name, hex ) } - /> +
+ { showUndoIcon && undoHandler( name ) } className="dashicons dashicons-undo"> } + {/* Handle settings color-picker field by using dynamic props */} + changeHandler(name, hex)} + /> +
- { needUpgrade && } + {needUpgrade && } ); } diff --git a/assets/src/components/settings/Panels/PanelSettings/Fields/TextInput.js b/assets/src/components/settings/Panels/PanelSettings/Fields/TextInput.js index d93e59ce..84dcf203 100644 --- a/assets/src/components/settings/Panels/PanelSettings/Fields/TextInput.js +++ b/assets/src/components/settings/Panels/PanelSettings/Fields/TextInput.js @@ -9,9 +9,11 @@ const TextInput = ( { name, title, tooltip, + className, fieldValue, changeHandler, placeHolderText, + type = 'text', colSpan = 24, fullWidth = false, needUpgrade = false @@ -34,10 +36,11 @@ const TextInput = ( { {/* Handle settings textarea field by using dynamic props */} changeHandler( name, event.target.value ) } /> diff --git a/assets/src/components/settings/Panels/PanelSettings/TabPanels.js b/assets/src/components/settings/Panels/PanelSettings/TabPanels.js index 38c22562..13e12a99 100644 --- a/assets/src/components/settings/Panels/PanelSettings/TabPanels.js +++ b/assets/src/components/settings/Panels/PanelSettings/TabPanels.js @@ -5,7 +5,11 @@ const { TabPane } = Tabs; const TabPanels = ( { tabPanels, activeTab, changeHandler, classes } ) => { return ( // Handle settings tab & panels preview by using props. - + { tabPanels && tabPanels?.map( tab => ( { tab?.panel } diff --git a/assets/src/components/settings/Panels/PanelSettings/index.js b/assets/src/components/settings/Panels/PanelSettings/index.js index 9ad8f17f..cfe819f4 100644 --- a/assets/src/components/settings/Panels/PanelSettings/index.js +++ b/assets/src/components/settings/Panels/PanelSettings/index.js @@ -5,7 +5,7 @@ const PanelSettings = ( { tabPanels, activeTab, changeHandler, - colSpan = 12 + colSpan = 12, } ) => { return ( // Handle settings column width dynamically by using colSpan. @@ -14,8 +14,8 @@ const PanelSettings = ( { );