Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isFreshInstallation to data #71

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"mustache/mustache": "^2.14",
"newfold-labs/wp-module-data": "^2.0",
"newfold-labs/wp-module-coming-soon": "^1.2",
"newfold-labs/wp-module-performance": "^1.4"
"newfold-labs/wp-module-performance": "^1.4",
"newfold-labs/wp-module-install-checker": "^1.0"
},
"require-dev": {
"newfold-labs/wp-php-standards": "^1.2",
Expand Down
41 changes: 40 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 24 additions & 14 deletions includes/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,20 @@ final class Data {
*/
public static function runtime() {
return array(
'buildUrl' => \NFD_ONBOARDING_BUILD_URL,
'siteUrl' => \get_site_url(),
'restUrl' => \get_home_url() . '/index.php?rest_route=',
'adminUrl' => \admin_url(),
'currentBrand' => self::current_brand(),
'currentPlan' => self::current_plan(),
'currentFlow' => self::current_flow(),
'pluginInstallHash' => PluginInstaller::rest_get_plugin_install_hash(),
'previewSettings' => array(
'buildUrl' => \NFD_ONBOARDING_BUILD_URL,
'siteUrl' => \get_site_url(),
'restUrl' => \get_home_url() . '/index.php?rest_route=',
'adminUrl' => \admin_url(),
'currentBrand' => self::current_brand(),
'currentPlan' => self::current_plan(),
'currentFlow' => self::current_flow(),
'pluginInstallHash' => PluginInstaller::rest_get_plugin_install_hash(),
'previewSettings' => array(
'settings' => Preview::get_settings(),
'stepPreviewData' => Themes::step_preview_data(),
),
'aiPreviewSettings' => array(
'settings' => Preview::get_settings(),
'stepPreviewData' => Themes::step_preview_data(),
),
'currentUserDetails' => self::wp_current_user_details(),
'currentUserDetails' => self::wp_current_user_details(),
'isFreshInstallation' => self::is_fresh_installation(),
);
}

Expand Down Expand Up @@ -175,4 +172,17 @@ public static function wp_current_user_details() {
'avatarUrl' => '',
);
}

/**
* Returns whether the site is a fresh installation or not.
*
* @return boolean
*/
private static function is_fresh_installation() {
if ( container()->has( 'isFreshInstallation' ) ) {
return container()->get( 'isFreshInstallation' );
}

return false;
}
}
36 changes: 19 additions & 17 deletions includes/Flows/Flows.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class Flows {
// to populate the step fields if a user is resuming a flow.
'data' => array(
// Any manual fixes or modification made to siteType shall also be made in FlowService::update_default_data_for_ecommerce()
'siteType' => array(
'siteType' => array(
'referTo' => 'site',
'primary' => array(
'refers' => '',
Expand All @@ -51,30 +51,30 @@ final class Flows {
),
),

'wpComfortLevel' => '0',
'wpComfortLevel' => '0',

// Any manual fixes or modification made to topPriority shall also be made in FlowServices::update_default_data_for_ecommerce()
// Enums: `publishing`, `designing`, `selling`, 'migrating', 'regenerate' and 'skip'
'topPriority' => array(
'topPriority' => array(
'priority1' => '',
),

// This data will map to WordPress default 'blogname'
'blogName' => '',
'blogName' => '',

// This data will map to WordPress default 'blogdescription'
'blogDescription' => '',
'blogDescription' => '',

// This integer will map to the attachment ID for an uploaded image to the WordPress media library
'siteLogo' => array(
'siteLogo' => array(
'id' => 0,
'url' => '',
),

// key-value store for social media accounts
'accounts' => array(),
'accounts' => array(),

'theme' => array(
'theme' => array(
// This is the WordPress parent theme slug
'template' => '',

Expand All @@ -85,29 +85,31 @@ final class Flows {
'variation' => '',
),

'customDesign' => false,
'customDesign' => false,

'colorStyle' => '',
'colorStyle' => '',

'fontStyle' => '',
'fontStyle' => '',

// This string will identify the Header Pattern
'partHeader' => '',
'partHeader' => '',

'partFooter' => '',
'partFooter' => '',

// for eg. Home, About, Contact, Blog|News, Resume, Portfolio, Staff and Link in Bio
'sitePages' => array(
'sitePages' => array(
'homepage' => '',
'other' => array(),
),

// will include plugin installs, module activation/deactivation and perhaps API calls to the hosting platform for Newfold-specific services
'siteFeatures' => array(),
'siteFeatures' => array(),

'chapters' => array(),
'chapters' => array(),

'comingSoon' => false,
'comingSoon' => false,

'siteOverrideConsent' => false,
),

'activeFlow' => '',
Expand Down
Loading