@@ -298,11 +275,13 @@ function Modules() {
handleModuleActivation={handleModuleActivation}
/>
)}
-
-
Date: Tue, 16 Jan 2024 18:34:12 +0600
Subject: [PATCH 02/25] enhance(project): module initial page is set.
Description:
In this commit the initial setup page is being added and the redirection is also being added.
resolves: Initial setup page addition #361
---
Includes/Admin/AdminMenu.php | 18 +
assets/menu-scripts/admin-menu.js | 31 +-
assets/src/admin.scss | 705 ++++++++----------
.../initail-setup/ContentLayout.jsx | 24 +-
.../initail-setup/IniSetupLayout.jsx | 30 +-
.../src/components/initail-setup/Progress.jsx | 10 +-
assets/src/components/initail-setup/Ready.jsx | 83 ++-
.../src/components/initail-setup/Welcome.jsx | 4 +-
assets/src/components/modules/Layout.js | 24 +-
assets/src/components/modules/ModuleRoutes.js | 17 +
assets/src/components/settings/Layout.js | 1 -
assets/src/modules.js | 4 +-
assets/src/utils/helper.js | 18 +
13 files changed, 544 insertions(+), 425 deletions(-)
create mode 100644 assets/src/components/modules/ModuleRoutes.js
diff --git a/Includes/Admin/AdminMenu.php b/Includes/Admin/AdminMenu.php
index 87d2d44b..f9c841e9 100644
--- a/Includes/Admin/AdminMenu.php
+++ b/Includes/Admin/AdminMenu.php
@@ -99,6 +99,15 @@ public function register_admin_menu() {
array( $this, 'handle_external_redirects' )
);
+ add_submenu_page(
+ 'sales-booster-for-woocommerce',
+ __( 'Initial Setup - StoreGrowth', 'storegrowth-sales-booster' ),
+ __( 'Initial Setup', 'storegrowth-sales-booster' ),
+ 'manage_options',
+ 'sgsb-modules#/ini-setup',
+ array( $this, 'initial_setup_page_callback' )
+ );
+
if ( ! SGSB_PRO_ACTIVE ) {
add_submenu_page(
'sales-booster-for-woocommerce',
@@ -137,6 +146,15 @@ public function dashboard_callback() {
exit;
}
+ /**
+ * Display Initail Setup page content.
+ */
+ public function initial_setup_page_callback() {
+ $redirect_url = admin_url( 'admin.php?page=sgsb-modules#/ini-setup' );
+ wp_safe_redirect( $redirect_url );
+ exit;
+ }
+
/**
* Redirect to a specific URL.
*
diff --git a/assets/menu-scripts/admin-menu.js b/assets/menu-scripts/admin-menu.js
index 5b568449..bd9ae298 100644
--- a/assets/menu-scripts/admin-menu.js
+++ b/assets/menu-scripts/admin-menu.js
@@ -4,16 +4,18 @@
// *************************************
// Add target blank for upgrade button
// *************************************
- $("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (e) {
+ $("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (
+ e
+ ) {
if ($(this).attr("href").indexOf("?page=go-sgsb-pro") > 0) {
$(this).attr("target", "_blank");
// Add hover effect
$(this).hover(
- function() {
- $(this).css('color', 'yellowgreen');
+ function () {
+ $(this).css("color", "yellowgreen");
},
- function() {
- $(this).css('color', ''); // Revert to original color on hover out
+ function () {
+ $(this).css("color", ""); // Revert to original color on hover out
}
);
}
@@ -22,4 +24,23 @@
}
});
+ // *************************************
+ // Target the admin menu and remove it
+ // *************************************
+
+ let currentPath = window.location.hash;
+ console.log(currentPath);
+ if ("#/ini-setup" === currentPath || "#ini-setup" === currentPath) {
+ console.log("from jquery");
+ $("#wpadminbar , #adminmenumain").remove();
+
+ $(".wp-toolbar").css({
+ padding: "0", // Replace with your desired background color
+ });
+ $("#wpcontent, #wpfooter").css({
+ marginLeft:"0",
+ background: "#fff", // Replace with your desired background color
+ });
+ $(".notice").remove();
+ }
})(jQuery);
diff --git a/assets/src/admin.scss b/assets/src/admin.scss
index 655c9614..2a0c8171 100644
--- a/assets/src/admin.scss
+++ b/assets/src/admin.scss
@@ -10,20 +10,19 @@ $white-color: #ffffff;
}
}
-
// Usage
-@include font-face('IBM Plex Sans', '../fonts/IBM_Plex_Sans/IBMPlexSans-Regular.ttf');
-@include font-face('Lato', '../fonts/Lato/Lato-Regular.ttf');
-@include font-face('Montserrat', '../fonts/Montserrat/Montserrat-Regular.ttf');
-@include font-face('Poppins', '../fonts/Poppins/Poppins-Regular.ttf');
-@include font-face('Roboto', '../fonts/Roboto/Roboto-Regular.ttf');
-
+@include font-face("IBM Plex Sans",
+ "../fonts/IBM_Plex_Sans/IBMPlexSans-Regular.ttf"
+);
+@include font-face("Lato", "../fonts/Lato/Lato-Regular.ttf");
+@include font-face("Montserrat", "../fonts/Montserrat/Montserrat-Regular.ttf");
+@include font-face("Poppins", "../fonts/Poppins/Poppins-Regular.ttf");
+@include font-face("Roboto", "../fonts/Roboto/Roboto-Regular.ttf");
.sgsb-header {
padding: 0 20px !important;
display: inline-flex;
align-items: center;
-
}
.sgsb-logo {
@@ -35,7 +34,6 @@ $white-color: #ffffff;
// height: 36px;
margin: 24px auto 10px;
text-align: center;
-
}
.sgsb-heading[class] {
@@ -51,21 +49,18 @@ Module Card Style
#sbooster-modules-page {
.ant-layout-header {
padding: 0;
-
}
.ant-layout-header,
.ant-layout-sider {
background: #ffffff;
-
}
-
}
.site-card-wrapper {
.sgsb-module-card {
border-radius: 10px;
- background: #FFF;
+ background: #fff;
.ant-card-body {
padding: 0;
@@ -79,7 +74,7 @@ Module Card Style
height: auto;
line-height: inherit;
padding: 8px 18px 7px 15px !important;
- border: 1px solid #B2DDFF;
+ border: 1px solid #b2ddff;
position: relative;
.anticon {
@@ -106,20 +101,17 @@ Module Card Style
.switch-btn {
@media (min-width: 768px) and (max-width: 1024px) {
float: none !important;
-
}
-
}
.ant-switch {
- background: #638DC1;
+ background: #638dc1;
width: 46px;
height: 25px;
margin-left: -10px;
@media (min-width: 768px) and (max-width: 1024px) {
margin-left: 0 !important;
-
}
.ant-switch-handle {
@@ -128,7 +120,7 @@ Module Card Style
}
&.ant-switch-checked {
- background: #2C81FF;
+ background: #2c81ff;
.ant-switch-handle {
left: calc(100% - 18px - 4px);
@@ -138,7 +130,7 @@ Module Card Style
.module-thumb {
border-radius: 35px;
- background: #E7F3FF;
+ background: #e7f3ff;
padding: 14px;
margin-right: 11px;
width: 64px;
@@ -146,36 +138,32 @@ Module Card Style
display: inline-flex;
align-items: center;
justify-content: center;
-
}
.module-name {
- color: #073B4C;
+ color: #073b4c;
font-size: 20px;
font-style: normal;
font-weight: 600;
line-height: 29px;
-
}
.module-desc {
- color: #757C7E;
+ color: #757c7e;
font-weight: 400;
font-size: 16px;
line-height: 28px;
padding: 17px 40px 51px 23px;
min-height: 180px;
-
}
.sgsb__module-footer {
- background: #DDF0FF;
+ background: #ddf0ff;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
@media (max-width: 767px) {
padding: 19px 8px 19px !important;
-
}
.ant-space {
@@ -183,7 +171,6 @@ Module Card Style
.doc-btn {
display: flex;
gap: 10px;
-
}
.switch-btn {
@@ -196,7 +183,6 @@ Module Card Style
display: flex;
justify-content: space-between;
width: 100%;
-
}
@media (min-width: 768px) and (max-width: 1024px) {
@@ -205,31 +191,26 @@ Module Card Style
&>div {
// gap : 3px !important;
-
}
a {
// font-size: 11px !important;
}
-
}
.footer-btn[class] {
- color: #073B4C;
+ color: #073b4c;
font-size: 16px;
font-weight: 400;
border-radius: 8px;
- border: 1px solid #B2DDFF;
- background: #FFF;
+ border: 1px solid #b2ddff;
+ background: #fff;
&:hover {
- color: #0875FF;
- border: 1px solid #B2DDFF;
-
+ color: #0875ff;
+ border: 1px solid #b2ddff;
}
-
}
-
}
}
}
@@ -243,11 +224,10 @@ Pagination Style
height: 47px;
line-height: 45px;
border-radius: 4px;
- border: 1px solid #B2DDFF;
+ border: 1px solid #b2ddff;
.ant-pagination-item-link {
border: 0;
-
}
}
@@ -265,21 +245,17 @@ Pagination Style
color: #fff;
background: #008dff;
border-radius: 4px;
-
}
}
}
}
.sgsb-search-section {
-
.search-bar {
-
padding-right: 10px;
@media (max-width: 520px) {
margin-bottom: 20px;
-
}
&.active {
@@ -287,11 +263,10 @@ Pagination Style
display: block;
width: 250px;
border-right: none;
- transition: .3s linear 0s;
+ transition: 0.3s linear 0s;
@media (max-width: 520px) {
width: 73%;
-
}
.ant-input-group-wrapper {
@@ -300,35 +275,28 @@ Pagination Style
display: flex;
}
}
-
}
-
}
.ant-input-group-addon {
border-left-width: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
-
}
-
-
}
-
-
}
input[class] {
- background: #F6F9FF;
+ background: #f6f9ff;
border-radius: 8px;
border: 0;
height: 46px;
width: 0;
outline: none;
display: none;
- border: 1px solid #B2DDFF;
+ border: 1px solid #b2ddff;
border-right-width: 0;
- transition: .3s linear 0s;
+ transition: 0.3s linear 0s;
&:focus {
box-shadow: none;
@@ -336,11 +304,11 @@ Pagination Style
}
.ant-input-group-addon[class] {
- background-color: #F6F9FF;
- border: 1px solid #B2DDFF;
+ background-color: #f6f9ff;
+ border: 1px solid #b2ddff;
padding: 4px 10px 0 15px;
border-radius: 8px;
- color: #073B4C;
+ color: #073b4c;
font-size: 20px;
cursor: pointer;
width: 46px;
@@ -348,7 +316,6 @@ Pagination Style
// display: flex;
align-items: center;
justify-content: center;
-
}
.ant-select-selector[class] {
@@ -468,22 +435,18 @@ main.ant-layout-content.sgsb-module-setting-layout {
@media (max-width: 767px) {
display: block;
-
}
@media (min-width: 1500px) {
// gap: 20px;
-
}
@media (min-width: 768px) and (max-width: 1024px) {
// gap: 10px;
-
}
@media (min-width: 1500px) and (max-width: 2000px) {
// gap: 20px;
-
}
&-sideabr {
@@ -491,13 +454,11 @@ main.ant-layout-content.sgsb-module-setting-layout {
@media (min-width: 1800px) {
// padding: 0 22px;
-
}
@media (max-width: 767px) {
padding-top: 2px;
margin-bottom: 40px;
-
}
h3 {
@@ -517,7 +478,7 @@ main.ant-layout-content.sgsb-module-setting-layout {
&:before {
content: "";
position: absolute;
- background: #0875FF;
+ background: #0875ff;
width: 3px;
height: 28px;
right: 3px;
@@ -527,7 +488,7 @@ main.ant-layout-content.sgsb-module-setting-layout {
svg {
rect {
- fill: #0875FF;
+ fill: #0875ff;
}
}
}
@@ -535,7 +496,6 @@ main.ant-layout-content.sgsb-module-setting-layout {
@media (min-width: 1500px) {
// padding: 50px 8px 40px;
-
}
svg {
@@ -545,7 +505,7 @@ main.ant-layout-content.sgsb-module-setting-layout {
.all-widgets-menu {
h4 {
- color: #073B4C;
+ color: #073b4c;
font-size: 16px;
font-weight: 600;
display: flex;
@@ -558,7 +518,7 @@ main.ant-layout-content.sgsb-module-setting-layout {
&:hover:before {
content: "";
position: absolute;
- background: #0875FF;
+ background: #0875ff;
width: 3px;
height: 28px;
right: 3px;
@@ -566,16 +526,13 @@ main.ant-layout-content.sgsb-module-setting-layout {
border-bottom-left-radius: 10px;
}
-
@media (min-width: 1500px) {
// padding: 0 12px 20px 8px;
-
}
span {
margin-left: auto;
cursor: pointer;
-
}
.ant-menu-title-content {
@@ -584,7 +541,6 @@ main.ant-layout-content.sgsb-module-setting-layout {
display: flex;
}
}
-
}
.widgets-menu {
@@ -596,7 +552,6 @@ main.ant-layout-content.sgsb-module-setting-layout {
@media (min-width: 1800px) {
// padding: 0 22px;
padding: 0 42px 0 0;
-
}
&.ant-menu-hidden {
@@ -608,7 +563,7 @@ main.ant-layout-content.sgsb-module-setting-layout {
}
.sgsb-selected-module {
- background: #0875FF;
+ background: #0875ff;
color: #ffffff !important;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
@@ -620,13 +575,11 @@ main.ant-layout-content.sgsb-module-setting-layout {
@media (min-width: 1500px) {
// padding: 12px 0px 12px 34px;
-
}
&:hover {
a {
color: #ffffff;
-
}
}
@@ -642,166 +595,141 @@ main.ant-layout-content.sgsb-module-setting-layout {
@media (min-width: 1500px) {
// left: 8px;
-
}
-
}
&.fly-cart {
&:before {
content: "";
- background: url('../images/menu/quick-cart-icon.svg');
-
+ background: url("../images/menu/quick-cart-icon.svg");
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/quick-cart-icon-white.svg');
-
+ background: url("../images/menu/quick-cart-icon-white.svg");
}
-
}
}
&.progressive-discount-banner {
&:before {
content: "";
- background: url('../images/menu/free-shipping-bar-icon.svg');
+ background: url("../images/menu/free-shipping-bar-icon.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/free-shipping-bar-icon-white.svg');
+ background: url("../images/menu/free-shipping-bar-icon-white.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
}
-
}
}
&.floating-notification-bar {
&:before {
content: "";
- background: url('../images/menu/floating-bar.svg');
+ background: url("../images/menu/floating-bar.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/floating-bar-white.svg');
+ background: url("../images/menu/floating-bar-white.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
}
-
}
}
&.sales-pop {
&:before {
content: "";
- background: url('../images/menu/sales-pop.svg');
+ background: url("../images/menu/sales-pop.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/sales-pop-white.svg');
-
+ background: url("../images/menu/sales-pop-white.svg");
}
-
}
}
&.countdown-timer {
&:before {
content: "";
- background: url('../images/menu/countdown-timer.svg');
+ background: url("../images/menu/countdown-timer.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/countdown-timer-white.svg');
-
+ background: url("../images/menu/countdown-timer-white.svg");
}
-
}
}
&.upsell-order-bump {
&:before {
content: "";
- background: url('../images/menu/upsel.svg');
+ background: url("../images/menu/upsel.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/upsel-white.svg');
-
+ background: url("../images/menu/upsel-white.svg");
}
-
}
}
&.direct-checkout {
&:before {
content: "";
- background: url('../images/menu/direct-checkout.svg');
+ background: url("../images/menu/direct-checkout.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/direct-checkout-white.svg');
-
+ background: url("../images/menu/direct-checkout-white.svg");
}
-
}
}
&.stock-bar {
&:before {
content: "";
- background: url('../images/menu/stock-bar.svg');
+ background: url("../images/menu/stock-bar.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/stock-bar-white.svg');
-
+ background: url("../images/menu/stock-bar-white.svg");
}
-
}
}
-
}
a {
- color: #757D9E;
+ color: #757d9e;
padding-top: 12px;
padding-bottom: 12px;
text-decoration: none;
@@ -823,62 +751,57 @@ main.ant-layout-content.sgsb-module-setting-layout {
}
&.fly-cart::before {
- background: url('../images/menu/quick-cart-icon-white.svg');
+ background: url("../images/menu/quick-cart-icon-white.svg");
}
&.progressive-discount-banner::before {
- background: url('../images/menu/free-shipping-bar-icon-white.svg');
+ background: url("../images/menu/free-shipping-bar-icon-white.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
}
&.floating-notification-bar::before {
- background: url('../images/menu/floating-bar-white.svg');
+ background: url("../images/menu/floating-bar-white.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
}
&.sales-pop::before {
- background: url('../images/menu/sales-pop-white.svg');
+ background: url("../images/menu/sales-pop-white.svg");
}
&.direct-checkout::before {
- background: url('../images/menu/direct-checkout-white.svg');
+ background: url("../images/menu/direct-checkout-white.svg");
}
&.stock-bar::before {
- background: url('../images/menu/stock-bar-white.svg');
-
+ background: url("../images/menu/stock-bar-white.svg");
}
&.upsell-order-bump::before {
- background: url('../images/menu/upsel-white.svg');
+ background: url("../images/menu/upsel-white.svg");
}
&.countdown-timer::before {
- background: url('../images/menu/countdown-timer-white.svg');
+ background: url("../images/menu/countdown-timer-white.svg");
}
-
}
li {
- color: #757D9E;
+ color: #757d9e;
font-size: 14px;
font-weight: 500;
cursor: pointer;
&:hover {
- background: #0875FF;
+ background: #0875ff;
color: #ffffff;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
-
}
-
}
-
}
}
@@ -888,7 +811,7 @@ main.ant-layout-content.sgsb-module-setting-layout {
&:before {
content: "";
position: absolute;
- background: #0875FF;
+ background: #0875ff;
width: 3px;
height: 28px;
right: 3px;
@@ -898,7 +821,6 @@ main.ant-layout-content.sgsb-module-setting-layout {
}
}
}
-
}
.sgsb__settings-sidebar {
@@ -909,7 +831,6 @@ main.ant-layout-content.sgsb-module-setting-layout {
flex: 0 0 320px !important;
max-width: 320px !important;
min-width: 320px !important;
-
}
.ant-layout-sider-children[class] {
@@ -953,16 +874,15 @@ End Settings Sidebar
align-items: center;
padding: 9px 9px 9px 20px;
border-radius: 5px;
- background: #E0F6E5;
+ background: #e0f6e5;
.sgsb-premium-limit-warning-message {
- color: #073B4C;
+ color: #073b4c;
display: block;
font-size: 16px;
}
.premium-btn {
-
a {
display: inline-flex;
align-items: center;
@@ -979,16 +899,14 @@ End Settings Sidebar
span {
font-size: 16px;
font-weight: 700;
-
}
-
}
}
.premium-btn {
a {
border: none;
- background: var(--premium-color, #FFAC27);
+ background: var(--premium-color, #ffac27);
&:focus {
color: #ffffff;
@@ -998,11 +916,8 @@ End Settings Sidebar
}
}
-
-
// upsell order bump css end
-
.sgsb-admin-dashboard {
display: flex;
flex-flow: row wrap;
@@ -1010,22 +925,18 @@ End Settings Sidebar
@media (max-width: 767px) {
display: block;
-
}
@media (min-width: 1500px) {
// gap: 20px;
-
}
@media (min-width: 768px) and (max-width: 1024px) {
// gap: 10px;
-
}
@media (min-width: 1500px) and (max-width: 2000px) {
// gap: 20px;
-
}
&-sideabr {
@@ -1035,13 +946,11 @@ End Settings Sidebar
@media (min-width: 1800px) {
flex-basis: 320px;
padding: 0 22px;
-
}
@media (max-width: 767px) {
padding-top: 2px;
margin-bottom: 40px;
-
}
h3 {
@@ -1062,7 +971,7 @@ End Settings Sidebar
&:before {
content: "";
position: absolute;
- background: #0875FF;
+ background: #0875ff;
width: 3px;
height: 28px;
right: 3px;
@@ -1072,7 +981,7 @@ End Settings Sidebar
svg {
rect {
- fill: #0875FF;
+ fill: #0875ff;
}
}
}
@@ -1080,7 +989,6 @@ End Settings Sidebar
@media (min-width: 1500px) {
// padding: 50px 8px 40px;
-
}
svg {
@@ -1091,7 +999,7 @@ End Settings Sidebar
.all-widgets-menu {
h4 {
cursor: pointer;
- color: #073B4C;
+ color: #073b4c;
font-size: 16px;
font-weight: 600;
display: flex;
@@ -1104,7 +1012,7 @@ End Settings Sidebar
&:hover:before {
content: "";
position: absolute;
- background: #0875FF;
+ background: #0875ff;
width: 3px;
height: 28px;
right: 3px;
@@ -1114,13 +1022,11 @@ End Settings Sidebar
@media (min-width: 1500px) {
// padding: 0 12px 20px 8px;
-
}
span {
margin-left: auto;
cursor: pointer;
-
}
.ant-menu-title-content {
@@ -1129,7 +1035,6 @@ End Settings Sidebar
display: flex;
}
}
-
}
.widgets-menu {
@@ -1141,7 +1046,6 @@ End Settings Sidebar
@media (min-width: 1800px) {
// padding: 0 22px;
padding: 0 42px 0 0;
-
}
&.ant-menu-hidden {
@@ -1153,7 +1057,7 @@ End Settings Sidebar
}
.sgsb-selected-module {
- background: #0875FF;
+ background: #0875ff;
color: #ffffff !important;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
@@ -1165,13 +1069,11 @@ End Settings Sidebar
@media (min-width: 1500px) {
// padding: 12px 0px 12px 34px;
-
}
&:hover {
a {
color: #ffffff;
-
}
}
@@ -1187,166 +1089,141 @@ End Settings Sidebar
@media (min-width: 1500px) {
// left: 8px;
-
}
-
}
&.fly-cart {
&:before {
content: "";
- background: url('../images/menu/quick-cart-icon.svg');
-
+ background: url("../images/menu/quick-cart-icon.svg");
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/quick-cart-icon-white.svg');
-
+ background: url("../images/menu/quick-cart-icon-white.svg");
}
-
}
}
&.progressive-discount-banner {
&:before {
content: "";
- background: url('../images/menu/free-shipping-bar-icon.svg');
+ background: url("../images/menu/free-shipping-bar-icon.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/free-shipping-bar-icon-white.svg');
+ background: url("../images/menu/free-shipping-bar-icon-white.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
}
-
}
}
&.floating-notification-bar {
&:before {
content: "";
- background: url('../images/menu/floating-bar.svg');
+ background: url("../images/menu/floating-bar.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/floating-bar-white.svg');
+ background: url("../images/menu/floating-bar-white.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
}
-
}
}
&.sales-pop {
&:before {
content: "";
- background: url('../images/menu/sales-pop.svg');
+ background: url("../images/menu/sales-pop.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/sales-pop-white.svg');
-
+ background: url("../images/menu/sales-pop-white.svg");
}
-
}
}
&.countdown-timer {
&:before {
content: "";
- background: url('../images/menu/countdown-timer.svg');
+ background: url("../images/menu/countdown-timer.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/countdown-timer-white.svg');
-
+ background: url("../images/menu/countdown-timer-white.svg");
}
-
}
}
&.upsell-order-bump {
&:before {
content: "";
- background: url('../images/menu/upsel.svg');
+ background: url("../images/menu/upsel.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/upsel-white.svg');
-
+ background: url("../images/menu/upsel-white.svg");
}
-
}
}
&.direct-checkout {
&:before {
content: "";
- background: url('../images/menu/direct-checkout.svg');
+ background: url("../images/menu/direct-checkout.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/direct-checkout-white.svg');
-
+ background: url("../images/menu/direct-checkout-white.svg");
}
-
}
}
&.stock-bar {
&:before {
content: "";
- background: url('../images/menu/stock-bar.svg');
+ background: url("../images/menu/stock-bar.svg");
width: 19px;
-
}
&:hover {
&:before {
content: "";
- background: url('../images/menu/stock-bar-white.svg');
-
+ background: url("../images/menu/stock-bar-white.svg");
}
-
}
}
-
}
a {
- color: #757D9E;
+ color: #757d9e;
padding-top: 12px;
padding-bottom: 12px;
text-decoration: none;
@@ -1368,57 +1245,51 @@ End Settings Sidebar
}
&.fly-cart::before {
- background: url('../images/menu/quick-cart-icon-white.svg');
+ background: url("../images/menu/quick-cart-icon-white.svg");
}
&.progressive-discount-banner::before {
- background: url('../images/menu/free-shipping-bar-icon-white.svg');
+ background: url("../images/menu/free-shipping-bar-icon-white.svg");
width: 20px;
height: 18px;
background-repeat: no-repeat;
}
&.sales-pop::before {
- background: url('../images/menu/sales-pop-white.svg');
+ background: url("../images/menu/sales-pop-white.svg");
}
&.direct-checkout::before {
- background: url('../images/menu/direct-checkout-white.svg');
+ background: url("../images/menu/direct-checkout-white.svg");
}
&.stock-bar::before {
- background: url('../images/menu/stock-bar-white.svg');
-
+ background: url("../images/menu/stock-bar-white.svg");
}
&.upsell-order-bump::before {
- background: url('../images/menu/upsel-white.svg');
+ background: url("../images/menu/upsel-white.svg");
}
&.countdown-timer::before {
- background: url('../images/menu/countdown-timer-white.svg');
+ background: url("../images/menu/countdown-timer-white.svg");
}
-
}
li {
- color: #757D9E;
+ color: #757d9e;
font-size: 14px;
font-weight: 500;
cursor: pointer;
&:hover {
- background: #0875FF;
+ background: #0875ff;
color: #ffffff;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
-
}
-
}
-
}
-
}
h3,
@@ -1427,7 +1298,7 @@ End Settings Sidebar
&:before {
content: "";
position: absolute;
- background: #0875FF;
+ background: #0875ff;
width: 3px;
height: 28px;
right: 3px;
@@ -1438,7 +1309,7 @@ End Settings Sidebar
}
.active-widgets {
- color: #073B4C;
+ color: #073b4c;
font-size: 15px;
list-style: none;
display: flex;
@@ -1455,15 +1326,14 @@ End Settings Sidebar
.request__feature-block {
text-align: center;
border-radius: 8px;
- border: 1px solid #2541AC;
- background: #2541AC;
+ border: 1px solid #2541ac;
+ background: #2541ac;
padding: 57px 3px 25px;
margin: 95px 8px 0;
position: relative;
@media (min-width: 320px) and (max-width: 520px) {
margin-bottom: 60px;
-
}
&:before {
@@ -1472,7 +1342,7 @@ End Settings Sidebar
bottom: -19px;
width: 100%;
height: 40px;
- background: url('../images/slide-layer.svg');
+ background: url("../images/slide-layer.svg");
left: 0;
background-repeat: no-repeat;
background-size: contain;
@@ -1481,14 +1351,12 @@ End Settings Sidebar
@media (min-width: 320px) and (max-width: 520px) {
background-size: cover;
bottom: -31px;
-
}
@media (min-width: 1441px) and (max-width: 2000px) {
background-size: cover;
left: -1.4px;
bottom: -31px;
-
}
}
@@ -1498,9 +1366,7 @@ End Settings Sidebar
.ant-image-img {
width: inherit;
-
}
-
}
.box-icon {
@@ -1508,15 +1374,13 @@ End Settings Sidebar
top: -38px;
left: 50%;
transform: translateX(-50%);
-
}
.rating {
margin-bottom: 22px;
svg {
- color: #FEB423;
-
+ color: #feb423;
}
}
@@ -1530,20 +1394,17 @@ End Settings Sidebar
color: #ffffff;
box-shadow: none;
}
-
}
h4,
p,
h5 {
color: #ffffff;
-
}
h5 {
font-size: 14px;
font-weight: 600;
-
}
h4 {
@@ -1551,7 +1412,6 @@ End Settings Sidebar
font-weight: 600;
line-height: 27px;
margin-bottom: 4px;
-
}
p {
@@ -1559,20 +1419,15 @@ End Settings Sidebar
font-weight: 300;
line-height: 21px;
margin-bottom: 20px;
-
}
.ant-btn {
border-radius: 6px;
- background: #0875FF;
+ background: #0875ff;
padding: 0 16px;
border: 0;
-
}
}
-
-
-
}
&-module {
@@ -1587,7 +1442,6 @@ End Settings Sidebar
@media (min-width: 1800px) {
.sgsb__module-pagination {
padding-left: 38px !important;
-
}
}
@@ -1598,7 +1452,6 @@ End Settings Sidebar
.sgsb__module-pagination {
padding-left: 8px !important;
-
}
.dashboard-faq-page {
@@ -1635,9 +1488,7 @@ End Settings Sidebar
@media (min-width: 1200px) and (max-width: 1439px) {
.module-desc[class] {
min-height: 208px;
-
}
-
}
@media (min-width: 992px) and (max-width: 1199px) {
@@ -1671,17 +1522,13 @@ End Settings Sidebar
.doc-btn {
gap: 3px !important;
-
}
.footer-btn[class] {
font-size: 10px;
-
}
-
}
}
-
}
@media (min-width: 1301px) and (max-width: 1439px) {
@@ -1691,12 +1538,9 @@ End Settings Sidebar
.footer-btn[class] {
font-size: 12px;
-
}
-
}
}
-
}
@media (min-width: 1025px) and (max-width: 1199px) {
@@ -1711,14 +1555,11 @@ End Settings Sidebar
}
}
}
-
}
-
.module-banner[class] {
.ant-image[class] {
width: 100% !important;
-
}
}
@@ -1752,10 +1593,8 @@ End Settings Sidebar
object-fit: cover;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
-
}
}
-
}
@media (min-width: 1500px) and (max-width: 2000px) {
@@ -1764,11 +1603,7 @@ End Settings Sidebar
&-box-content {
// padding-left: 0 !important;
padding: 30px 0 0 30px;
-
}
-
-
-
}
@media (min-width: 2001px) {
@@ -1791,11 +1626,8 @@ End Settings Sidebar
.module-banner {
.ant-image {
width: 100% !important;
-
}
}
-
-
}
}
@@ -1805,37 +1637,29 @@ End Settings Sidebar
.module-banner {
.ant-image {
width: 100% !important;
-
}
}
.doc-btn {
// gap: 2px !important;
-
}
&-box-content {
// padding-left: 0 !important;
padding: 8px 0 0 8px;
-
}
-
}
@media (min-width: 1440px) and (max-width: 2000px) {
-
.module-banner {
.ant-image {
width: 100% !important;
-
}
}
-
}
.ant-alert-warning {
margin: 13px 0px 0 14px;
-
}
&-top-bar {
@@ -1857,7 +1681,6 @@ End Settings Sidebar
@media (max-width: 767px) {
display: none;
-
}
}
@@ -1873,13 +1696,11 @@ End Settings Sidebar
@media (max-width: 767px) {
display: none;
-
}
}
@media (max-width: 767px) {
margin-bottom: 30px;
-
}
.help-btn,
@@ -1904,16 +1725,14 @@ End Settings Sidebar
span {
font-size: 18px;
font-weight: 700;
-
}
-
}
}
.premium-btn {
a {
border: none;
- background: var(--premium-color, #FFAC27);
+ background: var(--premium-color, #ffac27);
&:focus {
color: #ffffff;
@@ -1921,7 +1740,6 @@ End Settings Sidebar
}
}
}
-
}
@media (max-width: 991px) {
@@ -1930,13 +1748,11 @@ End Settings Sidebar
&>div {
max-width: 100% !important;
-
}
.module-banner {
.ant-image {
width: 100% !important;
-
}
}
@@ -1944,7 +1760,6 @@ End Settings Sidebar
.ant-card-body {
&>div {
display: block;
-
}
}
}
@@ -1952,18 +1767,15 @@ End Settings Sidebar
}
@media (min-width: 1440px) and (max-width: 2000px) {
-
&-box-content {
.sgsb-module-card {
.ant-card-body {
&>div {
display: block;
-
}
}
}
}
-
}
@media (min-width: 1300px) and (max-width: 1550px) {
@@ -1976,13 +1788,10 @@ End Settings Sidebar
.switch-btn[class] {
float: left !important;
padding-left: 10px;
-
}
}
-
}
}
-
}
}
@@ -1993,7 +1802,6 @@ End Settings Sidebar
.sgsb-logo {
margin: 15px auto 10px;
display: inline-block;
-
}
}
@@ -2001,7 +1809,7 @@ End Settings Sidebar
.header-content {
margin: 0;
display: flex;
- color: #073B4C;
+ color: #073b4c;
font-size: 24px;
font-weight: 600;
line-height: 32px;
@@ -2018,7 +1826,7 @@ End Settings Sidebar
.header-divider {
margin: 0;
- color: #DDE6F9;
+ color: #dde6f9;
}
}
@@ -2036,7 +1844,7 @@ End Settings Sidebar
.sgsb-settings-card {
height: 100%;
border-radius: 5px;
- border-color: #DDE6F9;
+ border-color: #dde6f9;
.pro-content-overlay {
top: 0;
@@ -2058,7 +1866,7 @@ End Settings Sidebar
padding: 9px 15px;
border-radius: 5px;
align-items: center;
- background: #FFAC27;
+ background: #ffac27;
display: inline-flex;
.overlay-btn-crown {
@@ -2160,7 +1968,6 @@ End Settings Sidebar
margin-top: 5px;
}
-
.settings-heading {
margin: 0;
margin-right: 10px;
@@ -2172,7 +1979,7 @@ End Settings Sidebar
.settings-field {
float: right;
- background: #DFE6F3;
+ background: #dfe6f3;
&.singlecheckbox-field {
background: none;
@@ -2228,17 +2035,16 @@ End Settings Sidebar
}
.ant-select-selection-item {
- color: #073B4C;
- background: #F6F9FF;
+ color: #073b4c;
+ background: #f6f9ff;
}
-
}
}
&.number-field {
width: 100%;
border-radius: 5px;
- background: #F6F9FF;
+ background: #f6f9ff;
input {
color: #000;
@@ -2247,7 +2053,7 @@ End Settings Sidebar
&.combine-field {
padding: 5px;
- border-color: #DDE6F9;
+ border-color: #dde6f9;
input {
text-align: left;
@@ -2257,10 +2063,10 @@ End Settings Sidebar
&.textarea-field,
&.textinput-field {
- color: #073B4C;
+ color: #073b4c;
border-radius: 5px;
- background: #F6F9FF;
- border: 1px solid #DDE6F9;
+ background: #f6f9ff;
+ border: 1px solid #dde6f9;
&.field-gap {
margin-bottom: 15px;
@@ -2276,15 +2082,15 @@ End Settings Sidebar
}
&.single-select-field {
- border-color: #DDE6F9;
- background: #F6F9FF;
+ border-color: #dde6f9;
+ background: #f6f9ff;
border-radius: 5px;
.ant-select-selector {
- border-color: #DDE6F9;
+ border-color: #dde6f9;
border-radius: 5px;
- background: #F6F9FF;
- color: #073B4C;
+ background: #f6f9ff;
+ color: #073b4c;
}
&.combine-select,
@@ -2308,7 +2114,7 @@ End Settings Sidebar
}
&.ant-switch-checked {
- background: #0875FF;
+ background: #0875ff;
}
&.color-picker-field {
@@ -2316,7 +2122,7 @@ End Settings Sidebar
background: transparent;
.ant-color-picker-color-block-inner {
- border-color: #DDE6F9;
+ border-color: #dde6f9;
}
}
@@ -2331,10 +2137,10 @@ End Settings Sidebar
height: 100%;
padding: 0 12px;
border-radius: 5px;
- border: 1px solid #DDE6F9;
+ border: 1px solid #dde6f9;
&.ant-radio-button-wrapper-checked {
- border-color: #0875FF;
+ border-color: #0875ff;
}
&:before {
@@ -2342,12 +2148,12 @@ End Settings Sidebar
}
&:hover {
- background: #0875FF;
- border-color: #0875FF;
+ background: #0875ff;
+ border-color: #0875ff;
.radio-icon {
path {
- fill: #FFF !important;
+ fill: #fff !important;
}
}
}
@@ -2372,7 +2178,6 @@ End Settings Sidebar
}
&.quick-cart-position {
-
grid-template-rows: repeat(2, auto);
img {
@@ -2405,7 +2210,6 @@ End Settings Sidebar
}
}
-
.option-name {
gap: 0px;
display: flex;
@@ -2420,13 +2224,11 @@ End Settings Sidebar
position: absolute;
bottom: 28%;
}
-
}
-
}
label.ant-radio-button-wrapper {
- color: #073B4C;
+ color: #073b4c;
font-size: 14px;
.layout-img {
@@ -2443,7 +2245,7 @@ End Settings Sidebar
&:hover,
&.ant-radio-button-wrapper-checked {
- border: 1px solid #0875FF;
+ border: 1px solid #0875ff;
background: transparent;
}
@@ -2466,7 +2268,7 @@ End Settings Sidebar
height: 16px;
display: flex;
font-size: 12px;
- background: #0875FF;
+ background: #0875ff;
border-radius: 100%;
justify-content: center;
transform: translate(50%, -50%);
@@ -2476,7 +2278,7 @@ End Settings Sidebar
&.custom-field {
label.ant-radio-button-wrapper {
&:hover {
- border-color: #DDE6F9;
+ border-color: #dde6f9;
background: transparent;
}
@@ -2497,12 +2299,12 @@ End Settings Sidebar
&:not(.ant-switch-checked) {
.ant-switch-inner-unchecked {
- color: #73829D;
+ color: #73829d;
}
.ant-switch-handle {
&:before {
- background: #ABB8D0;
+ background: #abb8d0;
}
}
}
@@ -2552,7 +2354,7 @@ End Settings Sidebar
}
.settings-heading {
- color: #073B4C;
+ color: #073b4c;
font-size: 16px;
font-weight: 500;
line-height: 20px;
@@ -2573,14 +2375,14 @@ End Settings Sidebar
margin-right: 10px;
align-items: center;
border-radius: 50px;
- background: #DFE6F3;
+ background: #dfe6f3;
justify-content: center;
}
.textarea-content {
p {
margin: 0;
- color: #073B4C;
+ color: #073b4c;
font-size: 14px;
line-height: 1.8;
}
@@ -2595,7 +2397,7 @@ End Settings Sidebar
font-size: 10px;
font-weight: 600;
line-height: 1;
- background: #FFAC27;
+ background: #ffac27;
color: white;
border-radius: 10px;
padding: 4px 7px;
@@ -2640,7 +2442,7 @@ End Settings Sidebar
.upgrade-content {
gap: 10px;
display: flex;
- color: #073B4C;
+ color: #073b4c;
font-weight: 500;
}
}
@@ -2693,36 +2495,36 @@ End Settings Sidebar
.section-divider {
margin: 50px 0;
- color: #DDE6F9;
+ color: #dde6f9;
}
.sgsb-collapse-settings {
overflow: hidden;
- border-color: #DDE6F9;
+ border-color: #dde6f9;
border-radius: 5px;
.ant-collapse-item {
- border-color: #DDE6F9;
+ border-color: #dde6f9;
border-radius: 0;
}
.ant-collapse-header {
border-radius: 0;
- background: #FFF;
+ background: #fff;
padding: 10px 16px;
.ant-collapse-header-text {
- color: #073B4C;
+ color: #073b4c;
}
}
.ant-collapse-content {
border-radius: 0;
background: #f7f9ff;
- border-color: #DDE6F9;
+ border-color: #dde6f9;
.content-bump-label {
- color: #073B4C;
+ color: #073b4c;
display: block;
font-size: 16px;
font-weight: 500;
@@ -2732,10 +2534,10 @@ End Settings Sidebar
#fixed-bump,
#discount-bump {
- color: #073B4C;
+ color: #073b4c;
padding: 6px 10px;
border-radius: 5px;
- border: 1px solid #DDE6F9;
+ border: 1px solid #dde6f9;
}
}
}
@@ -2771,7 +2573,7 @@ End Settings Sidebar
padding: 9px 15px;
border-radius: 5px;
align-items: center;
- background: #FFAC27;
+ background: #ffac27;
display: inline-flex;
.overlay-btn-crown {
@@ -2805,12 +2607,12 @@ End Settings Sidebar
.ant-tabs-tab-active {
.ant-tabs-tab-btn {
- color: #0875FF;
+ color: #0875ff;
}
}
&:before {
- border-color: #DDE6F9;
+ border-color: #dde6f9;
}
}
@@ -2823,7 +2625,7 @@ End Settings Sidebar
h4 {
margin: 0;
- color: #073B4C;
+ color: #073b4c;
font-size: 18px;
font-weight: 600;
}
@@ -2845,27 +2647,27 @@ End Settings Sidebar
.sgsb-settings-save-button {
border: 0;
margin: 0;
- color: #FFF;
+ color: #fff;
height: auto;
z-index: 9999;
line-height: 1;
font-size: 16px;
font-weight: 500;
padding: 12px 24px;
- background: #0875FF;
+ background: #0875ff;
}
.sgsb-settings-reset-button {
height: auto;
z-index: 9999;
- color: #073B4C;
+ color: #073b4c;
line-height: 1;
font-size: 16px;
font-weight: 500;
border-radius: 5px;
padding: 12px 24px;
background: #f6f9ff;
- border: 1px solid #DDE6F9;
+ border: 1px solid #dde6f9;
}
}
}
@@ -2899,7 +2701,7 @@ End Settings Sidebar
width: 50px;
height: 40px;
display: flex;
- background: #0875FF;
+ background: #0875ff;
align-items: center;
align-self: self-start;
justify-content: center;
@@ -2972,7 +2774,7 @@ End Settings Sidebar
font-size: 10px;
font-weight: 600;
line-height: 1;
- background: #FFAC27;
+ background: #ffac27;
color: white;
border-radius: 10px;
padding: 4px 7px;
@@ -3000,7 +2802,7 @@ End Settings Sidebar
padding: 4px 14px;
border-radius: 5px;
align-items: center;
- background: #FFAC27;
+ background: #ffac27;
display: inline-flex;
.overlay-btn-crown {
@@ -3024,11 +2826,11 @@ End Settings Sidebar
.ant-select-selector {
width: 100%;
- border-color: #DDE6F9 !important;
+ border-color: #dde6f9 !important;
}
.trigger-radio-selected {
- background-color: #F6F9FF;
+ background-color: #f6f9ff;
}
.ant-radio-input {
@@ -3076,7 +2878,7 @@ End Settings Sidebar
&.modal-content-heading {
font-size: 22px;
font-weight: 700;
- color: #102F50;
+ color: #102f50;
margin-bottom: 0;
}
}
@@ -3093,24 +2895,24 @@ End Settings Sidebar
margin-top: 10px;
.modal-cancel-button {
- color: #FF0834;
- border: 1px solid #FF0834;
+ color: #ff0834;
+ border: 1px solid #ff0834;
&:hover {
- background-color: #FFF0F3 !important;
- color: #FF0834;
- border: 1px solid #FF0834;
+ background-color: #fff0f3 !important;
+ color: #ff0834;
+ border: 1px solid #ff0834;
}
}
.modal-submit-button {
- color: #0875FF;
- border: 1px solid #0875FF;
+ color: #0875ff;
+ border: 1px solid #0875ff;
&:hover {
- background-color: #ECF4FF;
- color: #0875FF;
- border: 1px solid #0875FF;
+ background-color: #ecf4ff;
+ color: #0875ff;
+ border: 1px solid #0875ff;
}
}
@@ -3131,6 +2933,8 @@ End Settings Sidebar
flex-direction: column;
align-items: center;
gap: 20px;
+ padding-top: 26px;
+ background-color: #fff;
.storegrowth-icon {
width: fit-content;
@@ -3143,6 +2947,10 @@ End Settings Sidebar
.sgsg-ini-setup-progress {
width: 100%;
+
+ .ant-steps-item-content {
+ font-weight: 700;
+ }
}
.sgsb-return-dashboard {
@@ -3151,16 +2959,55 @@ End Settings Sidebar
padding: 20px 30px;
border-radius: 5px;
border: none;
- background: #E3E9FF;
+ background: #e3e9ff;
}
}
.sgsb-ini-setup-content-layout {
- margin: 50px 36px;
+ margin: 22px 36px;
border-radius: 10px;
- opacity: 0.8;
- background: #F4F7FF;
- padding: 80px 20px;
+ background: #f4f7ff;
+ padding: 60px 20px;
+
+ .sgsb-steps-controller {
+ display: flex;
+ gap: 10px;
+ justify-content: flex-end;
+ }
+
+ .steps-button {
+ padding: 12px 30px;
+ border-radius: 6px;
+ border: none;
+ font-weight: 700;
+ width: fit-content;
+ cursor: pointer;
+
+ &.next {
+ color: #fff;
+ background-color: #0875ff;
+ }
+
+ &.previous {
+ color: #073b4c;
+ background-color: #e3e9ff;
+ }
+
+ &.completion-cta {
+ color: #fff;
+ background-color: #0875ff;
+ }
+
+ &.doc-cta {
+ color: #fff;
+ background: #000000;
+ }
+
+ &.support-cta {
+ color: #073b4c;
+ background-color: #dde6f9;
+ }
+ }
// Welcome step layout
.sgsb-ini-setup-welcome {
@@ -3170,7 +3017,7 @@ End Settings Sidebar
align-items: center;
.sgsb-content-heading {
- color: var(--Secoundary-Color, #073B4C);
+ color: var(--Secoundary-Color, #073b4c);
text-align: center;
font-size: 36px;
font-style: normal;
@@ -3179,15 +3026,14 @@ End Settings Sidebar
margin: 0;
span {
- color: var(--Primary-Color, #0875FF);
- ;
+ color: var(--Primary-Color, #0875ff);
}
}
.sgsb-sub-heading {
margin-top: 16px;
white-space: pre-line;
- color: var(--Secoundary-Color, #073B4C);
+ color: var(--Secoundary-Color, #073b4c);
text-align: center;
font-size: 18px;
font-style: normal;
@@ -3195,16 +3041,109 @@ End Settings Sidebar
line-height: normal;
}
- .get-started-cta {
+ .get-started {
margin-top: 50px;
padding: 16px 42px;
- border-radius: 6px;
- border: none;
color: #fff;
- background-color: #0875FF;
- cursor: pointer;
+ background-color: #0875ff;
+ }
+ }
+
+ //Setup Completion page
+ .sgsb-step-completion {
+ display: flex;
+ flex-direction: column;
+ gap: 50px;
+
+ .sgsb-inisetup-heading-content {
+ display: flex;
+ justify-content: center;
+ flex-direction: column;
+ align-items: center;
+ gap: 24px;
+
+ .completion-check-mark {
+ border: 2px solid #0875ff;
+ border-radius: 50%;
+ padding: 24px 22px;
+ display: inline-flex;
+ }
+
+ .setup-completion-heading {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+
+ .heading {
+ color: #073b4c;
+ text-align: center;
+ font-size: 36px;
+ font-weight: 700;
+ }
+
+ .sub-heading {
+ color: #073b4c;
+ text-align: center;
+ font-size: 14px;
+ font-weight: 400;
+ }
+ }
+ }
+
+ .sgsb-ini-setup-completion {
+ .sgsb-intro-video {
+ iframe {
+ width: 36vw;
+ height: 19vw;
+ border-radius: 6px;
+ background: gray;
+ }
+ }
+
+ &.support-doc {
+ display: flex;
+ gap: 44px;
+ margin-left: 8%;
+ }
+
+ .sgsb-support-doc-cta {
+ display: flex;
+ flex-direction: column;
+ gap: 15px;
+ }
}
+ .ini-setup {
+ &.user-agreement {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ margin-left: 8%;
+
+ .getting-updates,
+ .getting-essentials {
+ display: flex;
+ align-items: flex-start;
+ gap: 10px;
+
+ .content-container {
+ line-height: 0.5;
+
+ .heading {
+ color: var(--Secoundary-Color, #073b4c);
+ font-size: 16px;
+ font-weight: 500;
+ }
+
+ .content {
+ color: var(--Secoundary-Color, #073b4c);
+ font-size: 12px;
+ font-weight: 400;
+ }
+ }
+ }
+ }
+ }
}
}
}
diff --git a/assets/src/components/initail-setup/ContentLayout.jsx b/assets/src/components/initail-setup/ContentLayout.jsx
index fa179160..42d2cacc 100644
--- a/assets/src/components/initail-setup/ContentLayout.jsx
+++ b/assets/src/components/initail-setup/ContentLayout.jsx
@@ -1,14 +1,16 @@
-import React from 'react'
+import { useEffect, useRef } from '@wordpress/element';
+import { __ } from "@wordpress/i18n";
import Welcome from './Welcome';
import ModulesSetup from './ModulesSetup';
import Ready from './Ready';
-const ContentLayout = ({ current }) => {
+const ContentLayout = ({ current, next, prev, stepSize = 0 }) => {
+
const renderContent = () => {
- switch (current) {
+ switch (parseInt(current)) {
case 0:
- return
;
+ return
;
case 1:
return
;
case 2:
@@ -19,8 +21,16 @@ const ContentLayout = ({ current }) => {
};
return (
-
{renderContent()}
- )
+
+ {renderContent()}
+ {(current !== 0 && current !== stepSize - 1) &&
+
+ {__(`Previous`, 'storegrowth-sales-booster')}
+ {__(`Next`, 'storegrowth-sales-booster')}
+
+ }
+
+ );
}
-export default ContentLayout
+export default ContentLayout;
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index 8d5e5bf2..75899cd2 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -1,20 +1,38 @@
-import { React, Fragment } from '@wordpress/element';
+import { React, Fragment, useState, useRef, useEffect } from '@wordpress/element';
import Progress from './Progress';
-import {Button} from 'antd';
+import { Button } from 'antd';
import StoreGrowthIcon from '../../../images/logo.svg'
const IniSetupLayout = () => {
+ const [current, setCurrent] = useState(0);
+ const contentLayoutRef = useRef(null);
- const clickHandler=() => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview'};
+ const clickHandler = () => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview' };
+
+ const next = () => { setCurrent(current + 1) }
+
+ const prev = () => {
+ setCurrent(current - 1);
+ };
+
+ useEffect(() => {
+
+ // Scroll to the top of the content layout when 'current' changes
+ if (current !== 0) {
+ if (contentLayoutRef.current) {
+ contentLayoutRef.current.scrollIntoView({ behavior: 'smooth' });
+ }
+ }
+ }, [current]);
return (
-
+
-
-
+
+
Return To Dashboard
diff --git a/assets/src/components/initail-setup/Progress.jsx b/assets/src/components/initail-setup/Progress.jsx
index ffd88a1c..588119aa 100644
--- a/assets/src/components/initail-setup/Progress.jsx
+++ b/assets/src/components/initail-setup/Progress.jsx
@@ -1,14 +1,14 @@
-import { useState, Fragment } from '@wordpress/element';
+import { Fragment } from '@wordpress/element';
import { Steps } from 'antd';
import ContentLayout from './ContentLayout';
-const Progress = () => {
- const [current, setCurrent] = useState(0);
+const Progress = ({next,prev,current,setCurrent}) => {
const onChange = (value) => {
setCurrent(value);
};
+
const steps = [
{
title: 'Welcome',
@@ -20,7 +20,7 @@ const Progress = () => {
title: 'Ready',
},
];
-
+ const stepSize = steps.length;
return (
{
onChange={onChange}
items={steps}
/>
-
+
);
}
diff --git a/assets/src/components/initail-setup/Ready.jsx b/assets/src/components/initail-setup/Ready.jsx
index 0b6a4de5..81a232dd 100644
--- a/assets/src/components/initail-setup/Ready.jsx
+++ b/assets/src/components/initail-setup/Ready.jsx
@@ -1,9 +1,84 @@
-import React from 'react'
+import { Fragment } from "react";
+import { Switch } from 'antd';
+import { __ } from "@wordpress/i18n";
const Ready = () => {
+
+ const onChange = (checked) => {
+ console.log(`switch to ${checked}`);
+ };
+
return (
-
Ready
- )
-}
+
+
+
+
+
+
+ {__("Congratulation", "storegrowth-sales-booster")}
+
+
+ {__(
+ "You are at the last step to complete the setup process and start using the exciting features of StoreGrawth",
+ "storegrowth-sales-booster"
+ )}
+
+
+
+
+
+
+
+
+
+
+
{__('Get Updates', "storegrowth-sales-booster")}
+
{__('We will send essential tips & tricks for effective usage of StoreGrowth.', "storegrowth-sales-booster")}
+
+
+
+
+
+
{__('Share Essentials', "storegrowth-sales-booster")}
+
{__('Let us collect non-sensitive diagnosis data and usage information.', "storegrowth-sales-booster")}
+
+
+
+
+
+ );
+};
export default Ready;
diff --git a/assets/src/components/initail-setup/Welcome.jsx b/assets/src/components/initail-setup/Welcome.jsx
index cb414522..f2fa96d9 100644
--- a/assets/src/components/initail-setup/Welcome.jsx
+++ b/assets/src/components/initail-setup/Welcome.jsx
@@ -1,14 +1,14 @@
import { Fragment } from 'react'
import { __ } from '@wordpress/i18n';
-const Welcome = () => {
+const Welcome = ( {next}) => {
return (
{__("Welcome To ", "storegrowth-sales-booster")} {__("StoreGrowth", "storegrowth-sales-booster")}
{__(`# 1 Marketing Plugin For WooCommerce
of StoreGrowth Turbocharge Your WooCommerce Store’s Sales!`, 'storegrowth-sales-booster')}
- {__(`Get Starter`, 'storegrowth-sales-booster')}
+ {__(`Get Started`, 'storegrowth-sales-booster')}
)
diff --git a/assets/src/components/modules/Layout.js b/assets/src/components/modules/Layout.js
index 3c6783b7..a72eaefd 100644
--- a/assets/src/components/modules/Layout.js
+++ b/assets/src/components/modules/Layout.js
@@ -1,28 +1,30 @@
-import { Layout } from 'antd';
+import { Layout } from "antd";
+import { useRoutes } from "react-router-dom";
import PageLoader from "../PageLoader";
-import Modules from "./Modules";
-import IniSetupLayout from '../initail-setup/IniSetupLayout';
+import moduleRoutes from "./ModuleRoutes";
+import { removeHashFromURL } from "../../utils/helper";
function AppLayout() {
+ const currentPath = removeHashFromURL(window.location.hash);
+ let element = useRoutes(moduleRoutes);
+
return (
+ style={{
+ padding: "0",
+ }}
+ >
-
-
+ {element}
-
-
+ {currentPath !== "ini-setup" && }
);
}
diff --git a/assets/src/components/modules/ModuleRoutes.js b/assets/src/components/modules/ModuleRoutes.js
new file mode 100644
index 00000000..a4a40aa8
--- /dev/null
+++ b/assets/src/components/modules/ModuleRoutes.js
@@ -0,0 +1,17 @@
+import React from 'react';
+import Modules from './Modules';
+import IniSetupLayout from '../initail-setup/IniSetupLayout';
+
+let moduleRoutes = [
+ {
+ path : '/',
+ element :
,
+ },
+ {
+ path : '/ini-setup',
+ element :
,
+ },
+];
+
+
+export default moduleRoutes;
diff --git a/assets/src/components/settings/Layout.js b/assets/src/components/settings/Layout.js
index f981151f..8ab67795 100644
--- a/assets/src/components/settings/Layout.js
+++ b/assets/src/components/settings/Layout.js
@@ -16,7 +16,6 @@ import dashboardRoutes from "../dashboard/DashboardRoutes";
function ModuleSettings({ routes }) {
let element = useRoutes(routes);
-
return (
diff --git a/assets/src/modules.js b/assets/src/modules.js
index a656cc24..6678c10e 100644
--- a/assets/src/modules.js
+++ b/assets/src/modules.js
@@ -1,7 +1,7 @@
import { register } from '@wordpress/data';
import { render, StrictMode } from '@wordpress/element';
import { HashRouter } from 'react-router-dom';
-
+import { menuFix } from "./utils/helper";
import store from './modules-store';
import 'antd/dist/reset.css';
@@ -19,3 +19,5 @@ render(
,
document.getElementById( "sbooster-modules-page" )
);
+
+menuFix( 'sales-booster-for-woocommerce' );
diff --git a/assets/src/utils/helper.js b/assets/src/utils/helper.js
index 59c04def..879e267f 100644
--- a/assets/src/utils/helper.js
+++ b/assets/src/utils/helper.js
@@ -37,6 +37,24 @@ export const menuFix = ( slug ) => {
$( el ).parent().addClass( 'current' );
}
} );
+
+ menuRoot.on( 'click', 'a', function () {
+ const self = $( this );
+ const uri = self.attr('href');
+ const hash = uri.split('#')[1];
+
+ if("/ini-setup"===hash){
+ console.log("properly getting the hash");
+ $("#wpadminbar , #adminmenumain").remove();
+ $(".wp-toolbar").css({
+ padding: "0", // Replace with your desired background color
+ });
+ $("#wpcontent, #wpfooter").css({
+ marginLeft:"0", // Replace with your desired background color
+ });
+ $(".notice").remove();
+ }
+ } );
}
export const extractedTitle = ( title, length = 60 ) => {
From b76e794b30f235519513cf59a6ed33154347c15e Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Thu, 18 Jan 2024 16:51:56 +0600
Subject: [PATCH 03/25] redirect user after plugin activated
---
Includes/Admin/AdminHooks.php | 75 +++++++++++++++++++++--------------
storegrowth-sales-booster.php | 6 +++
2 files changed, 52 insertions(+), 29 deletions(-)
diff --git a/Includes/Admin/AdminHooks.php b/Includes/Admin/AdminHooks.php
index e11b8ba9..09021cf8 100644
--- a/Includes/Admin/AdminHooks.php
+++ b/Includes/Admin/AdminHooks.php
@@ -10,38 +10,55 @@
use STOREGROWTH\SPSB\Traits\Singleton;
// If this file is called directly, abort.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
+if (! defined('ABSPATH') ) {
+ exit;
}
/**
* Add misc dashbaord end hooks inside this class.
*/
-class AdminHooks {
-
- use Singleton;
-
- /**
- * Constructor of Admin_Hooks class.
- */
- private function __construct() {
- add_filter( 'plugin_action_links_' . STOREGROWTH_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
- }
-
- /**
- * Show action links on the plugin screen.
- *
- * @param mixed $links Plugin Action links.
- *
- * @return array
- */
- public function plugin_action_links( $links ) {
- $action_links = array(
- 'dashboard' => '' . esc_html__( 'Dashboard', 'storegrowth-sales-booster' ) . ' ',
- 'modules' => '' . esc_html__( 'Modules', 'storegrowth-sales-booster' ) . ' ',
- 'settings' => '' . esc_html__( 'Settings', 'storegrowth-sales-booster' ) . ' ',
- );
-
- return array_merge( $action_links, $links );
- }
+class AdminHooks
+{
+
+ use Singleton;
+
+ /**
+ * Constructor of Admin_Hooks class.
+ */
+ private function __construct()
+ {
+ add_filter('plugin_action_links_' . STOREGROWTH_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ));
+ add_action('admin_init', [ $this, 'sgsb_redirect_initial_setup' ]);
+ }
+
+ /**
+ * Show action links on the plugin screen.
+ *
+ * @param mixed $links Plugin Action links.
+ *
+ * @return array
+ */
+ public function plugin_action_links( $links )
+ {
+ $action_links = array(
+ 'dashboard' => '' . esc_html__('Dashboard', 'storegrowth-sales-booster') . ' ',
+ 'modules' => '' . esc_html__('Modules', 'storegrowth-sales-booster') . ' ',
+ 'settings' => '' . esc_html__('Settings', 'storegrowth-sales-booster') . ' ',
+ );
+
+ return array_merge($action_links, $links);
+ }
+
+ /**
+ * Redirect to Welcome Page when plugin is activated.
+ */
+
+ public function sgsb_redirect_initial_setup()
+ {
+ if (get_option('storegrowth_activation_redirect', false)) {
+ delete_option('storegrowth_activation_redirect');
+ if(wp_safe_redirect(admin_url('admin.php?page=sgsb-modules#/ini-setup'))) { exit();
+ }
+ }
+ }
}
diff --git a/storegrowth-sales-booster.php b/storegrowth-sales-booster.php
index 3ca29ca0..362c95bc 100644
--- a/storegrowth-sales-booster.php
+++ b/storegrowth-sales-booster.php
@@ -105,6 +105,12 @@ function () {
define( 'SGSB_PRO_ACTIVE', false );
}
+/**
+ * add option when plugin is activated.
+ */
+register_activation_hook(__FILE__, function () {
+ add_option('storegrowth_activation_redirect', true);
+});
/**
* Initialize the plugin functionality.
*
From 27f3774f341b6b60a7cf6b3bca1d8aa75d1dc83b Mon Sep 17 00:00:00 2001
From: Satyajit Talukder <65698588+gooyeduck@users.noreply.github.com>
Date: Thu, 18 Jan 2024 17:11:19 +0600
Subject: [PATCH 04/25] fix(project): admin menu fix and refactored the code
---
Includes/Admin/AdminHooks.php | 90 +++++++++++----------
Includes/Assets.php | 17 ----
assets/menu-scripts/admin-menu.js | 46 -----------
assets/src/utils/helper.js | 127 ++++++++++++++++++------------
4 files changed, 122 insertions(+), 158 deletions(-)
delete mode 100644 assets/menu-scripts/admin-menu.js
diff --git a/Includes/Admin/AdminHooks.php b/Includes/Admin/AdminHooks.php
index 09021cf8..08755653 100644
--- a/Includes/Admin/AdminHooks.php
+++ b/Includes/Admin/AdminHooks.php
@@ -10,55 +10,53 @@
use STOREGROWTH\SPSB\Traits\Singleton;
// If this file is called directly, abort.
-if (! defined('ABSPATH') ) {
- exit;
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
}
/**
* Add misc dashbaord end hooks inside this class.
*/
-class AdminHooks
-{
-
- use Singleton;
-
- /**
- * Constructor of Admin_Hooks class.
- */
- private function __construct()
- {
- add_filter('plugin_action_links_' . STOREGROWTH_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ));
- add_action('admin_init', [ $this, 'sgsb_redirect_initial_setup' ]);
- }
-
- /**
- * Show action links on the plugin screen.
- *
- * @param mixed $links Plugin Action links.
- *
- * @return array
- */
- public function plugin_action_links( $links )
- {
- $action_links = array(
- 'dashboard' => '' . esc_html__('Dashboard', 'storegrowth-sales-booster') . ' ',
- 'modules' => '' . esc_html__('Modules', 'storegrowth-sales-booster') . ' ',
- 'settings' => '' . esc_html__('Settings', 'storegrowth-sales-booster') . ' ',
- );
-
- return array_merge($action_links, $links);
- }
-
- /**
- * Redirect to Welcome Page when plugin is activated.
- */
-
- public function sgsb_redirect_initial_setup()
- {
- if (get_option('storegrowth_activation_redirect', false)) {
- delete_option('storegrowth_activation_redirect');
- if(wp_safe_redirect(admin_url('admin.php?page=sgsb-modules#/ini-setup'))) { exit();
- }
- }
- }
+class AdminHooks {
+
+
+ use Singleton;
+
+ /**
+ * Constructor of Admin_Hooks class.
+ */
+ private function __construct() {
+ add_filter( 'plugin_action_links_' . STOREGROWTH_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
+ add_action( 'admin_init', array( $this, 'sgsb_redirect_initial_setup' ) );
+ }
+
+ /**
+ * Show action links on the plugin screen.
+ *
+ * @param mixed $links Plugin Action links.
+ *
+ * @return array
+ */
+ public function plugin_action_links( $links ) {
+ $action_links = array(
+ 'dashboard' => '' . esc_html__( 'Dashboard', 'storegrowth-sales-booster' ) . ' ',
+ 'modules' => '' . esc_html__( 'Modules', 'storegrowth-sales-booster' ) . ' ',
+ 'settings' => '' . esc_html__( 'Settings', 'storegrowth-sales-booster' ) . ' ',
+ );
+
+ return array_merge( $action_links, $links );
+ }
+
+ /**
+ * Redirect to Welcome Page when plugin is activated.
+ */
+
+ public function sgsb_redirect_initial_setup() {
+ if ( get_option( 'storegrowth_activation_redirect', false ) ) {
+ delete_option( 'storegrowth_activation_redirect' );
+ if ( wp_safe_redirect( admin_url( 'admin.php?page=sgsb-modules#/ini-setup' ) ) ) {
+ exit();
+ }
+ }
+ }
}
diff --git a/Includes/Assets.php b/Includes/Assets.php
index 2f1e2847..126f7dc4 100644
--- a/Includes/Assets.php
+++ b/Includes/Assets.php
@@ -40,8 +40,6 @@ class Assets {
*/
private function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_menu_scripts' ) );
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_styles' ) );
}
@@ -97,21 +95,6 @@ public function admin_enqueue_scripts( $hook ) {
}
}
- /**
- * Add CSS files to admin menu.
- */
- public function admin_menu_scripts() {
- $script_url = sgsb_assets_url( 'menu-scripts/admin-menu.js' );
-
- wp_enqueue_script(
- 'sgsb-settings-menu-script',
- $script_url,
- array(),
- '1.0.1',
- true
- );
- }
-
/**
* Add CSS files to admin.
*
diff --git a/assets/menu-scripts/admin-menu.js b/assets/menu-scripts/admin-menu.js
deleted file mode 100644
index bd9ae298..00000000
--- a/assets/menu-scripts/admin-menu.js
+++ /dev/null
@@ -1,46 +0,0 @@
-(function ($) {
- "use strict";
-
- // *************************************
- // Add target blank for upgrade button
- // *************************************
- $("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (
- e
- ) {
- if ($(this).attr("href").indexOf("?page=go-sgsb-pro") > 0) {
- $(this).attr("target", "_blank");
- // Add hover effect
- $(this).hover(
- function () {
- $(this).css("color", "yellowgreen");
- },
- function () {
- $(this).css("color", ""); // Revert to original color on hover out
- }
- );
- }
- if ($(this).attr("href").indexOf("?page=go-sgsb-docs") > 0) {
- $(this).attr("target", "_blank");
- }
- });
-
- // *************************************
- // Target the admin menu and remove it
- // *************************************
-
- let currentPath = window.location.hash;
- console.log(currentPath);
- if ("#/ini-setup" === currentPath || "#ini-setup" === currentPath) {
- console.log("from jquery");
- $("#wpadminbar , #adminmenumain").remove();
-
- $(".wp-toolbar").css({
- padding: "0", // Replace with your desired background color
- });
- $("#wpcontent, #wpfooter").css({
- marginLeft:"0",
- background: "#fff", // Replace with your desired background color
- });
- $(".notice").remove();
- }
-})(jQuery);
diff --git a/assets/src/utils/helper.js b/assets/src/utils/helper.js
index 879e267f..1bcfec9c 100644
--- a/assets/src/utils/helper.js
+++ b/assets/src/utils/helper.js
@@ -1,78 +1,107 @@
import { __ } from '@wordpress/i18n';
import { Ajax } from '../ajax';
-export const menuFix = ( slug ) => {
+export const menuFix = (slug) => {
const $ = jQuery;
const location = window.location,
hash = location.hash,
- menuRoot = $( '#toplevel_page_' + slug );
+ menuRoot = $('#toplevel_page_' + slug);
- const dashboardHashRoutes = [ '#/dashboard/overview', '#/dashboard/pricing', '#/dashboard/faq' ];
+ const dashboardHashRoutes = ['#/dashboard/overview', '#/dashboard/pricing', '#/dashboard/faq'];
+
+ function adminMenuRemover() {
+ $("#wpadminbar , #adminmenumain").remove();
+
+ $(".wp-toolbar").css({
+ padding: "0", // Replace with your desired background color
+ });
+ $("#wpcontent, #wpfooter").css({
+ marginLeft:"0",
+ background: "#fff", // Replace with your desired background color
+ });
+ $(".notice").remove();
+ }
+ // *************************************
+ // Add target blank for upgrade button
+ // *************************************
+ $("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (e) {
+ if ($(this).attr("href").indexOf("?page=go-sgsb-pro") > 0) {
+ $(this).attr("target", "_blank");
+ // Add hover effect
+ $(this).hover(
+ function () {
+ $(this).css("color", "yellowgreen");
+ },
+ function () {
+ $(this).css("color", ""); // Revert to original color on hover out
+ }
+ );
+ }
+ if ($(this).attr("href").indexOf("?page=go-sgsb-docs") > 0) {
+ $(this).attr("target", "_blank");
+ }
+ });
// Handle dashboard activation slug for first time load.
- if ( dashboardHashRoutes.includes( hash ) ) {
- $( 'ul.wp-submenu li', menuRoot ).removeClass( 'current' );
- menuRoot.find( `li.wp-first-item` ).addClass( 'current' );
+ if (dashboardHashRoutes.includes(hash)) {
+ $('ul.wp-submenu li', menuRoot).removeClass('current');
+ menuRoot.find(`li.wp-first-item`).addClass('current');
}
const currentUrl = location.href;
// Handle activation slug for overall submenus.
- menuRoot.on( 'click', 'a', function () {
- const self = $( this );
+ menuRoot.on('click', 'a', function () {
+ const self = $(this);
- $( 'ul.wp-submenu li', menuRoot ).removeClass( 'current' );
+ $('ul.wp-submenu li', menuRoot).removeClass('current');
// Check if submenu class then active.
- if ( self.hasClass( 'wp-has-submenu' ) ) {
- $( 'li.wp-first-item', menuRoot ).addClass( 'current' );
+ if (self.hasClass('wp-has-submenu')) {
+ $('li.wp-first-item', menuRoot).addClass('current');
} else {
- self.parents( 'li' ).addClass( 'current' );
+ self.parents('li').addClass('current');
}
- } );
+ });
// Handle menu activation by submenu hyper ref checking.
- $( 'ul.wp-submenu a', menuRoot ).each( function ( index, el ) {
- if ( $( el ).attr( 'href' ) === currentUrl ) {
- $( el ).parent().addClass( 'current' );
+ $('ul.wp-submenu a', menuRoot).each(function (index, el) {
+ if ($(el).attr('href') === currentUrl) {
+ $(el).parent().addClass('current');
}
- } );
+ });
- menuRoot.on( 'click', 'a', function () {
- const self = $( this );
+ if ("#/ini-setup" === hash || "#ini-setup" === hash) {
+ adminMenuRemover();
+ }
+
+ menuRoot.on('click', 'a', function () {
+ const self = $(this);
const uri = self.attr('href');
const hash = uri.split('#')[1];
- if("/ini-setup"===hash){
- console.log("properly getting the hash");
- $("#wpadminbar , #adminmenumain").remove();
- $(".wp-toolbar").css({
- padding: "0", // Replace with your desired background color
- });
- $("#wpcontent, #wpfooter").css({
- marginLeft:"0", // Replace with your desired background color
- });
- $(".notice").remove();
+ if ("/ini-setup" === hash) {
+ adminMenuRemover();
}
- } );
+ });
}
-export const extractedTitle = ( title, length = 60 ) => {
- const extractedString = title?.substr( 0, length );
+export const extractedTitle = (title, length = 60) => {
+ const extractedString = title?.substr(0, length);
return extractedString?.length >= length
- ? `${ extractedString }...`
+ ? `${extractedString}...`
: extractedString;
}
-export const wpMedia = ( {
+export const wpMedia = ({
callback,
- title = __( 'Select or upload media.', 'storegrowth-sales-booster' ),
+ title = __('Select or upload media.', 'storegrowth-sales-booster'),
selectMultiple = false,
- selectText = __( 'Select', 'storegrowth-sales-booster' ),
+ selectText = __('Select', 'storegrowth-sales-booster'),
fileType = 'image',
dimension = {},
-} ) => {
- const frame = wp.media( {
+}) => {
+ const frame = wp.media({
title,
button: {
text: selectText,
@@ -81,20 +110,20 @@ export const wpMedia = ( {
type: fileType,
},
multiple: selectMultiple, // Set to true to allow multiple files to be selected
- } );
+ });
frame.open();
// When an file is selected, run a callback.
- frame.on( 'select', () => {
- const attachment = frame.state().get( 'selection' ).first().toJSON();
+ frame.on('select', () => {
+ const attachment = frame.state().get('selection').first().toJSON();
- callback( attachment );
- } );
+ callback(attachment);
+ });
}
-export const deactivatorHandler= (moduleID)=>{
- Ajax( 'update_module_status', {
+export const deactivatorHandler = (moduleID) => {
+ Ajax('update_module_status', {
module_id: moduleID,
status: false
}).success((response) => {
@@ -103,15 +132,15 @@ export const deactivatorHandler= (moduleID)=>{
window.location.href = sgsbSettingsURL;
}
});
-
+
}
export const removeHashFromURL = (url) => {
if (url.startsWith('#/')) {
- return url.slice(2); // Remove "#/"
+ return url.slice(2); // Remove "#/"
} else if (url.startsWith('#')) {
- return url.slice(1); // Remove "#"
+ return url.slice(1); // Remove "#"
} else {
- return url; // No change needed
+ return url; // No change needed
}
}
From 758f0591b289883df053ffc1c5f6a0b7c57a89dd Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Wed, 14 Feb 2024 10:56:49 +0600
Subject: [PATCH 05/25] add state
---
assets/src/components/initail-setup/Ready.jsx | 21 ++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/assets/src/components/initail-setup/Ready.jsx b/assets/src/components/initail-setup/Ready.jsx
index 81a232dd..0ef967b6 100644
--- a/assets/src/components/initail-setup/Ready.jsx
+++ b/assets/src/components/initail-setup/Ready.jsx
@@ -1,13 +1,23 @@
import { Fragment } from "react";
+import { useState } from '@wordpress/element';
import { Switch } from 'antd';
import { __ } from "@wordpress/i18n";
const Ready = () => {
+ const [updateNews, setupdateNews] = useState(true);
+ const [userDetails, setUserdetails] = useState(true);
- const onChange = (checked) => {
- console.log(`switch to ${checked}`);
- };
+ const getUserDetails=()=> {
+ if (updateNews === true || userDetails === true) {
+ console.log("Send Data");
+ } else {
+ return;
+ }
+ }
+
+ console.log(updateNews);
+ console.log(userDetails);
return (
@@ -32,6 +42,7 @@ const Ready = () => {
{__(`Ready To Go`, "storegrowth-sales-booster")}
@@ -62,14 +73,14 @@ const Ready = () => {
-
+
{ setupdateNews(checked) }} />
{__('Get Updates', "storegrowth-sales-booster")}
{__('We will send essential tips & tricks for effective usage of StoreGrowth.', "storegrowth-sales-booster")}
-
+
{ setUserdetails(checked) }} />
{__('Share Essentials', "storegrowth-sales-booster")}
{__('Let us collect non-sensitive diagnosis data and usage information.', "storegrowth-sales-booster")}
From 6d2911ae8edfda1a1541ee83defac1a77c1c37b4 Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Wed, 21 Feb 2024 13:12:32 +0600
Subject: [PATCH 06/25] initial setup step
---
Includes/functions.php | 15 +++++++
assets/src/components/initail-setup/Ready.jsx | 42 ++++++++++++++-----
2 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/Includes/functions.php b/Includes/functions.php
index 1b86f763..96f04b6a 100644
--- a/Includes/functions.php
+++ b/Includes/functions.php
@@ -166,3 +166,18 @@ function storegrowth_sales_booster_start_plugin_tracking() {
storegrowth_sales_booster_start_plugin_tracking();
}
+/**
+ * Register ajax callback
+ */
+add_action('wp_ajax_sgsb_get_user_concent_data', 'sgsb_get_user_concent_data');
+
+/**
+ * Get User Concent Data
+ */
+function sgsb_get_user_concent_data() {
+ // check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
+ error_log('true');
+ print_r($_POST);
+ wp_send_json_success(array('message' => 'Success message'));
+ wp_die();
+}
diff --git a/assets/src/components/initail-setup/Ready.jsx b/assets/src/components/initail-setup/Ready.jsx
index 0ef967b6..93cfdf69 100644
--- a/assets/src/components/initail-setup/Ready.jsx
+++ b/assets/src/components/initail-setup/Ready.jsx
@@ -1,5 +1,5 @@
import { Fragment } from "react";
-import { useState } from '@wordpress/element';
+import { useState, useEffect } from '@wordpress/element';
import { Switch } from 'antd';
import { __ } from "@wordpress/i18n";
@@ -7,17 +7,39 @@ const Ready = () => {
const [updateNews, setupdateNews] = useState(true);
const [userDetails, setUserdetails] = useState(true);
- const getUserDetails=()=> {
- if (updateNews === true || userDetails === true) {
- console.log("Send Data");
- } else {
- return;
- }
- }
+ useEffect(() => {
+ const getUserDetails = async () => {
+ console.log('true');
+ try {
+ if (updateNews === true || userDetails === true) {
+ const response = await fetch('/wp-admin/admin-ajax.php', {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ },
+ body: new URLSearchParams({
+ _ajax_nonce: sgsbAdmin.nonce,
+ action: 'sgsb_get_user_concent_data',
+ }),
+ });
+ if (!response.ok) {
+ throw new Error('Network response was not ok');
+ }
- console.log(updateNews);
- console.log(userDetails);
+ const data = await response.json();
+ console.log(data);
+ }
+ } catch (error) {
+ console.error('Error fetching license key:', error);
+ }
+ };
+
+ getUserDetails(); // Call getUserDetails within useEffect
+ }, []);
+ };
+
return (
From 89fd8221c7def4c7687634abe448e8f263899fe9 Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Wed, 28 Feb 2024 10:51:16 +0600
Subject: [PATCH 07/25] added ajax for user concent
---
Includes/Ajax.php | 14 ++++++
Includes/functions.php | 15 -------
assets/src/components/initail-setup/Ready.jsx | 43 ++++++-------------
3 files changed, 28 insertions(+), 44 deletions(-)
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index 1b3eb3ad..9cf7c222 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -26,6 +26,10 @@ class Ajax {
*/
private function __construct() {
add_action( 'wp_ajax_sgsb_admin_ajax', array( $this, 'admin_ajax' ) );
+ /**
+ * Register ajax callback
+ */
+ add_action('wp_ajax_sgsb_get_user_concent_data', array( $this,'sgsb_get_user_concent_data'));
}
/**
@@ -94,4 +98,14 @@ private function update_module_status() {
wp_send_json_success();
}
+ /**
+ * Get User Concent Data
+ */
+ public function sgsb_get_user_concent_data() {
+ error_log('called');
+ check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
+ error_log('true');
+ print_r($_POST);
+ wp_send_json_success(array('message' => 'Success message'));
+ }
}
diff --git a/Includes/functions.php b/Includes/functions.php
index 96f04b6a..1b86f763 100644
--- a/Includes/functions.php
+++ b/Includes/functions.php
@@ -166,18 +166,3 @@ function storegrowth_sales_booster_start_plugin_tracking() {
storegrowth_sales_booster_start_plugin_tracking();
}
-/**
- * Register ajax callback
- */
-add_action('wp_ajax_sgsb_get_user_concent_data', 'sgsb_get_user_concent_data');
-
-/**
- * Get User Concent Data
- */
-function sgsb_get_user_concent_data() {
- // check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
- error_log('true');
- print_r($_POST);
- wp_send_json_success(array('message' => 'Success message'));
- wp_die();
-}
diff --git a/assets/src/components/initail-setup/Ready.jsx b/assets/src/components/initail-setup/Ready.jsx
index 93cfdf69..f2dd760a 100644
--- a/assets/src/components/initail-setup/Ready.jsx
+++ b/assets/src/components/initail-setup/Ready.jsx
@@ -9,36 +9,21 @@ const Ready = () => {
useEffect(() => {
const getUserDetails = async () => {
- console.log('true');
- try {
- if (updateNews === true || userDetails === true) {
- const response = await fetch('/wp-admin/admin-ajax.php', {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- body: new URLSearchParams({
- _ajax_nonce: sgsbAdmin.nonce,
- action: 'sgsb_get_user_concent_data',
- }),
- });
+ const response = await fetch('/wp-admin/admin-ajax.php', {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ },
+ body: new URLSearchParams({
+ _ajax_nonce: sgsbAdmin.nonce,
+ action: 'sgsb_get_user_concent_data',
+ }),
+ });
+ };
- if (!response.ok) {
- throw new Error('Network response was not ok');
- }
-
- const data = await response.json();
- console.log(data);
- }
- } catch (error) {
- console.error('Error fetching license key:', error);
- }
- };
-
- getUserDetails(); // Call getUserDetails within useEffect
+ getUserDetails();
}, []);
- };
return (
@@ -64,7 +49,7 @@ const Ready = () => {
{__(`Ready To Go`, "storegrowth-sales-booster")}
From c2f33a0a8d52e20fe2acd638f225f12fdee72798 Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Sun, 10 Mar 2024 16:13:37 +0600
Subject: [PATCH 08/25] update state and action
---
Includes/Ajax.php | 6 +--
assets/src/components/initail-setup/Ready.jsx | 40 ---------------
.../src/components/initail-setup/Welcome.jsx | 49 ++++++++++++++++++-
3 files changed, 51 insertions(+), 44 deletions(-)
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index 9cf7c222..c159bbce 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -7,6 +7,7 @@
namespace STOREGROWTH\SPSB;
+use STOREGROWTH\SPSB\Admin\WPInsightsStoreGrowthSalesBooster;
use STOREGROWTH\SPSB\Traits\Singleton;
// If this file is called directly, abort.
@@ -102,10 +103,9 @@ private function update_module_status() {
* Get User Concent Data
*/
public function sgsb_get_user_concent_data() {
- error_log('called');
check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
- error_log('true');
- print_r($_POST);
+ error_log("response". print_r($_POST,1));
wp_send_json_success(array('message' => 'Success message'));
+ wp_die();
}
}
diff --git a/assets/src/components/initail-setup/Ready.jsx b/assets/src/components/initail-setup/Ready.jsx
index f2dd760a..2272e219 100644
--- a/assets/src/components/initail-setup/Ready.jsx
+++ b/assets/src/components/initail-setup/Ready.jsx
@@ -1,30 +1,7 @@
import { Fragment } from "react";
-import { useState, useEffect } from '@wordpress/element';
-import { Switch } from 'antd';
import { __ } from "@wordpress/i18n";
const Ready = () => {
- const [updateNews, setupdateNews] = useState(true);
- const [userDetails, setUserdetails] = useState(true);
-
- useEffect(() => {
- const getUserDetails = async () => {
- const response = await fetch('/wp-admin/admin-ajax.php', {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- body: new URLSearchParams({
- _ajax_nonce: sgsbAdmin.nonce,
- action: 'sgsb_get_user_concent_data',
- }),
- });
- };
-
- getUserDetails();
- }, []);
-
return (
@@ -77,23 +54,6 @@ const Ready = () => {
-
-
-
-
{ setupdateNews(checked) }} />
-
-
{__('Get Updates', "storegrowth-sales-booster")}
-
{__('We will send essential tips & tricks for effective usage of StoreGrowth.', "storegrowth-sales-booster")}
-
-
-
-
{ setUserdetails(checked) }} />
-
-
{__('Share Essentials', "storegrowth-sales-booster")}
-
{__('Let us collect non-sensitive diagnosis data and usage information.', "storegrowth-sales-booster")}
-
-
-
);
diff --git a/assets/src/components/initail-setup/Welcome.jsx b/assets/src/components/initail-setup/Welcome.jsx
index f2fa96d9..4dc63592 100644
--- a/assets/src/components/initail-setup/Welcome.jsx
+++ b/assets/src/components/initail-setup/Welcome.jsx
@@ -1,14 +1,61 @@
import { Fragment } from 'react'
+import { useState, useEffect } from '@wordpress/element';
+import { Switch } from 'antd';
import { __ } from '@wordpress/i18n';
const Welcome = ( {next}) => {
+ const [updateNews, setupdateNews] = useState(true);
+ const [userDetails, setUserdetails] = useState(true);
+
+ const getUserDetails = async () => {
+ try {
+ const response = await fetch('/wp-admin/admin-ajax.php', {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ },
+ body: new URLSearchParams({
+ _ajax_nonce: sgsbAdmin.nonce,
+ action: 'sgsb_get_user_concent_data',
+ updateNews,
+ userDetails,
+ }),
+ });
+
+ if (!response.ok) {
+ throw new Error('Network response was not ok');
+ }
+
+ const responseData = await response.json();
+ console.log(responseData);
+ } catch (error) {
+ console.error('Error fetching user details:', error);
+ }
+ };
return (
{__("Welcome To ", "storegrowth-sales-booster")} {__("StoreGrowth", "storegrowth-sales-booster")}
{__(`# 1 Marketing Plugin For WooCommerce
of StoreGrowth Turbocharge Your WooCommerce Store’s Sales!`, 'storegrowth-sales-booster')}
-
{__(`Get Started`, 'storegrowth-sales-booster')}
+
+
+
{ setupdateNews(checked) }} />
+
+
{__('Get Updates', "storegrowth-sales-booster")}
+
{__('We will send essential tips & tricks for effective usage of StoreGrowth.', "storegrowth-sales-booster")}
+
+
+
+
{ setUserdetails(checked) }} />
+
+
{__('Share Essentials', "storegrowth-sales-booster")}
+
{__('Let us collect non-sensitive diagnosis data and usage information.', "storegrowth-sales-booster")}
+
+
+
+
{ next(); getUserDetails(); }} type="button" className='steps-button get-started'>{__(`Get Started`, 'storegrowth-sales-booster')}
)
From 390e4fb5bbb3f2da79a44effe524b5ebf708a576 Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Mon, 11 Mar 2024 13:24:42 +0600
Subject: [PATCH 09/25] docs: multiple spelling and docs changes
---
.../assets/src/components/ButtonAction.js | 2 +-
.../StockBar/assets/src/components/SettingInstruction.js | 2 +-
assets/src/components/dashboard/Overview.js | 2 +-
assets/src/components/dashboard/PremiumBox.js | 2 +-
assets/src/components/modules/PremiumBox.js | 2 +-
assets/src/components/settings/HeadBar.js | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Includes/Modules/FloatingNotificationBar/assets/src/components/ButtonAction.js b/Includes/Modules/FloatingNotificationBar/assets/src/components/ButtonAction.js
index 6d7e8390..03ac3e57 100644
--- a/Includes/Modules/FloatingNotificationBar/assets/src/components/ButtonAction.js
+++ b/Includes/Modules/FloatingNotificationBar/assets/src/components/ButtonAction.js
@@ -7,7 +7,7 @@ const ButtonAction = ({ formData, onFieldChange }) => {
const buttonActionOptions = [
{
value: "ba-url-redirect",
- label: __("Url Redirect", "storegrowth-sales-booster"),
+ label: __("URL Redirect", "storegrowth-sales-booster"),
},
{
value: "ba-close",
diff --git a/Includes/Modules/StockBar/assets/src/components/SettingInstruction.js b/Includes/Modules/StockBar/assets/src/components/SettingInstruction.js
index 910d8a75..fd58e559 100644
--- a/Includes/Modules/StockBar/assets/src/components/SettingInstruction.js
+++ b/Includes/Modules/StockBar/assets/src/components/SettingInstruction.js
@@ -48,7 +48,7 @@ const SettingInstruction = () => {
)
}
>
- Documentaion
+ Documentation
diff --git a/assets/src/components/dashboard/Overview.js b/assets/src/components/dashboard/Overview.js
index 0b6e11e0..471ad5d2 100644
--- a/assets/src/components/dashboard/Overview.js
+++ b/assets/src/components/dashboard/Overview.js
@@ -38,7 +38,7 @@ const Overview = () => {
{/* intro-section */}
diff --git a/assets/src/components/dashboard/PremiumBox.js b/assets/src/components/dashboard/PremiumBox.js
index 3ceda461..30b1dd5f 100644
--- a/assets/src/components/dashboard/PremiumBox.js
+++ b/assets/src/components/dashboard/PremiumBox.js
@@ -19,7 +19,7 @@ function PremiumBox() {
support and boost your
website’s visibility.
-
+
Get Premium
-
+
Get Premium
Get Premium
From ab335194f926a4752149db18d04f8a392ea9853e Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Mon, 11 Mar 2024 18:22:17 +0600
Subject: [PATCH 10/25] send user data to api
---
.../WPInsightsStoreGrowthSalesBooster.php | 925 ------------------
Includes/Ajax.php | 176 +++-
Includes/functions.php | 38 -
.../src/components/initail-setup/Welcome.jsx | 2 +-
4 files changed, 169 insertions(+), 972 deletions(-)
delete mode 100644 Includes/Admin/WPInsightsStoreGrowthSalesBooster.php
diff --git a/Includes/Admin/WPInsightsStoreGrowthSalesBooster.php b/Includes/Admin/WPInsightsStoreGrowthSalesBooster.php
deleted file mode 100644
index 58b80300..00000000
--- a/Includes/Admin/WPInsightsStoreGrowthSalesBooster.php
+++ /dev/null
@@ -1,925 +0,0 @@
-plugin_file = $plugin_file;
- $this->plugin_name = basename( $this->plugin_file, '.php' );
- $this->disabled_wp_cron = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON == true;
- $this->enable_self_cron = $this->disabled_wp_cron == true ? true : false;
-
- $this->event_hook = 'put_do_weekly_action';
-
- $this->require_optin = isset( $args['opt_in'] ) ? $args['opt_in'] : true;
- $this->include_goodbye_form = isset( $args['goodbye_form'] ) ? $args['goodbye_form'] : true;
- $this->marketing = isset( $args['email_marketing'] ) ? $args['email_marketing'] : true;
- $this->options = isset( $args['options'] ) ? $args['options'] : array();
- $this->item_id = isset( $args['item_id'] ) ? $args['item_id'] : false;
-
- /**
- * Activation Hook
- */
- register_activation_hook( $this->plugin_file, array( $this, 'activate_this_plugin' ) );
-
- /**
- * Deactivation Hook
- */
- register_deactivation_hook( $this->plugin_file, array( $this, 'deactivate_this_plugin' ) );
- }
-
- /**
- * When user agreed to opt-in tracking schedule is enabled.
- *
- * @since 3.0.0
- */
- public function schedule_tracking() {
- if ( $this->disabled_wp_cron ) {
- return;
- }
-
- if ( ! wp_next_scheduled( $this->event_hook ) ) {
- wp_schedule_event( time(), $this->recurrence, $this->event_hook );
- }
- }
-
- /**
- * Add the schedule event if the plugin is tracked.
- *
- * @return void
- */
- public function activate_this_plugin() {
- $allow_tracking = $this->is_tracking_allowed();
- if ( ! $allow_tracking ) {
- return;
- }
- $this->schedule_tracking();
- }
-
- /**
- * Remove the schedule event when plugin is deactivated and send the deactivated reason to inishghts if user submitted.
- *
- * @since 3.0.0
- */
- public function deactivate_this_plugin() {
- // Check tracking is allowed or not.
- $allow_tracking = $this->is_tracking_allowed();
- if ( ! $allow_tracking ) {
- return;
- }
-
- $body = $this->get_data();
- $body['status'] = 'Deactivated';
- $body['deactivated_date'] = time();
-
- // Check deactivation reason and add for insights data.
- if ( false !== get_option( 'wpins_deactivation_reason_' . $this->plugin_name ) ) {
- $body['deactivation_reason'] = get_option( 'wpins_deactivation_reason_' . $this->plugin_name );
- }
-
- if ( false !== get_option( 'wpins_deactivation_details_' . $this->plugin_name ) ) {
- $body['deactivation_details'] = get_option( 'wpins_deactivation_details_' . $this->plugin_name );
- }
-
- $this->send_data( $body );
-
- delete_option( 'wpins_deactivation_reason_' . $this->plugin_name );
- delete_option( 'wpins_deactivation_details_' . $this->plugin_name );
-
- /**
- * Clear the event schedule.
- */
- if ( ! $this->disabled_wp_cron ) {
- wp_clear_scheduled_hook( $this->event_hook );
- }
- }
- /**
- * Initial Method to Hook Everything.
- *
- * @return void
- */
- public function init() {
- $this->clicked();
- add_action( $this->event_hook, array( $this, 'do_tracking' ) );
- // For Test
- // add_action( 'admin_init', array( $this, 'force_tracking' ) );
- add_action( 'admin_notices', array( $this, 'notice' ) );
-
- /**
- * Deactivation Reason Form and Submit Data to Insights.
- */
- add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'deactivate_action_links' ) );
- add_action( 'admin_footer-plugins.php', array( $this, 'deactivate_reasons_form' ) );
- add_action( 'wp_ajax_deactivation_form_' . esc_attr( $this->plugin_name ), array( $this, 'deactivate_reasons_form_submit' ) );
- }
- /**
- * For Redirecting Current Page without Arguments!
- *
- * @return void
- */
- private function redirect_to() {
- $request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
- $query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
- parse_str( $query_string, $current_url );
-
- $unset_array = array( 'dismiss', 'plugin', '_wpnonce', 'later', 'plugin_action', 'marketing_optin' );
-
- foreach ( $unset_array as $value ) {
- if ( isset( $current_url[ $value ] ) ) {
- unset( $current_url[ $value ] );
- }
- }
-
- $current_url = http_build_query( $current_url );
- $redirect_url = $request_uri . '?' . $current_url;
-
- return $redirect_url;
- }
-
- /**
- * This method is responsible for all the magic from the front of the plugin.
- *
- * @since 3.0.0
- * @param bool $force Force tracking if it's not the correct time to track.
- */
- public function do_tracking( $force = false ) {
- /**
- * Check URL is set or not.
- */
- if ( empty( self::API_URL ) ) {
- return;
- }
- /**
- * Check is tracking allowed or not.
- */
- if ( ! $this->is_tracking_allowed() ) {
- return;
- }
- /**
- * Check is this the correct time to track or not.
- * or Force to track.
- */
- if ( ! $this->is_time_to_track() && ! $force ) {
- return;
- }
- /**
- * Get All Data.
- */
- $body = $this->get_data();
- /**
- * Send all data.
- */
- return $this->send_data( $body );
- }
- /**
- * Is tracking allowed?
- *
- * @since 1.0.0
- */
- private function is_tracking_allowed() {
- // First, check if the user has changed their mind and opted out of tracking
- if ( $this->has_user_opted_out() ) {
- $this->set_is_tracking_allowed( false, $this->plugin_name );
- return false;
- }
- // The wpins_allow_tracking option is an array of plugins that are being tracked
- $allow_tracking = get_option( 'wpins_allow_tracking' );
- // If this plugin is in the array, then tracking is allowed
- if ( isset( $allow_tracking[ $this->plugin_name ] ) ) {
- return true;
- }
- return false;
- }
- /**
- * Set a flag in DB If tracking is allowed.
- *
- * @since 3.0.0
- * @param $is_allowed Boolean true if is allowed.
- */
- protected function set_is_tracking_allowed( $is_allowed, $plugin = null ) {
- if ( empty( $plugin ) ) {
- $plugin = $this->plugin_name;
- }
- /**
- * Get All Tracked Plugin List using this Tracker.
- */
- $allow_tracking = get_option( 'wpins_allow_tracking' );
- /**
- * Check user is opted out for tracking or not.
- */
- if ( $this->has_user_opted_out() ) {
- if ( isset( $allow_tracking[ $plugin ] ) ) {
- unset( $allow_tracking[ $plugin ] );
- }
- } elseif ( $is_allowed || ! $this->require_optin ) {
- /**
- * If user has agreed to allow tracking
- */
- if ( empty( $allow_tracking ) || ! is_array( $allow_tracking ) ) {
- $allow_tracking = array( $plugin => $plugin );
- } else {
- $allow_tracking[ $plugin ] = $plugin;
- }
- } elseif ( isset( $allow_tracking[ $plugin ] ) ) {
- unset( $allow_tracking[ $plugin ] );
- }
- update_option( 'wpins_allow_tracking', $allow_tracking );
- }
-
- /**
- * Check the user has opted out or not.
- *
- * @since 3.0.0
- * @return Boolean
- */
- protected function has_user_opted_out() {
- if ( ! empty( $this->options ) ) {
- foreach ( $this->options as $option_name ) {
- $options = get_option( $option_name );
- if ( ! empty( $options['wpins_opt_out'] ) ) {
- return true;
- }
- }
- }
- return false;
- }
- /**
- * Check if it's time to track
- *
- * @since 3.0.0
- */
- public function is_time_to_track() {
- $track_times = get_option( 'wpins_last_track_time', array() );
- return ! isset( $track_times[ $this->plugin_name ] ) ? true :
- ( ( isset( $track_times[ $this->plugin_name ] ) && $track_times[ $this->plugin_name ] ) < strtotime( '-1 day' ) ? true : false );
- }
- /**
- * Set tracking time.
- *
- * @since 3.0.0
- */
- public function set_track_time() {
- $track_times = get_option( 'wpins_last_track_time', array() );
- $track_times[ $this->plugin_name ] = time();
- update_option( 'wpins_last_track_time', $track_times );
- }
- /**
- * This method is responsible for collecting all data.
- *
- * @since 3.0.0
- */
- public function get_data() {
- $body = array(
- 'plugin_slug' => sanitize_text_field( $this->plugin_name ),
- 'url' => get_bloginfo( 'url' ),
- 'site_name' => get_bloginfo( 'name' ),
- 'site_version' => get_bloginfo( 'version' ),
- 'site_language' => get_bloginfo( 'language' ),
- 'charset' => get_bloginfo( 'charset' ),
- 'wpins_version' => self::WPINS_VERSION,
- 'php_version' => phpversion(),
- 'multisite' => is_multisite(),
- 'file_location' => __FILE__,
- );
-
- // Collect the email if the correct option has been set
- if ( $this->marketing ) {
- if ( ! function_exists( 'wp_get_current_user' ) ) {
- include ABSPATH . 'wp-includes/pluggable.php';
- }
- $current_user = wp_get_current_user();
- $email = $current_user->user_email;
- if ( is_email( $email ) ) {
- $body['email'] = $email;
- }
- }
- $body['marketing_method'] = $this->marketing;
- $body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
-
- /**
- * Collect all active and inactive plugins
- */
- if ( ! function_exists( 'get_plugins' ) ) {
- include ABSPATH . '/wp-admin/includes/plugin.php';
- }
- $plugins = array_keys( get_plugins() );
- $active_plugins = is_network_admin() ? array_keys( get_site_option( 'active_sitewide_plugins', array() ) ) : get_option( 'active_plugins', array() );
- foreach ( $plugins as $key => $plugin ) {
- if ( in_array( $plugin, $active_plugins ) ) {
- unset( $plugins[ $key ] );
- }
- }
- $body['active_plugins'] = $active_plugins;
- $body['inactive_plugins'] = $plugins;
-
- /**
- * Text Direction.
- */
- $body['text_direction'] = ( function_exists( 'is_rtl' ) ? ( is_rtl() ? 'RTL' : 'LTR' ) : 'NOT SET' );
- /**
- * Get Our Plugin Data.
- *
- * @since 3.0.0
- */
- $plugin = $this->plugin_data();
- if ( empty( $plugin ) ) {
- $body['message'] .= __( 'We can\'t detect any plugin information. This is most probably because you have not included the code in the plugin main file.', 'plugin-usage-tracker' );
- $body['status'] = 'NOT FOUND';
- } else {
- if ( isset( $plugin['Name'] ) ) {
- $body['plugin'] = sanitize_text_field( $plugin['Name'] );
- }
- if ( isset( $plugin['Version'] ) ) {
- $body['version'] = sanitize_text_field( $plugin['Version'] );
- }
- $body['status'] = 'Active';
- }
-
- /**
- * Get active theme name and version
- *
- * @since 3.0.0
- */
- $theme = wp_get_theme();
- if ( $theme->Name ) {
- $body['theme'] = sanitize_text_field( $theme->Name );
- }
- if ( $theme->Version ) {
- $body['theme_version'] = sanitize_text_field( $theme->Version );
- }
- return $body;
- }
-
- /**
- * Collect plugin data,
- * Retrieve current plugin information
- *
- * @since 3.0.0
- */
- public function plugin_data() {
- if ( ! function_exists( 'get_plugin_data' ) ) {
- include ABSPATH . '/wp-admin/includes/plugin.php';
- }
- $plugin = get_plugin_data( $this->plugin_file );
- return $plugin;
- }
- /**
- * Send the data to insights.
- *
- * @since 3.0.0
- */
- public function send_data( $body ) {
- /**
- * Get SITE ID
- */
- $site_id_key = "wpins_{$this->plugin_name}_site_id";
- $site_id = get_option( $site_id_key, false );
- $failed_data = array();
- $site_url = get_bloginfo( 'url' );
- $original_site_url = get_option( "wpins_{$this->plugin_name}_original_url", false );
- if ( $original_site_url === false && version_compare( $body['wpins_version'], '3.0.1', '==' ) ) {
- $site_id = false;
- }
- /**
- * Send Initial Data to API
- */
- if ( $site_id == false && $this->item_id !== false && $original_site_url === false ) {
- if ( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' ) ) {
- $country_request = wp_remote_get( 'http://ip-api.com/json/' . $_SERVER['REMOTE_ADDR'] . '?fields=country' );
- if ( ! is_wp_error( $country_request ) && $country_request['response']['code'] == 200 ) {
- $ip_data = json_decode( $country_request['body'] );
- $body['country'] = isset( $ip_data->country ) ? $ip_data->country : 'NOT SET';
- }
- }
-
- $body['plugin_slug'] = $this->plugin_name;
- $body['url'] = $site_url;
- $body['item_id'] = $this->item_id;
-
- $request = $this->remote_post( $body );
- if ( ! is_wp_error( $request ) && $request['response']['code'] == 200 ) {
- $retrieved_body = json_decode( wp_remote_retrieve_body( $request ), true );
- if ( is_array( $retrieved_body ) && isset( $retrieved_body['siteId'] ) ) {
- update_option( $site_id_key, $retrieved_body['siteId'] );
- update_option( "wpins_{$this->plugin_name}_original_url", $site_url );
- update_option( "wpins_{$this->plugin_name}_{$retrieved_body['siteId']}", $body );
- }
- } else {
- $failed_data = $body;
- }
- }
-
- $site_id_data_key = "wpins_{$this->plugin_name}_{$site_id}";
- $site_id_data_failed_key = "wpins_{$this->plugin_name}_{$site_id}_send_failed";
-
- if ( $site_id != false ) {
- $old_sent_data = get_option( $site_id_data_key, array() );
- $diff_data = $this->diff( $body, $old_sent_data );
- $failed_data = get_option( $site_id_data_failed_key, array() );
- if ( ! empty( $failed_data ) && $diff_data != $failed_data ) {
- $failed_data = array_merge( $failed_data, $diff_data );
- }
- }
-
- if ( ! empty( $failed_data ) && $site_id != false ) {
- $failed_data['plugin_slug'] = $this->plugin_name;
- $failed_data['url'] = $site_url;
- $failed_data['site_id'] = $site_id;
- if ( $original_site_url != false ) {
- $failed_data['original_url'] = $original_site_url;
- }
-
- $request = $this->remote_post( $failed_data );
- if ( ! is_wp_error( $request ) ) {
- delete_option( $site_id_data_failed_key );
- $replaced_data = array_merge( $old_sent_data, $failed_data );
- update_option( $site_id_data_key, $replaced_data );
- }
- }
-
- if ( ! empty( $diff_data ) && $site_id != false && empty( $failed_data ) ) {
- $diff_data['plugin_slug'] = $this->plugin_name;
- $diff_data['url'] = $site_url;
- $diff_data['site_id'] = $site_id;
- if ( $original_site_url != false ) {
- $diff_data['original_url'] = $original_site_url;
- }
-
- $request = $this->remote_post( $diff_data );
- if ( is_wp_error( $request ) ) {
- update_option( $site_id_data_failed_key, $diff_data );
- } else {
- $replaced_data = array_merge( $old_sent_data, $diff_data );
- update_option( $site_id_data_key, $replaced_data );
- }
- }
-
- $this->set_track_time();
-
- if ( isset( $request ) && is_wp_error( $request ) ) {
- return $request;
- }
-
- if ( isset( $request ) ) {
- return true;
- }
- return false;
- }
- /**
- * WP_REMOTE_POST method responsible for send data to the API_URL
- *
- * @param array $data
- * @param array $args
- * @return void
- */
- protected function remote_post( $data = array(), $args = array() ) {
- if ( empty( $data ) ) {
- return;
- }
-
- $args = wp_parse_args(
- $args,
- array(
- 'method' => 'POST',
- 'timeout' => 30,
- 'redirection' => 5,
- 'httpversion' => '1.1',
- 'blocking' => true,
- 'body' => $data,
- 'user-agent' => 'PUT/1.0.0; ' . get_bloginfo( 'url' ),
- )
- );
-
- $request = wp_remote_post( esc_url( self::API_URL ), $args );
- if ( is_wp_error( $request ) || ( isset( $request['response'], $request['response']['code'] ) && $request['response']['code'] != 200 ) ) {
- return new WP_Error( 500, 'Something went wrong.' );
- }
- return $request;
- }
- /**
- * Difference between old and new data
- *
- * @param array $new_data
- * @param array $old_data
- * @return void
- */
- protected function diff( $new_data, $old_data ) {
- $data = array();
- if ( ! empty( $new_data ) ) {
- foreach ( $new_data as $key => $value ) {
- if ( isset( $old_data[ $key ] ) ) {
- if ( $old_data[ $key ] == $value ) {
- continue;
- }
- }
- $data[ $key ] = $value;
- }
- }
- return $data;
- }
- /**
- * Display the admin notice to users to allow them to opt in
- *
- * @since 3.0.0
- */
- public function notice() {
- /**
- * Return if notice is not set.
- */
- if ( ! isset( $this->notice_options['notice'] ) ) {
- return;
- }
- /**
- * Check is allowed or blocked for notice.
- */
- $block_notice = get_option( 'wpins_block_notice' );
- if ( isset( $block_notice[ $this->plugin_name ] ) ) {
- return;
- }
- if ( ! current_user_can( 'manage_options' ) ) {
- return;
- }
-
- $url_yes = add_query_arg(
- array(
- 'plugin' => $this->plugin_name,
- 'plugin_action' => 'yes',
- )
- );
- $url_no = add_query_arg(
- array(
- 'plugin' => $this->plugin_name,
- 'plugin_action' => 'no',
- )
- );
-
- // Decide on notice text
- $notice_text = $this->notice_options['notice'] . ' ' . $this->notice_options['consent_button_text'] . ' ';
- $extra_notice_text = $this->notice_options['extra_notice'];
-
- $output = '';
- $output .= '';
-
- echo $output;
- }
- /**
- * Set all notice options to customized notice.
- *
- * @since 3.0.0
- * @param array $options
- * @return void
- */
- public function set_notice_options( $options = array() ) {
- $default_options = array(
- 'consent_button_text' => __( 'What we collect.', 'wpinsight' ),
- 'yes' => __( 'Sure, I\'d like to help', 'wpinsight' ),
- 'no' => __( 'No Thanks.', 'wpinsight' ),
- );
- $options = wp_parse_args( $options, $default_options );
- $this->notice_options = $options;
- }
- /**
- * Responsible for track the click from Notice.
- *
- * @return void
- */
- public function clicked() {
- if ( isset( $_GET['plugin'] ) && isset( $_GET['plugin_action'] ) ) {
- if ( isset( $_GET['tab'] ) && $_GET['tab'] === 'plugin-information' ) {
- return;
- }
- $plugin = sanitize_text_field( $_GET['plugin'] );
- $action = sanitize_text_field( $_GET['plugin_action'] );
- if ( $action == 'yes' ) {
- $this->schedule_tracking();
- $this->set_is_tracking_allowed( true, $plugin );
- if ( $this->do_tracking( true ) ) {
- $this->update_block_notice( $plugin );
- }
- /**
- * Redirect User To the Current URL, but without set query arguments.
- */
- wp_safe_redirect( $this->redirect_to() );
- } else {
- $this->set_is_tracking_allowed( false, $plugin );
- $this->update_block_notice( $plugin );
- }
- }
- }
- /**
- * Set if we should block the opt-in notice for this plugin
- *
- * @since 3.0.0
- */
- public function update_block_notice( $plugin = null ) {
- if ( empty( $plugin ) ) {
- $plugin = $this->plugin_name;
- }
- $block_notice = get_option( 'wpins_block_notice' );
- if ( empty( $block_notice ) || ! is_array( $block_notice ) ) {
- $block_notice = array( $plugin => $plugin );
- } else {
- $block_notice[ $plugin ] = $plugin;
- }
- update_option( 'wpins_block_notice', $block_notice );
- }
- /**
- * AJAX callback when the deactivated form is submitted.
- *
- * @since 3.0.0
- */
- public function deactivate_reasons_form_submit() {
- check_ajax_referer( 'wpins_deactivation_nonce', 'security' );
- if ( isset( $_POST['values'] ) ) {
- $values = $_POST['values'];
- update_option( 'wpins_deactivation_reason_' . $this->plugin_name, $values );
- }
- if ( isset( $_POST['details'] ) ) {
- $details = sanitize_text_field( $_POST['details'] );
- update_option( 'wpins_deactivation_details_' . $this->plugin_name, $details );
- }
- echo 'success';
- wp_die();
- }
- /**
- * Filter the deactivation link to allow us to present a form when the user deactivates the plugin
- *
- * @since 3.0.0
- */
- public function deactivate_action_links( $links ) {
- /**
- * Check is tracking allowed or not.
- */
- if ( ! $this->is_tracking_allowed() ) {
- return $links;
- }
- if ( isset( $links['deactivate'] ) && $this->include_goodbye_form ) {
- $deactivation_link = $links['deactivate'];
- /**
- * Change the default deactivate button link.
- */
- $deactivation_link = str_replace( '
__( 'I found a better plugin', 'wpinsight' ),
- 'extra_field' => __( 'Please share which plugin', 'wpinsight' ),
- ),
- __( "I couldn't get the plugin to work", 'wpinsight' ),
- __( 'It\'s a temporary deactivation', 'wpinsight' ),
- array(
- 'label' => __( 'Other', 'wpinsight' ),
- 'extra_field' => __( 'Please share the reason', 'wpinsight' ),
- 'type' => 'textarea',
- ),
- );
- return apply_filters( 'wpins_form_text_' . $this->plugin_name, $form );
- }
- /**
- * Deactivate Reasons Form.
- * This form will appears when user wants to deactivate the plugin to send you deactivated reasons.
- *
- * @since 3.0.0
- */
- public function deactivate_reasons_form() {
- $form = $this->deactivation_reasons();
- $class_plugin_name = esc_attr( $this->plugin_name );
- $html = '' . esc_html( $form['heading'] ) . '
';
- $html .= '' . esc_html( $form['body'] ) . '
';
- if ( is_array( $form['options'] ) ) {
- $html .= '
';
- }
- $html .= '
';
- $html .= ' ' . __( 'Submitting form', 'wpinsight' ) . '
';
-
- $wrapper_class = '.wpinsights-goodbye-form-wrapper-' . $class_plugin_name;
-
- $styles = '';
- $styles .= '';
- $styles .= '';
-
- echo $styles;
- ?>
-
- plugin_file = plugin_dir_path(__FILE__) . 'storegrowth-sales-booster.php';
+ $this->plugin_name = basename( $this->plugin_file, '.php' );
add_action( 'wp_ajax_sgsb_admin_ajax', array( $this, 'admin_ajax' ) );
/**
* Register ajax callback
*/
- add_action('wp_ajax_sgsb_get_user_concent_data', array( $this,'sgsb_get_user_concent_data'));
+ add_action('wp_ajax_sgsb_process_user_concent_data', array( $this,'sgsb_process_user_concent_data'));
}
/**
@@ -100,12 +125,147 @@ private function update_module_status() {
wp_send_json_success();
}
/**
- * Get User Concent Data
+ * Collect plugin data,
+ * Retrieve current plugin information
+ *
+ * @since 3.0.0
*/
- public function sgsb_get_user_concent_data() {
- check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
- error_log("response". print_r($_POST,1));
- wp_send_json_success(array('message' => 'Success message'));
- wp_die();
+ public function plugin_data() {
+ if ( ! function_exists( 'get_plugin_data' ) ) {
+ include ABSPATH . '/wp-admin/includes/plugin.php';
+ }
+ $plugin = get_plugin_data( $this->plugin_file );
+ return $plugin;
}
+ public function sgsb_collect_non_sensitive_data(){
+ $body = array(
+ 'plugin_slug' => sanitize_text_field( $this->plugin_name ),
+ 'url' => get_bloginfo( 'url' ),
+ 'site_name' => get_bloginfo( 'name' ),
+ 'site_version' => get_bloginfo( 'version' ),
+ 'site_language' => get_bloginfo( 'language' ),
+ 'charset' => get_bloginfo( 'charset' ),
+ 'wpins_version' => self::INVZ_VERSION,
+ 'php_version' => phpversion(),
+ 'multisite' => is_multisite(),
+ 'file_location' => __FILE__,
+ );
+
+ // Collect the email if the correct option has been set
+
+ if ( ! function_exists( 'wp_get_current_user' ) ) {
+ include ABSPATH . 'wp-includes/pluggable.php';
+ }
+ $current_user = wp_get_current_user();
+ $email = $current_user->user_email;
+ if ( is_email( $email ) ) {
+ $body['email'] = $email;
+ }
+ $body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
+
+ /**
+ * Collect all active and inactive plugins
+ */
+ if ( ! function_exists( 'get_plugins' ) ) {
+ include ABSPATH . '/wp-admin/includes/plugin.php';
+ }
+ $plugins = array_keys( get_plugins() );
+ $active_plugins = is_network_admin() ? array_keys( get_site_option( 'active_sitewide_plugins', array() ) ) : get_option( 'active_plugins', array() );
+ foreach ( $plugins as $key => $plugin ) {
+ if ( in_array( $plugin, $active_plugins ) ) {
+ unset( $plugins[ $key ] );
+ }
+ }
+ $body['active_plugins'] = $active_plugins;
+ $body['inactive_plugins'] = $plugins;
+
+ /**
+ * Text Direction.
+ */
+ $body['text_direction'] = ( function_exists( 'is_rtl' ) ? ( is_rtl() ? 'RTL' : 'LTR' ) : 'NOT SET' );
+ /**
+ * Get Our Plugin Data.
+ *
+ * @since 3.0.0
+ */
+ $plugin = $this->plugin_data();
+ if ( empty( $plugin ) ) {
+ $body['message'] .= __( 'We can\'t detect any plugin information. This is most probably because you have not included the code in the plugin main file.', 'plugin-usage-tracker' );
+ $body['status'] = 'NOT FOUND';
+ } else {
+ if ( isset( $plugin['Name'] ) ) {
+ $body['plugin'] = sanitize_text_field( $plugin['Name'] );
+ }
+ if ( isset( $plugin['Version'] ) ) {
+ $body['version'] = sanitize_text_field( $plugin['Version'] );
+ }
+ $body['status'] = 'Active';
+ }
+
+ /**
+ * Get active theme name and version
+ *
+ * @since 3.0.0
+ */
+ $theme = wp_get_theme();
+ if ( $theme->Name ) {
+ $body['theme'] = sanitize_text_field( $theme->Name );
+ }
+ if ( $theme->Version ) {
+ $body['theme_version'] = sanitize_text_field( $theme->Version );
+ }
+ return $body;
+ }
+ /**
+ * Process Consent Data
+ */
+public function sgsb_process_user_concent_data() {
+ check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
+
+ // Collect non-sensitive data
+ $data_to_send = $this->sgsb_collect_non_sensitive_data();
+
+ // Prepare the request arguments
+ $request_args = array(
+ 'body' => json_encode($data_to_send),
+ 'headers' => array(
+ 'Content-Type' => 'application/json',
+ ),
+ 'timeout' => 30,
+ 'redirection' => 5,
+ 'blocking' => true,
+ 'httpversion' => '1.0',
+ 'sslverify' => false, // Change to true in production
+ 'data_format' => 'body',
+ );
+
+ // Send the request
+ $response = wp_remote_post(self::API_URL, $request_args);
+
+ // Check for errors
+ if (is_wp_error($response)) {
+ // Handle error
+ $error_message = $response->get_error_message();
+ // You can log the error message or return it to the caller
+ return new WP_Error('api_error', $error_message);
+ } else {
+ // Request was successful
+ // You may want to log or process the response data here if needed
+ $response_code = wp_remote_retrieve_response_code($response);
+ if ($response_code === 200) {
+ // Request successful, you can return success message or response data if any
+ $response_body = wp_remote_retrieve_body($response);
+ return $response_body;
+ } else {
+ // Request was not successful
+ // Handle the error accordingly
+ return new WP_Error('api_error', 'API returned unexpected response code: ' . $response_code);
+ }
+ }
+
+ // Send JSON success message after the API request is processed
+ wp_send_json_success(array('message' => 'Success message'));
+ wp_die();
+}
+
}
diff --git a/Includes/functions.php b/Includes/functions.php
index 0a2e7205..e577b3b7 100644
--- a/Includes/functions.php
+++ b/Includes/functions.php
@@ -5,8 +5,6 @@
* @package WPBP
*/
-use STOREGROWTH\SPSB\Admin\WPInsightsStoreGrowthSalesBooster;
-
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -131,39 +129,3 @@ function sgsb_sanitize_svg_icon_fields( $value ) {
return wp_kses( $value, $icon_allowed_html );
}
}
-
-
-if ( ! function_exists( 'storegrowth_sales_booster_start_plugin_tracking' ) ) {
-
- /**
- * This function allows you to track usage of your plugin
- */
- function storegrowth_sales_booster_start_plugin_tracking() {
- $tracker = WPInsightsStoreGrowthSalesBooster::get_instance(
- plugin_dir_path( __FILE__ ),
- array(
- 'opt_in' => true,
- 'goodbye_form' => true,
- 'item_id' => 'cdabb75e4451684da3a3',
- )
- );
-
- $tracker->set_notice_options(
- array(
- 'notice' => __( 'Never miss an important update!
- Opt in to get email notifications for security & feature updates, educational content, and occasional offers, and to share some basic WordPress environment info.', 'storegrowth-sales-booster' ),
- 'extra_notice' => __(
- 'We collect non-sensitive diagnostic data and plugin usage information.
- Your site URL, WordPress & PHP version, plugins & themes and email address to send you the
- discount coupon. This data lets us make sure this plugin always stays compatible with the most
- popular plugins and themes. No spam, I promise.',
- 'storegrowth-sales-booster'
- ),
- )
- );
-
- $tracker->init();
- }
-
- storegrowth_sales_booster_start_plugin_tracking();
-}
diff --git a/assets/src/components/initail-setup/Welcome.jsx b/assets/src/components/initail-setup/Welcome.jsx
index 4dc63592..53ed61db 100644
--- a/assets/src/components/initail-setup/Welcome.jsx
+++ b/assets/src/components/initail-setup/Welcome.jsx
@@ -17,7 +17,7 @@ const Welcome = ( {next}) => {
},
body: new URLSearchParams({
_ajax_nonce: sgsbAdmin.nonce,
- action: 'sgsb_get_user_concent_data',
+ action: 'sgsb_process_user_concent_data',
updateNews,
userDetails,
}),
From 347571c59d63f02047c206a3c8ad8f8823b47da1 Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Mon, 11 Mar 2024 18:27:41 +0600
Subject: [PATCH 11/25] desing: ini setup page redesign
---
assets/images/congrats-announce.svg | 56 +++
assets/images/welcome-announce.svg | 86 ++++
assets/src/admin.scss | 425 +++++++++++-------
.../initail-setup/ContentLayout.jsx | 14 +-
.../initail-setup/IniSetupLayout.jsx | 37 +-
.../src/components/initail-setup/Progress.jsx | 27 +-
assets/src/components/initail-setup/Ready.jsx | 85 ++--
.../src/components/initail-setup/Welcome.jsx | 35 +-
8 files changed, 522 insertions(+), 243 deletions(-)
create mode 100644 assets/images/congrats-announce.svg
create mode 100644 assets/images/welcome-announce.svg
diff --git a/assets/images/congrats-announce.svg b/assets/images/congrats-announce.svg
new file mode 100644
index 00000000..a6913c52
--- /dev/null
+++ b/assets/images/congrats-announce.svg
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/images/welcome-announce.svg b/assets/images/welcome-announce.svg
new file mode 100644
index 00000000..1ad9076a
--- /dev/null
+++ b/assets/images/welcome-announce.svg
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/src/admin.scss b/assets/src/admin.scss
index f10e3c6a..a19856b9 100644
--- a/assets/src/admin.scss
+++ b/assets/src/admin.scss
@@ -1844,6 +1844,7 @@ End Settings Sidebar
.dashicons {
color: #0875ff;
cursor: pointer;
+
&.dashicons-undo {
color: #0875ff;
cursor: pointer;
@@ -2169,6 +2170,7 @@ End Settings Sidebar
fill: #fff !important;
}
}
+
.radio-icon-stroke {
path {
fill: none !important;
@@ -2954,210 +2956,324 @@ End Settings Sidebar
gap: 20px;
padding-top: 26px;
background-color: #fff;
+ min-height: inherit;
- .storegrowth-icon {
- width: fit-content;
- margin: 20px auto;
-
- img {
- height: 38px;
- }
- }
-
- .sgsg-ini-setup-progress {
- width: 100%;
-
- .ant-steps-item-content {
- font-weight: 700;
- }
- }
-
- .sgsb-return-dashboard {
- .sgsb-dashboard-cta {
- height: auto;
- padding: 20px 30px;
- border-radius: 5px;
- border: none;
- background: #e3e9ff;
- }
- }
-
- .sgsb-ini-setup-content-layout {
- margin: 22px 36px;
- border-radius: 10px;
- background: #f4f7ff;
- padding: 60px 20px;
+ .sgsb-ini-page-container {
+ max-width: 1100px;
+ width: -webkit-fill-available;
+ display: flex;
+ flex-direction: column;
+ /* justify-content: center; */
+ align-items: center;
- .sgsb-steps-controller {
+ .storegrowth-icon {
+ width: 100%;
display: flex;
- gap: 10px;
- justify-content: flex-end;
+ justify-content: space-between;
+ gap: 12%;
+ // margin: 20px auto;
+
+ img {
+ height: 28px;
+ }
}
- .steps-button {
- padding: 12px 30px;
- border-radius: 6px;
- border: none;
- font-weight: 700;
- width: fit-content;
- cursor: pointer;
+ .sgsg-ini-setup-progress {
+ width: 100%;
- &.next {
- color: #fff;
- background-color: #0875ff;
+ .ant-steps-item-content {
+ font-weight: 700;
}
+ }
- &.previous {
- color: #073b4c;
- background-color: #e3e9ff;
+ .sgsb-return-dashboard {
+ .sgsb-dashboard-cta {
+ height: auto;
+ padding: 20px 30px;
+ border-radius: 5px;
+ border: none;
+ background: #e3e9ff;
}
+ }
- &.completion-cta {
- color: #fff;
- background-color: #0875ff;
- }
+ .sgsb-ini-setup-content-layout {
- &.doc-cta {
- color: #fff;
- background: #000000;
+ .sgsb-steps-controller {
+ display: flex;
+ gap: 10px;
+ justify-content: center;
}
- &.support-cta {
- color: #073b4c;
- background-color: #dde6f9;
- }
- }
+ .steps-button {
+ padding: 12px 30px;
+ border-radius: 6px;
+ border: none;
+ font-weight: 700;
+ width: fit-content;
+ cursor: pointer;
- // Welcome step layout
- .sgsb-ini-setup-welcome {
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
+ &.next {
+ color: #fff;
+ background-color: #0875ff;
+ }
- .sgsb-content-heading {
- color: var(--Secoundary-Color, #073b4c);
- text-align: center;
- font-size: 36px;
- font-style: normal;
- font-weight: 700;
- line-height: normal;
- margin: 0;
+ &.previous {
+ background-color: #ffffff;
+ border: 1px solid black;
+ }
- span {
- color: var(--Primary-Color, #0875ff);
+ &.completion-cta {
+ color: #fff;
+ background-color: #0875ff;
}
- }
- .sgsb-sub-heading {
- margin-top: 16px;
- white-space: pre-line;
- color: var(--Secoundary-Color, #073b4c);
- text-align: center;
- font-size: 18px;
- font-style: normal;
- font-weight: 500;
- line-height: normal;
- }
+ &.doc-cta {
+ color: #fff;
+ background: #000000;
+ }
- .get-started {
- margin-top: 50px;
- padding: 16px 42px;
- color: #fff;
- background-color: #0875ff;
+ &.support-cta {
+ color: #073b4c;
+ background-color: #dde6f9;
+ }
}
- }
- //Setup Completion page
- .sgsb-step-completion {
- display: flex;
- flex-direction: column;
- gap: 50px;
-
- .sgsb-inisetup-heading-content {
+ // Welcome step layout
+ .sgsb-ini-setup-welcome {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
- gap: 24px;
-
- .completion-check-mark {
- border: 2px solid #0875ff;
- border-radius: 50%;
- padding: 24px 22px;
- display: inline-flex;
- }
- .setup-completion-heading {
+ .ini-setup-announce-container {
display: flex;
flex-direction: column;
align-items: center;
+ gap: 24px;
+ margin: 80px 0px;
- .heading {
- color: #073b4c;
- text-align: center;
- font-size: 36px;
- font-weight: 700;
+ &.congratulation {
+ margin: 40px 0px;
}
- .sub-heading {
- color: #073b4c;
- text-align: center;
- font-size: 14px;
- font-weight: 400;
+ .annouce-contents {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ max-width: 530px;
+
+ .sgsb-content-heading {
+ color: var(--Secoundary-Color, #073b4c);
+ text-align: center;
+ font-size: 36px;
+ font-style: normal;
+ font-weight: 700;
+ line-height: normal;
+ margin: 0;
+
+ span {
+ color: var(--Primary-Color, #0875ff);
+ }
+ }
+
+ .sgsb-sub-heading {
+ // white-space: pre-line;
+ color: var(--Secoundary-Color, #5A5A5F);
+ text-align: center;
+ font-size: 16px;
+ font-style: normal;
+ font-weight: 500;
+ line-height: normal;
+ }
}
- }
- }
- .sgsb-ini-setup-completion {
- .sgsb-intro-video {
- iframe {
- width: 36vw;
- height: 19vw;
- border-radius: 6px;
- background: gray;
+ .social-links {
+ display: flex;
+ gap: 10px;
+
+ a {
+ &.social-link {
+ display: flex;
+ padding: 8px 12px 8px 8px;
+ justify-content: center;
+ align-items: center;
+ gap: var(--S-8, 8px);
+ border-radius: 10px;
+ color: var(--Text-color-Primary, #000012);
+ text-align: center;
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 500;
+ }
+
+ &.youtube {
+ background: #FFD5D5;
+ }
+
+ &.get-support {
+ background: #B7DFFF;
+ }
+
+ &.documentation {
+ background: #FFE7D9;
+ }
+ }
}
- }
- &.support-doc {
- display: flex;
- gap: 44px;
- margin-left: 8%;
+ .get-started {
+ display: flex;
+ height: 40px;
+ padding: 24px 20px;
+ justify-content: center;
+ align-items: center;
+ gap: 10px;
+ background-color: #0875FF;
+ color: #fff;
+ }
}
- .sgsb-support-doc-cta {
+ //user Agriment
+ .ini-setup.user-agreement {
display: flex;
flex-direction: column;
- gap: 15px;
+ gap: 16px;
+
+ .getting-updates,
+ .getting-essentials {
+ .ant-checkbox-checked {
+ .ant-checkbox-inner {
+ background-color: #fff;
+ border-color: #B7DFFF;
+
+ &::after {
+ border: 1.5px solid #008DFF;
+ border-left: none;
+ border-top: none;
+ }
+ }
+ }
+
+
+ .user-agreement {
+ display: flex;
+ gap: 6px;
+
+ p {
+ margin: 0;
+
+ &.heading {
+ font-weight: 600;
+ }
+ }
+ }
+
+ }
+
+ }
+ }
+
+ //Modules page
+ .sgsb-admin-dashboard-module {
+ margin: 80px 0px;
+
+ .sgsb-admin-dashboard-module-box-content {
+ padding: 0px !important;
+ background: none;
+ margin-bottom: 14px;
}
}
- .ini-setup {
- &.user-agreement {
+ //Setup Completion page
+ .sgsb-step-completion {
+ display: flex;
+ flex-direction: column;
+ gap: 50px;
+
+ .sgsb-inisetup-heading-content {
display: flex;
+ justify-content: center;
flex-direction: column;
- gap: 12px;
- margin-left: 8%;
+ align-items: center;
+ gap: 24px;
- .getting-updates,
- .getting-essentials {
+ .completion-check-mark {
+ border: 2px solid #0875ff;
+ border-radius: 50%;
+ padding: 24px 22px;
+ display: inline-flex;
+ }
+
+ .setup-completion-heading {
display: flex;
- align-items: flex-start;
- gap: 10px;
+ flex-direction: column;
+ align-items: center;
- .content-container {
- line-height: 0.5;
+ .heading {
+ color: #073b4c;
+ text-align: center;
+ font-size: 36px;
+ font-weight: 700;
+ }
- .heading {
- color: var(--Secoundary-Color, #073b4c);
- font-size: 16px;
- font-weight: 500;
- }
+ .sub-heading {
+ color: #073b4c;
+ text-align: center;
+ font-size: 14px;
+ font-weight: 400;
+ }
+ }
+ }
- .content {
- color: var(--Secoundary-Color, #073b4c);
- font-size: 12px;
- font-weight: 400;
+ .sgsb-ini-setup-completion {
+ .sgsb-intro-video {
+ iframe {
+ width: 36vw;
+ height: 19vw;
+ border-radius: 6px;
+ background: gray;
+ }
+ }
+
+ &.support-doc {
+ display: flex;
+ gap: 44px;
+ margin-left: 8%;
+ }
+
+ .sgsb-support-doc-cta {
+ display: flex;
+ flex-direction: column;
+ gap: 15px;
+ }
+ }
+
+ .ini-setup {
+ &.user-agreement {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ margin-left: 8%;
+
+ .getting-updates,
+ .getting-essentials {
+ display: flex;
+ align-items: flex-start;
+ gap: 10px;
+
+ .content-container {
+ line-height: 0.5;
+
+ .heading {
+ color: var(--Secoundary-Color, #073b4c);
+ font-size: 16px;
+ font-weight: 500;
+ }
+
+ .content {
+ color: var(--Secoundary-Color, #073b4c);
+ font-size: 12px;
+ font-weight: 400;
+ }
}
}
}
@@ -3165,4 +3281,5 @@ End Settings Sidebar
}
}
}
+
}
diff --git a/assets/src/components/initail-setup/ContentLayout.jsx b/assets/src/components/initail-setup/ContentLayout.jsx
index 42d2cacc..31cb1581 100644
--- a/assets/src/components/initail-setup/ContentLayout.jsx
+++ b/assets/src/components/initail-setup/ContentLayout.jsx
@@ -23,10 +23,20 @@ const ContentLayout = ({ current, next, prev, stepSize = 0 }) => {
return (
{renderContent()}
- {(current !== 0 && current !== stepSize - 1) &&
+ {(current !== 0) &&
}
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index 75899cd2..f346a5b9 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -1,6 +1,6 @@
import { React, Fragment, useState, useRef, useEffect } from '@wordpress/element';
import Progress from './Progress';
-import { Button } from 'antd';
+import { Steps } from 'antd';
import StoreGrowthIcon from '../../../images/logo.svg'
const IniSetupLayout = () => {
@@ -25,16 +25,39 @@ const IniSetupLayout = () => {
}
}, [current]);
+ const onChange = (value) => {
+ setCurrent(value);
+ };
+
+
+ const steps = [
+ {
+ title: 'Welcome',
+ },
+ {
+ title: 'Modules',
+ },
+ {
+ title: 'Ready',
+ },
+ ];
+ const stepSize = steps.length;
return (
-
-
-
-
+
+
+
+
+
+
+
-
- Return To Dashboard
diff --git a/assets/src/components/initail-setup/Progress.jsx b/assets/src/components/initail-setup/Progress.jsx
index 588119aa..63b9f185 100644
--- a/assets/src/components/initail-setup/Progress.jsx
+++ b/assets/src/components/initail-setup/Progress.jsx
@@ -1,34 +1,11 @@
import { Fragment } from '@wordpress/element';
-import { Steps } from 'antd';
import ContentLayout from './ContentLayout';
-const Progress = ({next,prev,current,setCurrent}) => {
- const onChange = (value) => {
- setCurrent(value);
- };
+const Progress = ({next,prev,current,setCurrent,stepSize}) => {
-
- const steps = [
- {
- title: 'Welcome',
- },
- {
- title: 'Modules',
- },
- {
- title: 'Ready',
- },
- ];
- const stepSize = steps.length;
return (
-
-
+
);
diff --git a/assets/src/components/initail-setup/Ready.jsx b/assets/src/components/initail-setup/Ready.jsx
index 2272e219..e3704cbd 100644
--- a/assets/src/components/initail-setup/Ready.jsx
+++ b/assets/src/components/initail-setup/Ready.jsx
@@ -1,56 +1,59 @@
import { Fragment } from "react";
import { __ } from "@wordpress/i18n";
+import CongratsAnnounce from '../../../images/congrats-announce.svg'
const Ready = () => {
return (
-
-
-
-
-
-
+
+
+
+
+
{__("Congratulation!", "storegrowth-sales-booster")}
+ {__(`You are at the last step to complete the setup process and start using the exciting features of StoreGrowth`, 'storegrowth-sales-booster')}
-
-
- {__("Congratulation", "storegrowth-sales-booster")}
-
-
- {__(
- "You are at the last step to complete the setup process and start using the exciting features of StoreGrawth",
- "storegrowth-sales-booster"
- )}
-
-
-
-
diff --git a/assets/src/components/initail-setup/Welcome.jsx b/assets/src/components/initail-setup/Welcome.jsx
index 53ed61db..1a20046d 100644
--- a/assets/src/components/initail-setup/Welcome.jsx
+++ b/assets/src/components/initail-setup/Welcome.jsx
@@ -1,9 +1,9 @@
import { Fragment } from 'react'
import { useState, useEffect } from '@wordpress/element';
-import { Switch } from 'antd';
+import { Checkbox } from 'antd';
import { __ } from '@wordpress/i18n';
-
-const Welcome = ( {next}) => {
+import WelcomeAnnounce from '../../../images/welcome-announce.svg'
+const Welcome = ({ next }) => {
const [updateNews, setupdateNews] = useState(true);
const [userDetails, setUserdetails] = useState(true);
@@ -36,26 +36,33 @@ const Welcome = ( {next}) => {
return (
-
{__("Welcome To ", "storegrowth-sales-booster")} {__("StoreGrowth", "storegrowth-sales-booster")}
-
{__(`# 1 Marketing Plugin For WooCommerce
+
+
+
+
{__("Welcome To StoreGrowth", "storegrowth-sales-booster")}
+ {__(`# 1 Marketing Plugin For WooCommerce
of StoreGrowth Turbocharge Your WooCommerce Store’s Sales!`, 'storegrowth-sales-booster')}
+
+
{ next(); getUserDetails(); }} type="button" className='steps-button get-started'>{__(`Get Started`, 'storegrowth-sales-booster')}
+
-
{ setupdateNews(checked) }} />
-
-
{__('Get Updates', "storegrowth-sales-booster")}
+
{ setupdateNews(!updateNews) }} >
+
+ {__('Get Updates: ', "storegrowth-sales-booster")}
{__('We will send essential tips & tricks for effective usage of StoreGrowth.', "storegrowth-sales-booster")}
-
+
+
-
{ setUserdetails(checked) }} />
-
-
{__('Share Essentials', "storegrowth-sales-booster")}
+
{ setUserdetails(!userDetails) }} >
+
+ {__('Share Essentials: ', "storegrowth-sales-booster")}
{__('Let us collect non-sensitive diagnosis data and usage information.', "storegrowth-sales-booster")}
-
+
+
- { next(); getUserDetails(); }} type="button" className='steps-button get-started'>{__(`Get Started`, 'storegrowth-sales-booster')}
)
From 6cec8df946db3ec3c8924a11c17f19f47d736778 Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Tue, 12 Mar 2024 10:49:16 +0600
Subject: [PATCH 12/25] design: removed the unccessary logo
---
assets/src/admin.scss | 3 +++
assets/src/components/initail-setup/IniSetupLayout.jsx | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/assets/src/admin.scss b/assets/src/admin.scss
index a19856b9..11b916cf 100644
--- a/assets/src/admin.scss
+++ b/assets/src/admin.scss
@@ -2976,6 +2976,9 @@ End Settings Sidebar
img {
height: 28px;
}
+ .steps-skipper-controller{
+ width: 10%;
+ }
}
.sgsg-ini-setup-progress {
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index f346a5b9..a56eb38b 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -54,7 +54,9 @@ const IniSetupLayout = () => {
onChange={onChange}
items={steps}
/>
-
+
+
+
From e3926ecc603e2cd22efdd85969f8a102e3b615d0 Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Tue, 12 Mar 2024 12:24:07 +0600
Subject: [PATCH 13/25] fix: notice removed
---
.../components/initail-setup/IniSetupLayout.jsx | 4 ++--
assets/src/utils/helper.js | 16 ++++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index a56eb38b..e3295eb9 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -7,7 +7,7 @@ const IniSetupLayout = () => {
const [current, setCurrent] = useState(0);
const contentLayoutRef = useRef(null);
- const clickHandler = () => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview' };
+ // const clickHandler = () => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview' };
const next = () => { setCurrent(current + 1) }
@@ -55,7 +55,7 @@ const IniSetupLayout = () => {
items={steps}
/>
-
+
diff --git a/assets/src/utils/helper.js b/assets/src/utils/helper.js
index 1bcfec9c..1c5584b8 100644
--- a/assets/src/utils/helper.js
+++ b/assets/src/utils/helper.js
@@ -21,6 +21,22 @@ export const menuFix = (slug) => {
background: "#fff", // Replace with your desired background color
});
$(".notice").remove();
+ $(document).ready(function() {
+ var children = $('#wpbody-content').children();
+ children.each(function() {
+ var classNames = $(this).attr('class');
+ if (classNames) {
+ var classList = classNames.split(' ');
+ if (!classList.includes('metabox-prefs') && !classList.includes('wrap') && !classList.includes('clear')) {
+ $(this).remove();
+ }
+ }
+ });
+ });
+
+
+
+
}
// *************************************
// Add target blank for upgrade button
From 3ade168f10bcf40bf87deb550bd03ccb3e7b7053 Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Tue, 12 Mar 2024 12:42:10 +0600
Subject: [PATCH 14/25] validate request
---
Includes/Ajax.php | 104 ++++++++++++++++++++++++----------------------
1 file changed, 54 insertions(+), 50 deletions(-)
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index 2ffd090c..0adf5007 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -217,55 +217,59 @@ public function sgsb_collect_non_sensitive_data(){
return $body;
}
/**
- * Process Consent Data
- */
-public function sgsb_process_user_concent_data() {
- check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
-
- // Collect non-sensitive data
- $data_to_send = $this->sgsb_collect_non_sensitive_data();
-
- // Prepare the request arguments
- $request_args = array(
- 'body' => json_encode($data_to_send),
- 'headers' => array(
- 'Content-Type' => 'application/json',
- ),
- 'timeout' => 30,
- 'redirection' => 5,
- 'blocking' => true,
- 'httpversion' => '1.0',
- 'sslverify' => false, // Change to true in production
- 'data_format' => 'body',
- );
-
- // Send the request
- $response = wp_remote_post(self::API_URL, $request_args);
-
- // Check for errors
- if (is_wp_error($response)) {
- // Handle error
- $error_message = $response->get_error_message();
- // You can log the error message or return it to the caller
- return new WP_Error('api_error', $error_message);
- } else {
- // Request was successful
- // You may want to log or process the response data here if needed
- $response_code = wp_remote_retrieve_response_code($response);
- if ($response_code === 200) {
- // Request successful, you can return success message or response data if any
- $response_body = wp_remote_retrieve_body($response);
- return $response_body;
- } else {
- // Request was not successful
- // Handle the error accordingly
- return new WP_Error('api_error', 'API returned unexpected response code: ' . $response_code);
- }
- }
-
- // Send JSON success message after the API request is processed
- wp_send_json_success(array('message' => 'Success message'));
- wp_die();
-}
+ * Process Consent Data
+ */
+ public function sgsb_process_user_concent_data() {
+ check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
+
+ if ( $_POST["updateNews"] !== true && $_POST["userDetails"] !== true ) {
+ error_log("execute");
+ return;
+ }
+ // Collect non-sensitive data
+ $data_to_send = $this->sgsb_collect_non_sensitive_data();
+
+ // Prepare the request arguments
+ $request_args = array(
+ 'body' => json_encode($data_to_send),
+ 'headers' => array(
+ 'Content-Type' => 'application/json',
+ ),
+ 'timeout' => 30,
+ 'redirection' => 5,
+ 'blocking' => true,
+ 'httpversion' => '1.0',
+ 'sslverify' => false, // Change to true in production
+ 'data_format' => 'body',
+ );
+
+ // Send the request
+ $response = wp_remote_post(self::API_URL, $request_args);
+
+ // Check for errors
+ if (is_wp_error($response)) {
+ // Handle error
+ $error_message = $response->get_error_message();
+ // You can log the error message or return it to the caller
+ return new WP_Error('api_error', $error_message);
+ } else {
+ // Request was successful
+ // You may want to log or process the response data here if needed
+ $response_code = wp_remote_retrieve_response_code($response);
+ if ($response_code === 200) {
+ // Request successful, you can return success message or response data if any
+ $response_body = wp_remote_retrieve_body($response);
+ return $response_body;
+ } else {
+ // Request was not successful
+ // Handle the error accordingly
+ return new WP_Error('api_error', 'API returned unexpected response code: ' . $response_code);
+ }
+ }
+
+ // Send JSON success message after the API request is processed
+ wp_send_json_success(array('message' => 'Success message'));
+ wp_die();
+ }
}
From fa0904c34e4587b4b1dc7d338c5ea7aa8de18afc Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Tue, 12 Mar 2024 13:30:10 +0600
Subject: [PATCH 15/25] data sending validation
---
Includes/Ajax.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index 0adf5007..ee8f4460 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -49,7 +49,7 @@ class Ajax {
* Constructor of _Ajax class.
*/
private function __construct() {
- $this->plugin_file = plugin_dir_path(__FILE__) . 'storegrowth-sales-booster.php';
+ $this->plugin_file = plugin_dir_path(__FILE__) . '../storegrowth-sales-booster.php';
$this->plugin_name = basename( $this->plugin_file, '.php' );
add_action( 'wp_ajax_sgsb_admin_ajax', array( $this, 'admin_ajax' ) );
/**
@@ -222,7 +222,10 @@ public function sgsb_collect_non_sensitive_data(){
public function sgsb_process_user_concent_data() {
check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
- if ( $_POST["updateNews"] !== true && $_POST["userDetails"] !== true ) {
+ $updateNews = isset( $_POST['updateNews'] ) ? $_POST['updateNews'] : false;
+ $userDetails = isset( $_POST['userDetails'] ) ? $_POST['userDetails'] : false;
+
+ if ( $updateNews === "false" && $userDetails === "false" ) {
error_log("execute");
return;
}
From 70005b5c9a8635e256c81836e3cf5682e69b685f Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Tue, 12 Mar 2024 16:29:04 +0600
Subject: [PATCH 16/25] refactor: state moved to top
---
Includes/Ajax.php | 138 ++++++++----------
.../initail-setup/ContentLayout.jsx | 4 +-
.../initail-setup/IniSetupLayout.jsx | 15 +-
.../src/components/initail-setup/Progress.jsx | 6 +-
.../src/components/initail-setup/Welcome.jsx | 28 ++--
5 files changed, 93 insertions(+), 98 deletions(-)
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index ee8f4460..e7f48c4c 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -22,6 +22,7 @@
class Ajax {
use Singleton;
+
/**
* Invizo Insights Version
*/
@@ -49,13 +50,13 @@ class Ajax {
* Constructor of _Ajax class.
*/
private function __construct() {
- $this->plugin_file = plugin_dir_path(__FILE__) . '../storegrowth-sales-booster.php';
- $this->plugin_name = basename( $this->plugin_file, '.php' );
+ $this->plugin_file = plugin_dir_path( __FILE__ ) . '../storegrowth-sales-booster.php';
+ $this->plugin_name = basename( $this->plugin_file, '.php' );
add_action( 'wp_ajax_sgsb_admin_ajax', array( $this, 'admin_ajax' ) );
/**
* Register ajax callback
*/
- add_action('wp_ajax_sgsb_process_user_concent_data', array( $this,'sgsb_process_user_concent_data'));
+ add_action( 'wp_ajax_sgsb_process_user_concent_data', array( $this, 'sgsb_process_user_concent_data' ) );
}
/**
@@ -137,45 +138,45 @@ public function plugin_data() {
$plugin = get_plugin_data( $this->plugin_file );
return $plugin;
}
- public function sgsb_collect_non_sensitive_data(){
+ public function sgsb_collect_non_sensitive_data() {
$body = array(
- 'plugin_slug' => sanitize_text_field( $this->plugin_name ),
- 'url' => get_bloginfo( 'url' ),
- 'site_name' => get_bloginfo( 'name' ),
- 'site_version' => get_bloginfo( 'version' ),
- 'site_language' => get_bloginfo( 'language' ),
- 'charset' => get_bloginfo( 'charset' ),
- 'wpins_version' => self::INVZ_VERSION,
- 'php_version' => phpversion(),
- 'multisite' => is_multisite(),
- 'file_location' => __FILE__,
- );
+ 'plugin_slug' => sanitize_text_field( $this->plugin_name ),
+ 'url' => get_bloginfo( 'url' ),
+ 'site_name' => get_bloginfo( 'name' ),
+ 'site_version' => get_bloginfo( 'version' ),
+ 'site_language' => get_bloginfo( 'language' ),
+ 'charset' => get_bloginfo( 'charset' ),
+ 'wpins_version' => self::INVZ_VERSION,
+ 'php_version' => phpversion(),
+ 'multisite' => is_multisite(),
+ 'file_location' => __FILE__,
+ );
// Collect the email if the correct option has been set
- if ( ! function_exists( 'wp_get_current_user' ) ) {
- include ABSPATH . 'wp-includes/pluggable.php';
- }
+ if ( ! function_exists( 'wp_get_current_user' ) ) {
+ include ABSPATH . 'wp-includes/pluggable.php';
+ }
$current_user = wp_get_current_user();
$email = $current_user->user_email;
- if ( is_email( $email ) ) {
- $body['email'] = $email;
- }
- $body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
+ if ( is_email( $email ) ) {
+ $body['email'] = $email;
+ }
+ $body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
/**
* Collect all active and inactive plugins
*/
- if ( ! function_exists( 'get_plugins' ) ) {
- include ABSPATH . '/wp-admin/includes/plugin.php';
- }
+ if ( ! function_exists( 'get_plugins' ) ) {
+ include ABSPATH . '/wp-admin/includes/plugin.php';
+ }
$plugins = array_keys( get_plugins() );
$active_plugins = is_network_admin() ? array_keys( get_site_option( 'active_sitewide_plugins', array() ) ) : get_option( 'active_plugins', array() );
- foreach ( $plugins as $key => $plugin ) {
- if ( in_array( $plugin, $active_plugins ) ) {
- unset( $plugins[ $key ] );
- }
+ foreach ( $plugins as $key => $plugin ) {
+ if ( in_array( $plugin, $active_plugins ) ) {
+ unset( $plugins[ $key ] );
}
+ }
$body['active_plugins'] = $active_plugins;
$body['inactive_plugins'] = $plugins;
@@ -189,18 +190,18 @@ public function sgsb_collect_non_sensitive_data(){
* @since 3.0.0
*/
$plugin = $this->plugin_data();
- if ( empty( $plugin ) ) {
- $body['message'] .= __( 'We can\'t detect any plugin information. This is most probably because you have not included the code in the plugin main file.', 'plugin-usage-tracker' );
- $body['status'] = 'NOT FOUND';
- } else {
- if ( isset( $plugin['Name'] ) ) {
- $body['plugin'] = sanitize_text_field( $plugin['Name'] );
- }
- if ( isset( $plugin['Version'] ) ) {
- $body['version'] = sanitize_text_field( $plugin['Version'] );
- }
- $body['status'] = 'Active';
+ if ( empty( $plugin ) ) {
+ $body['message'] .= __( 'We can\'t detect any plugin information. This is most probably because you have not included the code in the plugin main file.', 'plugin-usage-tracker' );
+ $body['status'] = 'NOT FOUND';
+ } else {
+ if ( isset( $plugin['Name'] ) ) {
+ $body['plugin'] = sanitize_text_field( $plugin['Name'] );
+ }
+ if ( isset( $plugin['Version'] ) ) {
+ $body['version'] = sanitize_text_field( $plugin['Version'] );
}
+ $body['status'] = 'Active';
+ }
/**
* Get active theme name and version
@@ -208,33 +209,29 @@ public function sgsb_collect_non_sensitive_data(){
* @since 3.0.0
*/
$theme = wp_get_theme();
- if ( $theme->Name ) {
- $body['theme'] = sanitize_text_field( $theme->Name );
- }
- if ( $theme->Version ) {
- $body['theme_version'] = sanitize_text_field( $theme->Version );
- }
+ if ( $theme->Name ) {
+ $body['theme'] = sanitize_text_field( $theme->Name );
+ }
+ if ( $theme->Version ) {
+ $body['theme_version'] = sanitize_text_field( $theme->Version );
+ }
return $body;
}
/**
* Process Consent Data
*/
public function sgsb_process_user_concent_data() {
- check_ajax_referer('sgsb_ajax_nonce', '_ajax_nonce');
-
- $updateNews = isset( $_POST['updateNews'] ) ? $_POST['updateNews'] : false;
- $userDetails = isset( $_POST['userDetails'] ) ? $_POST['userDetails'] : false;
+ check_ajax_referer( 'sgsb_ajax_nonce', '_ajax_nonce' );
+ $post_data = isset( $_POST['data'] ) ? json_decode( wp_unslash( stripslashes( isset( $_POST['data'] ) ) ), true ) : '';
+ $update_news = $post_data['update_news'];
+ $user_details = $post_data['user_details'];
- if ( $updateNews === "false" && $userDetails === "false" ) {
- error_log("execute");
+ if ( ! $update_news && ! $user_details ) {
return;
}
- // Collect non-sensitive data
$data_to_send = $this->sgsb_collect_non_sensitive_data();
-
- // Prepare the request arguments
$request_args = array(
- 'body' => json_encode($data_to_send),
+ 'body' => wp_json_encode( $data_to_send ),
'headers' => array(
'Content-Type' => 'application/json',
),
@@ -242,37 +239,26 @@ public function sgsb_process_user_concent_data() {
'redirection' => 5,
'blocking' => true,
'httpversion' => '1.0',
- 'sslverify' => false, // Change to true in production
+ 'sslverify' => false,
'data_format' => 'body',
);
- // Send the request
- $response = wp_remote_post(self::API_URL, $request_args);
+ $response = wp_remote_post( self::API_URL, $request_args );
- // Check for errors
- if (is_wp_error($response)) {
- // Handle error
+ if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
- // You can log the error message or return it to the caller
- return new WP_Error('api_error', $error_message);
+ return new WP_Error( 'api_error', $error_message );
} else {
- // Request was successful
- // You may want to log or process the response data here if needed
- $response_code = wp_remote_retrieve_response_code($response);
- if ($response_code === 200) {
- // Request successful, you can return success message or response data if any
- $response_body = wp_remote_retrieve_body($response);
+ $response_code = wp_remote_retrieve_response_code( $response );
+ if ( $response_code === 200 ) {
+ $response_body = wp_remote_retrieve_body( $response );
return $response_body;
} else {
- // Request was not successful
- // Handle the error accordingly
- return new WP_Error('api_error', 'API returned unexpected response code: ' . $response_code);
+ return new WP_Error( 'api_error', 'API returned unexpected response code: ' . $response_code );
}
}
- // Send JSON success message after the API request is processed
- wp_send_json_success(array('message' => 'Success message'));
+ wp_send_json_success( array( 'message' => 'Success message' ) );
wp_die();
}
-
}
diff --git a/assets/src/components/initail-setup/ContentLayout.jsx b/assets/src/components/initail-setup/ContentLayout.jsx
index 31cb1581..62b7ba4b 100644
--- a/assets/src/components/initail-setup/ContentLayout.jsx
+++ b/assets/src/components/initail-setup/ContentLayout.jsx
@@ -4,13 +4,13 @@ import Welcome from './Welcome';
import ModulesSetup from './ModulesSetup';
import Ready from './Ready';
-const ContentLayout = ({ current, next, prev, stepSize = 0 }) => {
+const ContentLayout = ({ current, next, prev, stepSize = 0, agreementData, handleCheckbox }) => {
const renderContent = () => {
switch (parseInt(current)) {
case 0:
- return ;
+ return ;
case 1:
return ;
case 2:
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index e3295eb9..64ce9ad9 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -7,6 +7,19 @@ const IniSetupLayout = () => {
const [current, setCurrent] = useState(0);
const contentLayoutRef = useRef(null);
+ const agreementsData = {
+ update_news: true,
+ user_details: true,
+ }
+ const [agreementData, setAgreementData] = useState(agreementsData)
+
+ const handleCheckbox = (key, value) => {
+ setAgreementData({
+ ...agreementData,
+ [key]: value,
+ });
+ };
+
// const clickHandler = () => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview' };
const next = () => { setCurrent(current + 1) }
@@ -58,7 +71,7 @@ const IniSetupLayout = () => {
-
+
diff --git a/assets/src/components/initail-setup/Progress.jsx b/assets/src/components/initail-setup/Progress.jsx
index 63b9f185..9c7143bc 100644
--- a/assets/src/components/initail-setup/Progress.jsx
+++ b/assets/src/components/initail-setup/Progress.jsx
@@ -2,11 +2,11 @@
import { Fragment } from '@wordpress/element';
import ContentLayout from './ContentLayout';
-const Progress = ({next,prev,current,setCurrent,stepSize}) => {
+const Progress = ({ next, prev, current, setCurrent, stepSize, agreementData, handleCheckbox }) => {
return (
-
-
+
+
);
}
diff --git a/assets/src/components/initail-setup/Welcome.jsx b/assets/src/components/initail-setup/Welcome.jsx
index 1a20046d..6750ccf9 100644
--- a/assets/src/components/initail-setup/Welcome.jsx
+++ b/assets/src/components/initail-setup/Welcome.jsx
@@ -1,11 +1,8 @@
import { Fragment } from 'react'
-import { useState, useEffect } from '@wordpress/element';
import { Checkbox } from 'antd';
import { __ } from '@wordpress/i18n';
import WelcomeAnnounce from '../../../images/welcome-announce.svg'
-const Welcome = ({ next }) => {
- const [updateNews, setupdateNews] = useState(true);
- const [userDetails, setUserdetails] = useState(true);
+const Welcome = ({ next, agreementData, handleCheckbox }) => {
const getUserDetails = async () => {
try {
@@ -18,8 +15,7 @@ const Welcome = ({ next }) => {
body: new URLSearchParams({
_ajax_nonce: sgsbAdmin.nonce,
action: 'sgsb_process_user_concent_data',
- updateNews,
- userDetails,
+ data: JSON.stringify(agreementData),
}),
});
@@ -47,19 +43,19 @@ of StoreGrowth Turbocharge Your WooCommerce Store’s Sales!`, 'storegrowth-sale
-
{ setupdateNews(!updateNews) }} >
-
- {__('Get Updates: ', "storegrowth-sales-booster")}
- {__('We will send essential tips & tricks for effective usage of StoreGrowth.', "storegrowth-sales-booster")}
-
+ handleCheckbox('update_news', !agreementData?.update_news)} >
+
+ {__('Get Updates: ', "storegrowth-sales-booster")}
+ {__('We will send essential tips & tricks for effective usage of StoreGrowth.', "storegrowth-sales-booster")}
+
-
{ setUserdetails(!userDetails) }} >
-
- {__('Share Essentials: ', "storegrowth-sales-booster")}
- {__('Let us collect non-sensitive diagnosis data and usage information.', "storegrowth-sales-booster")}
-
+ handleCheckbox('user_details', !agreementData.user_details)} >
+
+ {__('Share Essentials: ', "storegrowth-sales-booster")}
+ {__('Let us collect non-sensitive diagnosis data and usage information.', "storegrowth-sales-booster")}
+
From 6e40fb52a3b24ad8c618099e28cbcd1a100d8e03 Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Tue, 12 Mar 2024 17:43:45 +0600
Subject: [PATCH 17/25] fix: offset value
---
Includes/Ajax.php | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index e7f48c4c..62facaab 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -222,14 +222,17 @@ public function sgsb_collect_non_sensitive_data() {
*/
public function sgsb_process_user_concent_data() {
check_ajax_referer( 'sgsb_ajax_nonce', '_ajax_nonce' );
- $post_data = isset( $_POST['data'] ) ? json_decode( wp_unslash( stripslashes( isset( $_POST['data'] ) ) ), true ) : '';
- $update_news = $post_data['update_news'];
- $user_details = $post_data['user_details'];
+ $post_data = json_decode( wp_unslash( stripslashes( $_POST['data'] ) ) );
+
+ $update_news = $post_data->update_news;
+ $user_details = $post_data->user_details;
if ( ! $update_news && ! $user_details ) {
- return;
+ return;
}
+
$data_to_send = $this->sgsb_collect_non_sensitive_data();
+
$request_args = array(
'body' => wp_json_encode( $data_to_send ),
'headers' => array(
From 8fc87b1ee4aa62694f86e5259ff6e6f0486112ef Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Tue, 12 Mar 2024 23:48:50 +0600
Subject: [PATCH 18/25] fix: data fire
---
.../initail-setup/ContentLayout.jsx | 4 +-
.../initail-setup/IniSetupLayout.jsx | 95 ++++++++++++++-----
.../src/components/initail-setup/Progress.jsx | 4 +-
.../src/components/initail-setup/Welcome.jsx | 27 +-----
4 files changed, 75 insertions(+), 55 deletions(-)
diff --git a/assets/src/components/initail-setup/ContentLayout.jsx b/assets/src/components/initail-setup/ContentLayout.jsx
index 62b7ba4b..8f61624a 100644
--- a/assets/src/components/initail-setup/ContentLayout.jsx
+++ b/assets/src/components/initail-setup/ContentLayout.jsx
@@ -4,13 +4,13 @@ import Welcome from './Welcome';
import ModulesSetup from './ModulesSetup';
import Ready from './Ready';
-const ContentLayout = ({ current, next, prev, stepSize = 0, agreementData, handleCheckbox }) => {
+const ContentLayout = ({ current, next, prev, stepSize = 0, agreementData, handleCheckbox ,getUserDetails}) => {
const renderContent = () => {
switch (parseInt(current)) {
case 0:
- return ;
+ return ;
case 1:
return ;
case 2:
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index 64ce9ad9..c21962ab 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -1,7 +1,13 @@
-import { React, Fragment, useState, useRef, useEffect } from '@wordpress/element';
-import Progress from './Progress';
-import { Steps } from 'antd';
-import StoreGrowthIcon from '../../../images/logo.svg'
+import {
+ React,
+ Fragment,
+ useState,
+ useRef,
+ useEffect,
+} from "@wordpress/element";
+import Progress from "./Progress";
+import { Steps } from "antd";
+import StoreGrowthIcon from "../../../images/logo.svg";
const IniSetupLayout = () => {
const [current, setCurrent] = useState(0);
@@ -10,8 +16,34 @@ const IniSetupLayout = () => {
const agreementsData = {
update_news: true,
user_details: true,
- }
- const [agreementData, setAgreementData] = useState(agreementsData)
+ };
+ const [agreementData, setAgreementData] = useState(agreementsData);
+
+ const getUserDetails = async () => {
+ try {
+ const response = await fetch("/wp-admin/admin-ajax.php", {
+ method: "POST",
+ credentials: "same-origin",
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded",
+ },
+ body: new URLSearchParams({
+ _ajax_nonce: sgsbAdmin.nonce,
+ action: "sgsb_process_user_concent_data",
+ data: JSON.stringify(agreementData),
+ }),
+ });
+
+ if (!response.ok) {
+ throw new Error("Network response was not ok");
+ }
+
+ const responseData = await response.json();
+ console.log(responseData);
+ } catch (error) {
+ console.error("Error fetching user details:", error);
+ }
+ };
const handleCheckbox = (key, value) => {
setAgreementData({
@@ -22,18 +54,19 @@ const IniSetupLayout = () => {
// const clickHandler = () => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview' };
- const next = () => { setCurrent(current + 1) }
+ const next = () => {
+ setCurrent(current + 1);
+ };
const prev = () => {
setCurrent(current - 1);
};
useEffect(() => {
-
// Scroll to the top of the content layout when 'current' changes
if (current !== 0) {
if (contentLayoutRef.current) {
- contentLayoutRef.current.scrollIntoView({ behavior: 'smooth' });
+ contentLayoutRef.current.scrollIntoView({ behavior: "smooth" });
}
}
}, [current]);
@@ -42,42 +75,54 @@ const IniSetupLayout = () => {
setCurrent(value);
};
-
const steps = [
{
- title: 'Welcome',
+ title: "Welcome",
},
{
- title: 'Modules',
+ title: "Modules",
},
{
- title: 'Ready',
+ title: "Ready",
},
];
const stepSize = steps.length;
return (
-
-
-
+
+
+
{
+ setCurrent(value);
+ if (value === 1) {
+ getUserDetails();
+ }
+ }}
items={steps}
/>
-
-
-
+
+
+
-
-
- )
-
-}
+ );
+};
export default IniSetupLayout;
diff --git a/assets/src/components/initail-setup/Progress.jsx b/assets/src/components/initail-setup/Progress.jsx
index 9c7143bc..64d2a8f8 100644
--- a/assets/src/components/initail-setup/Progress.jsx
+++ b/assets/src/components/initail-setup/Progress.jsx
@@ -2,11 +2,11 @@
import { Fragment } from '@wordpress/element';
import ContentLayout from './ContentLayout';
-const Progress = ({ next, prev, current, setCurrent, stepSize, agreementData, handleCheckbox }) => {
+const Progress = ({ next, prev, current, setCurrent, stepSize, agreementData, handleCheckbox ,getUserDetails}) => {
return (
-
+
);
}
diff --git a/assets/src/components/initail-setup/Welcome.jsx b/assets/src/components/initail-setup/Welcome.jsx
index 6750ccf9..cf85d4f0 100644
--- a/assets/src/components/initail-setup/Welcome.jsx
+++ b/assets/src/components/initail-setup/Welcome.jsx
@@ -2,33 +2,8 @@ import { Fragment } from 'react'
import { Checkbox } from 'antd';
import { __ } from '@wordpress/i18n';
import WelcomeAnnounce from '../../../images/welcome-announce.svg'
-const Welcome = ({ next, agreementData, handleCheckbox }) => {
+const Welcome = ({ next, agreementData, handleCheckbox, getUserDetails }) => {
- const getUserDetails = async () => {
- try {
- const response = await fetch('/wp-admin/admin-ajax.php', {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- body: new URLSearchParams({
- _ajax_nonce: sgsbAdmin.nonce,
- action: 'sgsb_process_user_concent_data',
- data: JSON.stringify(agreementData),
- }),
- });
-
- if (!response.ok) {
- throw new Error('Network response was not ok');
- }
-
- const responseData = await response.json();
- console.log(responseData);
- } catch (error) {
- console.error('Error fetching user details:', error);
- }
- };
return (
From bbb3da7744676be6fcf9758f78acf648d1161a50 Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Wed, 13 Mar 2024 11:06:45 +0600
Subject: [PATCH 19/25] doc: subheading content updated
---
assets/src/components/initail-setup/Welcome.jsx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/assets/src/components/initail-setup/Welcome.jsx b/assets/src/components/initail-setup/Welcome.jsx
index cf85d4f0..0aab75e2 100644
--- a/assets/src/components/initail-setup/Welcome.jsx
+++ b/assets/src/components/initail-setup/Welcome.jsx
@@ -11,8 +11,7 @@ const Welcome = ({ next, agreementData, handleCheckbox, getUserDetails }) => {
{__("Welcome To StoreGrowth", "storegrowth-sales-booster")}
- {__(`# 1 Marketing Plugin For WooCommerce
-of StoreGrowth Turbocharge Your WooCommerce Store’s Sales!`, 'storegrowth-sales-booster')}
+ {__(`Conversion Boosting Toolkit for WooCommerce`, 'storegrowth-sales-booster')}
{ next(); getUserDetails(); }} type="button" className='steps-button get-started'>{__(`Get Started`, 'storegrowth-sales-booster')}
From ea58f15ba24e07a48b6eceda800439cd8ae8c626 Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Wed, 13 Mar 2024 11:34:25 +0600
Subject: [PATCH 20/25] docs: links updated
---
assets/src/components/initail-setup/Ready.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/assets/src/components/initail-setup/Ready.jsx b/assets/src/components/initail-setup/Ready.jsx
index e3704cbd..5685462c 100644
--- a/assets/src/components/initail-setup/Ready.jsx
+++ b/assets/src/components/initail-setup/Ready.jsx
@@ -25,7 +25,7 @@ const Ready = () => {
{__(`Youtube`, "storegrowth-sales-booster")}
{
{__(`Get Support`, "storegrowth-sales-booster")}
Date: Wed, 13 Mar 2024 12:54:51 +0600
Subject: [PATCH 21/25] fix: ini setup page
---
assets/src/admin.scss | 57 ++++++++-
.../initail-setup/ContentLayout.jsx | 2 +-
.../initail-setup/IniSetupLayout.jsx | 52 ++++----
.../components/initail-setup/ModulesSetup.jsx | 6 +
assets/src/utils/helper.js | 112 ++++++++++--------
5 files changed, 149 insertions(+), 80 deletions(-)
diff --git a/assets/src/admin.scss b/assets/src/admin.scss
index 11b916cf..8a8891c0 100644
--- a/assets/src/admin.scss
+++ b/assets/src/admin.scss
@@ -2954,16 +2954,18 @@ End Settings Sidebar
flex-direction: column;
align-items: center;
gap: 20px;
- padding-top: 26px;
background-color: #fff;
min-height: inherit;
+ margin-bottom: -25px;
+ margin-left: -15px;
+ margin-right: -20px;
+ padding: 30px 30px 20px;
.sgsb-ini-page-container {
max-width: 1100px;
width: -webkit-fill-available;
display: flex;
flex-direction: column;
- /* justify-content: center; */
align-items: center;
.storegrowth-icon {
@@ -2971,13 +2973,18 @@ End Settings Sidebar
display: flex;
justify-content: space-between;
gap: 12%;
- // margin: 20px auto;
+ padding: 0px 8px;
img {
height: 28px;
}
- .steps-skipper-controller{
- width: 10%;
+
+ .steps-skipper-controller {
+ width: 18%;
+ text-align: center;
+ color: #1B49F6;
+ font-weight: 500;
+ cursor: pointer;
}
}
@@ -3177,7 +3184,45 @@ End Settings Sidebar
//Modules page
.sgsb-admin-dashboard-module {
- margin: 80px 0px;
+
+ .ini-setup-announce-container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 24px;
+ padding: 36px 0px;
+
+ .annouce-contents {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ max-width: 530px;
+
+ .sgsb-content-heading {
+ color: var(--Secoundary-Color, #073b4c);
+ text-align: center;
+ font-size: 36px;
+ font-style: normal;
+ font-weight: 700;
+ line-height: normal;
+ margin: 0;
+
+ span {
+ color: var(--Primary-Color, #0875ff);
+ }
+ }
+
+ .sgsb-sub-heading {
+ // white-space: pre-line;
+ color: var(--Secoundary-Color, #5A5A5F);
+ text-align: center;
+ font-size: 16px;
+ font-style: normal;
+ font-weight: 500;
+ line-height: normal;
+ }
+ }
+ }
.sgsb-admin-dashboard-module-box-content {
padding: 0px !important;
diff --git a/assets/src/components/initail-setup/ContentLayout.jsx b/assets/src/components/initail-setup/ContentLayout.jsx
index 8f61624a..fc5c8172 100644
--- a/assets/src/components/initail-setup/ContentLayout.jsx
+++ b/assets/src/components/initail-setup/ContentLayout.jsx
@@ -33,7 +33,7 @@ const ContentLayout = ({ current, next, prev, stepSize = 0, agreementData, handl
className="steps-button completion-cta"
onClick={null}
>
- {__(`Ready To Go`, "storegrowth-sales-booster")}
+ {__(`Go to dashboard`, "storegrowth-sales-booster")}
}
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index c21962ab..1582128f 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -8,6 +8,7 @@ import {
import Progress from "./Progress";
import { Steps } from "antd";
import StoreGrowthIcon from "../../../images/logo.svg";
+import { __ } from "@wordpress/i18n";
const IniSetupLayout = () => {
const [current, setCurrent] = useState(0);
@@ -19,6 +20,19 @@ const IniSetupLayout = () => {
};
const [agreementData, setAgreementData] = useState(agreementsData);
+ const steps = [
+ {
+ title: "Welcome",
+ },
+ {
+ title: "Modules",
+ },
+ {
+ title: "Ready",
+ },
+ ];
+ const stepSize = steps.length;
+
const getUserDetails = async () => {
try {
const response = await fetch("/wp-admin/admin-ajax.php", {
@@ -39,7 +53,6 @@ const IniSetupLayout = () => {
}
const responseData = await response.json();
- console.log(responseData);
} catch (error) {
console.error("Error fetching user details:", error);
}
@@ -52,8 +65,6 @@ const IniSetupLayout = () => {
});
};
- // const clickHandler = () => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview' };
-
const next = () => {
setCurrent(current + 1);
};
@@ -62,6 +73,13 @@ const IniSetupLayout = () => {
setCurrent(current - 1);
};
+ const redirectHandler = () => { window.location.href = 'admin.php?page=sgsb-settings#/dashboard/overview' };
+ const skipHandler = (event) => {
+ if (current !== (stepSize - 1)) {
+ next();
+ } else redirectHandler();
+ }
+
useEffect(() => {
// Scroll to the top of the content layout when 'current' changes
if (current !== 0) {
@@ -71,22 +89,7 @@ const IniSetupLayout = () => {
}
}, [current]);
- const onChange = (value) => {
- setCurrent(value);
- };
-
- const steps = [
- {
- title: "Welcome",
- },
- {
- title: "Modules",
- },
- {
- title: "Ready",
- },
- ];
- const stepSize = steps.length;
+ const DynamicContent = current !== (stepSize - 1) ? "Skip This Step" : "Skip Guide";
return (
@@ -98,13 +101,20 @@ const IniSetupLayout = () => {
current={current}
onChange={(value) => {
setCurrent(value);
- if (value === 1) {
+ if (value !== 0) {
getUserDetails();
}
}}
items={steps}
/>
-
+
+ skipHandler()}
+ >
+ {__(`${DynamicContent}`, "storegrowth-sales-booster")}
+
+
{" "}
diff --git a/assets/src/components/initail-setup/ModulesSetup.jsx b/assets/src/components/initail-setup/ModulesSetup.jsx
index 17c17b8f..32b6e3ae 100644
--- a/assets/src/components/initail-setup/ModulesSetup.jsx
+++ b/assets/src/components/initail-setup/ModulesSetup.jsx
@@ -54,6 +54,12 @@ function ModulesSetup() {
return (
+
+
+
{__("Choose and Enable Modules", "storegrowth-sales-booster")}
+ {__(`This is a list of all the modules of StoreGrowth. Enable your desired modules and get them ready for your next sales campaign.`, 'storegrowth-sales-booster')}
+
+
{
const $ = jQuery;
const location = window.location,
hash = location.hash,
- menuRoot = $('#toplevel_page_' + slug);
+ menuRoot = $("#toplevel_page_" + slug);
- const dashboardHashRoutes = ['#/dashboard/overview', '#/dashboard/pricing', '#/dashboard/faq'];
+ const dashboardHashRoutes = [
+ "#/dashboard/overview",
+ "#/dashboard/pricing",
+ "#/dashboard/faq",
+ ];
+
+ function adminMenuRemover() {
+ $("#wpadminbar , #adminmenumain, .notice, #wpfooter").remove();
- function adminMenuRemover() {
- $("#wpadminbar , #adminmenumain").remove();
-
$(".wp-toolbar").css({
- padding: "0", // Replace with your desired background color
+ padding: "0", // Replace with your desired background color
+ });
+ $("#wpcontent").css({
+ marginLeft: "0",
+ background: "#fff", // Replace with your desired background color
});
- $("#wpcontent, #wpfooter").css({
- marginLeft:"0",
- background: "#fff", // Replace with your desired background color
+ $("#wpbody-content").css({
+ height: "100vh", // Replace with your desired background color
});
- $(".notice").remove();
- $(document).ready(function() {
- var children = $('#wpbody-content').children();
- children.each(function() {
- var classNames = $(this).attr('class');
+
+ $(document).ready(function () {
+ var children = $("#wpbody-content").children();
+ children.each(function () {
+ var classNames = $(this).attr("class");
if (classNames) {
- var classList = classNames.split(' ');
- if (!classList.includes('metabox-prefs') && !classList.includes('wrap') && !classList.includes('clear')) {
+ var classList = classNames.split(" ");
+ if (
+ !classList.includes("metabox-prefs") &&
+ !classList.includes("wrap") &&
+ !classList.includes("clear")
+ ) {
$(this).remove();
}
}
});
});
-
-
-
-
}
// *************************************
// Add target blank for upgrade button
// *************************************
- $("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (e) {
+ $("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (
+ e
+ ) {
if ($(this).attr("href").indexOf("?page=go-sgsb-pro") > 0) {
$(this).attr("target", "_blank");
// Add hover effect
@@ -61,60 +70,60 @@ export const menuFix = (slug) => {
// Handle dashboard activation slug for first time load.
if (dashboardHashRoutes.includes(hash)) {
- $('ul.wp-submenu li', menuRoot).removeClass('current');
- menuRoot.find(`li.wp-first-item`).addClass('current');
+ $("ul.wp-submenu li", menuRoot).removeClass("current");
+ menuRoot.find(`li.wp-first-item`).addClass("current");
}
const currentUrl = location.href;
// Handle activation slug for overall submenus.
- menuRoot.on('click', 'a', function () {
+ menuRoot.on("click", "a", function () {
const self = $(this);
- $('ul.wp-submenu li', menuRoot).removeClass('current');
+ $("ul.wp-submenu li", menuRoot).removeClass("current");
// Check if submenu class then active.
- if (self.hasClass('wp-has-submenu')) {
- $('li.wp-first-item', menuRoot).addClass('current');
+ if (self.hasClass("wp-has-submenu")) {
+ $("li.wp-first-item", menuRoot).addClass("current");
} else {
- self.parents('li').addClass('current');
+ self.parents("li").addClass("current");
}
});
// Handle menu activation by submenu hyper ref checking.
- $('ul.wp-submenu a', menuRoot).each(function (index, el) {
- if ($(el).attr('href') === currentUrl) {
- $(el).parent().addClass('current');
+ $("ul.wp-submenu a", menuRoot).each(function (index, el) {
+ if ($(el).attr("href") === currentUrl) {
+ $(el).parent().addClass("current");
}
});
if ("#/ini-setup" === hash || "#ini-setup" === hash) {
adminMenuRemover();
}
-
- menuRoot.on('click', 'a', function () {
+
+ menuRoot.on("click", "a", function () {
const self = $(this);
- const uri = self.attr('href');
- const hash = uri.split('#')[1];
+ const uri = self.attr("href");
+ const hash = uri.split("#")[1];
if ("/ini-setup" === hash) {
adminMenuRemover();
}
});
-}
+};
export const extractedTitle = (title, length = 60) => {
const extractedString = title?.substr(0, length);
return extractedString?.length >= length
? `${extractedString}...`
: extractedString;
-}
+};
export const wpMedia = ({
callback,
- title = __('Select or upload media.', 'storegrowth-sales-booster'),
+ title = __("Select or upload media.", "storegrowth-sales-booster"),
selectMultiple = false,
- selectText = __('Select', 'storegrowth-sales-booster'),
- fileType = 'image',
+ selectText = __("Select", "storegrowth-sales-booster"),
+ fileType = "image",
dimension = {},
}) => {
const frame = wp.media({
@@ -131,32 +140,31 @@ export const wpMedia = ({
frame.open();
// When an file is selected, run a callback.
- frame.on('select', () => {
- const attachment = frame.state().get('selection').first().toJSON();
+ frame.on("select", () => {
+ const attachment = frame.state().get("selection").first().toJSON();
callback(attachment);
});
-}
+};
export const deactivatorHandler = (moduleID) => {
- Ajax('update_module_status', {
+ Ajax("update_module_status", {
module_id: moduleID,
- status: false
+ status: false,
}).success((response) => {
if (response.success) {
const sgsbSettingsURL = `admin.php?page=sgsb-modules`;
window.location.href = sgsbSettingsURL;
}
});
-
-}
+};
export const removeHashFromURL = (url) => {
- if (url.startsWith('#/')) {
+ if (url.startsWith("#/")) {
return url.slice(2); // Remove "#/"
- } else if (url.startsWith('#')) {
+ } else if (url.startsWith("#")) {
return url.slice(1); // Remove "#"
} else {
return url; // No change needed
}
-}
+};
From 69938b8f0f61fac217b0dce8477919282aa4950d Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Wed, 13 Mar 2024 14:49:53 +0600
Subject: [PATCH 22/25] fix: onboarding process checker added
---
Includes/Admin/AdminHooks.php | 4 ++
Includes/Ajax.php | 11 ++++++
.../initail-setup/ContentLayout.jsx | 6 +--
.../initail-setup/IniSetupLayout.jsx | 37 +++++++++++++------
.../src/components/initail-setup/Progress.jsx | 4 +-
5 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/Includes/Admin/AdminHooks.php b/Includes/Admin/AdminHooks.php
index 08755653..1c091935 100644
--- a/Includes/Admin/AdminHooks.php
+++ b/Includes/Admin/AdminHooks.php
@@ -52,6 +52,10 @@ public function plugin_action_links( $links ) {
*/
public function sgsb_redirect_initial_setup() {
+ $ini_setup_completion = get_option( 'sgsb_ini_completion' );
+ if ( $ini_setup_completion ) {
+ return;}
+
if ( get_option( 'storegrowth_activation_redirect', false ) ) {
delete_option( 'storegrowth_activation_redirect' );
if ( wp_safe_redirect( admin_url( 'admin.php?page=sgsb-modules#/ini-setup' ) ) ) {
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index 62facaab..af210b8c 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -57,6 +57,7 @@ private function __construct() {
* Register ajax callback
*/
add_action( 'wp_ajax_sgsb_process_user_concent_data', array( $this, 'sgsb_process_user_concent_data' ) );
+ add_action( 'wp_ajax_sgsb_inisetup_flag_update', array( $this, 'sgsb_inisetup_flag_update' ) );
}
/**
@@ -264,4 +265,14 @@ public function sgsb_process_user_concent_data() {
wp_send_json_success( array( 'message' => 'Success message' ) );
wp_die();
}
+ /**
+ * Process Consent Data
+ */
+ public function sgsb_inisetup_flag_update() {
+ check_ajax_referer( 'sgsb_ajax_nonce', '_ajax_nonce' );
+ $flag_data = isset( $_POST['sgsb_ini_completion'] );
+ update_option( 'sgsb_ini_completion', $flag_data );
+ wp_send_json_success( array( 'message' => 'Success message' ) );
+ wp_die();
+ }
}
diff --git a/assets/src/components/initail-setup/ContentLayout.jsx b/assets/src/components/initail-setup/ContentLayout.jsx
index fc5c8172..dc0bbbaf 100644
--- a/assets/src/components/initail-setup/ContentLayout.jsx
+++ b/assets/src/components/initail-setup/ContentLayout.jsx
@@ -4,13 +4,13 @@ import Welcome from './Welcome';
import ModulesSetup from './ModulesSetup';
import Ready from './Ready';
-const ContentLayout = ({ current, next, prev, stepSize = 0, agreementData, handleCheckbox ,getUserDetails}) => {
+const ContentLayout = ({ current, next, prev, stepSize = 0, agreementData, handleCheckbox, getUserDetails, iniSetupChecker }) => {
const renderContent = () => {
switch (parseInt(current)) {
case 0:
- return ;
+ return ;
case 1:
return ;
case 2:
@@ -31,7 +31,7 @@ const ContentLayout = ({ current, next, prev, stepSize = 0, agreementData, handl
iniSetupChecker()}
>
{__(`Go to dashboard`, "storegrowth-sales-booster")}
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index 1582128f..42ce8252 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -9,6 +9,7 @@ import Progress from "./Progress";
import { Steps } from "antd";
import StoreGrowthIcon from "../../../images/logo.svg";
import { __ } from "@wordpress/i18n";
+import { Ajax } from "../../ajax";
const IniSetupLayout = () => {
const [current, setCurrent] = useState(0);
@@ -33,31 +34,44 @@ const IniSetupLayout = () => {
];
const stepSize = steps.length;
- const getUserDetails = async () => {
+ const fetchData = async (url, params) => {
try {
- const response = await fetch("/wp-admin/admin-ajax.php", {
+ const response = await fetch(url, {
method: "POST",
credentials: "same-origin",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
- body: new URLSearchParams({
- _ajax_nonce: sgsbAdmin.nonce,
- action: "sgsb_process_user_concent_data",
- data: JSON.stringify(agreementData),
- }),
+ body: new URLSearchParams(params),
});
if (!response.ok) {
throw new Error("Network response was not ok");
}
-
- const responseData = await response.json();
+ return await response.json();
} catch (error) {
- console.error("Error fetching user details:", error);
+ console.error("Error fetching data:", error);
}
};
+ const getUserDetails = async () => {
+ const params = {
+ _ajax_nonce: sgsbAdmin.nonce,
+ action: "sgsb_process_user_concent_data",
+ data: JSON.stringify(agreementData),
+ };
+ return await fetchData("/wp-admin/admin-ajax.php", params);
+ };
+
+ const iniSetupChecker = async () => {
+ const params = {
+ _ajax_nonce: sgsbAdmin.nonce,
+ action: "sgsb_inisetup_flag_update",
+ sgsb_ini_completion: true,
+ };
+ return await fetchData("/wp-admin/admin-ajax.php", params);
+ };
+
const handleCheckbox = (key, value) => {
setAgreementData({
...agreementData,
@@ -77,7 +91,7 @@ const IniSetupLayout = () => {
const skipHandler = (event) => {
if (current !== (stepSize - 1)) {
next();
- } else redirectHandler();
+ } else { redirectHandler(); iniSetupChecker(); }
}
useEffect(() => {
@@ -127,6 +141,7 @@ const IniSetupLayout = () => {
agreementData={agreementData}
handleCheckbox={handleCheckbox}
getUserDetails={getUserDetails}
+ iniSetupChecker={iniSetupChecker}
/>
diff --git a/assets/src/components/initail-setup/Progress.jsx b/assets/src/components/initail-setup/Progress.jsx
index 64d2a8f8..d50507d6 100644
--- a/assets/src/components/initail-setup/Progress.jsx
+++ b/assets/src/components/initail-setup/Progress.jsx
@@ -2,11 +2,11 @@
import { Fragment } from '@wordpress/element';
import ContentLayout from './ContentLayout';
-const Progress = ({ next, prev, current, setCurrent, stepSize, agreementData, handleCheckbox ,getUserDetails}) => {
+const Progress = ({ next, prev, current,stepSize, agreementData, handleCheckbox ,getUserDetails, iniSetupChecker}) => {
return (
-
+
);
}
From 65071abb313ae9109e04d6cca847c69ad3e5862a Mon Sep 17 00:00:00 2001
From: Satyajit Talukder
Date: Wed, 13 Mar 2024 15:32:56 +0600
Subject: [PATCH 23/25] fix: skip dynamic button
---
assets/src/components/initail-setup/IniSetupLayout.jsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/assets/src/components/initail-setup/IniSetupLayout.jsx b/assets/src/components/initail-setup/IniSetupLayout.jsx
index 42ce8252..d034cec0 100644
--- a/assets/src/components/initail-setup/IniSetupLayout.jsx
+++ b/assets/src/components/initail-setup/IniSetupLayout.jsx
@@ -104,6 +104,7 @@ const IniSetupLayout = () => {
}, [current]);
const DynamicContent = current !== (stepSize - 1) ? "Skip This Step" : "Skip Guide";
+
return (
@@ -126,7 +127,7 @@ const IniSetupLayout = () => {
className="skipper-link"
onClick={() => skipHandler()}
>
- {__(`${DynamicContent}`, "storegrowth-sales-booster")}
+ {__(`${current !== 0 ? DynamicContent : ""}`, "storegrowth-sales-booster")}
From 4417ffecdcce2baa60a6a610b1e33b5d2d3bd25e Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Wed, 13 Mar 2024 15:50:47 +0600
Subject: [PATCH 24/25] update api endpoint
---
Includes/Ajax.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Includes/Ajax.php b/Includes/Ajax.php
index af210b8c..aee392cf 100644
--- a/Includes/Ajax.php
+++ b/Includes/Ajax.php
@@ -31,7 +31,7 @@ class Ajax {
/**
* API URL
*/
- const API_URL = 'http://woo-plugin-dev.test/wp-json/invizo-insights/v1/save-data';
+ const API_URL = 'https://invizo.io/wp-json/invizo-insights/v1/save-data';
/**
* Installed Plugin File
@@ -243,7 +243,7 @@ public function sgsb_process_user_concent_data() {
'redirection' => 5,
'blocking' => true,
'httpversion' => '1.0',
- 'sslverify' => false,
+ 'sslverify' => true,
'data_format' => 'body',
);
From c393a005c8681e14d7c14e1641b20b31a7657da4 Mon Sep 17 00:00:00 2001
From: mehedi hasan
Date: Wed, 13 Mar 2024 15:53:58 +0600
Subject: [PATCH 25/25] deploy changes 1-25.7
---
.github/workflows/deploy.yml | 2 +-
README.txt | 6 +++++-
storegrowth-sales-booster.php | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 786ed9cb..77b47666 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -23,4 +23,4 @@ jobs:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: storegrowth-sales-booster
- VERSION: 1.24.7
+ VERSION: 1.25.7
diff --git a/README.txt b/README.txt
index 93201d9e..25a51fa1 100644
--- a/README.txt
+++ b/README.txt
@@ -4,7 +4,7 @@ Tags: floating cart, fly cart, side cart, checkout optimization, notification ba
Requires at least: 5.4
Tested up to: 6.4.1
-Stable tag: 1.24.7
+Stable tag: 1.25.7
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -216,6 +216,10 @@ StoreGrowth floating notification bar displays ongoing offers and discounts whil
== Changelog ==
+= 1.25.7 - 10 March, 2024 =
+
+enhance: add onboarding screen
+
= 1.24.7 - 10 March, 2024 =
update: fly cart icon and prompt text
diff --git a/storegrowth-sales-booster.php b/storegrowth-sales-booster.php
index 0c4361a6..56875dc6 100644
--- a/storegrowth-sales-booster.php
+++ b/storegrowth-sales-booster.php
@@ -2,7 +2,7 @@
/**
* Plugin Name: StoreGrowth - Sales Booster For WooCommerce Lite
* Description: Best WooCommerce Direct Checkout, Fly Cart and Side Cart, Live Sales Notifications, Floating Notification Bar and More Essential Features for Every WooCommerce Site!
- * Version: 1.24.7
+ * Version: 1.25.7
* Author: Invizo
* Author URI: https://invizo.io/
* License: GPL-2.0+