6
6
use NewfoldLabs \WP \Module \Onboarding \WP_Admin ;
7
7
use NewfoldLabs \WP \Module \Onboarding \Data \Config ;
8
8
9
- use function NewfoldLabs \WP \ModuleLoader \container ;
10
-
11
9
/**
12
10
* Tracks the Status of Onboarding.
13
11
*/
@@ -18,7 +16,7 @@ class StatusService {
18
16
*
19
17
* @return void
20
18
*/
21
- public static function handle_started () {
19
+ public static function handle_started (): void {
22
20
if ( 'started ' !== get_option ( Options::get_option_name ( 'status ' ) ) ) {
23
21
update_option ( Options::get_option_name ( 'status ' ), 'started ' );
24
22
do_action ( 'newfold/onboarding/started ' );
@@ -30,7 +28,7 @@ public static function handle_started() {
30
28
*
31
29
* @return void
32
30
*/
33
- public static function handle_completed () {
31
+ public static function handle_completed (): void {
34
32
if ( 'started ' === get_option ( Options::get_option_name ( 'status ' ) ) ) {
35
33
update_option ( Options::get_option_name ( 'status ' ), 'completed ' );
36
34
self ::update_onboarding_restart_status ();
@@ -44,7 +42,7 @@ public static function handle_completed() {
44
42
*
45
43
* @return bool True if the site was created within the last 275 days, false otherwise.
46
44
*/
47
- private static function is_site_created_within_last_9_months () {
45
+ private static function is_site_created_within_last_9_months (): bool {
48
46
$ install_date_timestamp = get_option ( Options::get_option_name ( 'bluehost_plugin_install_date ' , false ) );
49
47
50
48
// If the option is not set or is invalid, return false
@@ -63,7 +61,7 @@ private static function is_site_created_within_last_9_months() {
63
61
*
64
62
* @return bool True if eligible, false otherwise.
65
63
*/
66
- public static function is_onboarding_restart_eligible () {
64
+ public static function is_onboarding_restart_eligible (): bool {
67
65
// Check if the brand is eligible for Restarting Onboarding
68
66
$ brand_config = Brands::get_brands ()[ NFD_ONBOARDING_PLUGIN_BRAND ]['config ' ] ?? array ();
69
67
if ( empty ( $ brand_config ['canRestartOnboarding ' ] ) || ! $ brand_config ['canRestartOnboarding ' ] ) {
@@ -83,7 +81,7 @@ public static function is_onboarding_restart_eligible() {
83
81
*
84
82
* @return void
85
83
*/
86
- public static function update_onboarding_restart_status () {
84
+ public static function update_onboarding_restart_status (): void {
87
85
88
86
// Don't do anything if the customer is not eligible
89
87
if ( ! self ::is_onboarding_restart_eligible () ) {
@@ -93,7 +91,7 @@ public static function update_onboarding_restart_status() {
93
91
// Get flow data
94
92
$ flow_data = get_option ( Options::get_option_name ( 'flow ' ) );
95
93
96
- if ( isset ( $ flow_data ) ) {
94
+ if ( isset ( $ flow_data[ ' onboardingRetries ' ] ) && ! empty ( $ flow_data [ ' onboardingRetries ' ] ) ) {
97
95
// Increment the total onboarding tries
98
96
$ flow_data ['onboardingRetries ' ]['retryCount ' ] = ( $ flow_data ['onboardingRetries ' ]['retryCount ' ] ?? 0 ) + 1 ;
99
97
@@ -102,7 +100,7 @@ public static function update_onboarding_restart_status() {
102
100
103
101
// Determine eligibility for restarting onboarding
104
102
$ current_retry_count = $ flow_data ['onboardingRetries ' ]['retryCount ' ];
105
- $ can_restart = $ current_retry_count < $ flow_data ['onboardingRetries ' ]['maxRetryCount ' ];
103
+ $ can_restart = $ current_retry_count < $ flow_data ['onboardingRetries ' ]['maxRetryCount ' ];
106
104
107
105
// Update the eligibility status in wp_option
108
106
update_option ( Options::get_option_name ( 'can_restart ' ), $ can_restart );
@@ -114,7 +112,7 @@ public static function update_onboarding_restart_status() {
114
112
*
115
113
* @return void
116
114
*/
117
- public static function track () {
115
+ public static function track (): void {
118
116
global $ pagenow ;
119
117
120
118
if ( defined ( 'DOING_AJAX ' ) && DOING_AJAX ) {
0 commit comments