Skip to content

Commit

Permalink
Add sitegen detection
Browse files Browse the repository at this point in the history
  • Loading branch information
arunshenoy99 committed Nov 7, 2023
1 parent e31c024 commit b989ca2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions includes/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ public static function current_brand() {
* @return array
*/
public static function current_plan() {
$is_sitegen = Flows::is_sitegen();
if ( $is_sitegen ) {
return array(
'flow' => 'sitegen',
'subtype' => null,
'type' => null,
);
}

$customer_data = self::customer_data();

$current_flow = Flows::get_flow_from_customer_data( $customer_data );
Expand Down
16 changes: 16 additions & 0 deletions includes/Flows/Flows.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,22 @@ public static function get_flow_from_plan_subtype( $plan_subtype ) {
}
return false;
}

/**
* Determines whether SiteGen flow was ever visited.
*
* @return boolean
*/
public static function is_sitegen() {
$flow_data = FlowService::read_data_from_wp_option();
if ( ! ( $flow_data && empty( $flow_data['sitegen'] ) ) ) {
return false;
}

return true === self::get_flows()['sitegen'];

}

/**
* Get the corresponding flow from the top priority in flow data.
*
Expand Down

0 comments on commit b989ca2

Please sign in to comment.