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

change the option name according to newfold standards #312

Merged
merged 8 commits into from
Jun 26, 2024
3 changes: 2 additions & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '82fc366b1c64c71eb887');
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'befd0e22adb79ae95781');

6 changes: 3 additions & 3 deletions includes/ECommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ECommerce {
'woocommerce_cheque_settings',
'onboarding_experience_level',
'yoast_seo_signup_status',
'showMigrationSteps',
'nfd_show_migration_steps',
'update_site_server_clicked',
);

Expand Down Expand Up @@ -322,7 +322,7 @@ public function register_settings() {
);
\register_setting(
'general',
'showMigrationSteps',
'nfd_show_migration_steps',
array(
'show_in_rest' => true,
'type' => 'boolean',
Expand Down Expand Up @@ -707,7 +707,7 @@ function check_url_match( $brand_name, $site_url ) {
}
}
if ( check_url_match( $brand, $site_url ) ) {
update_option( 'showMigrationSteps', false );
update_option( 'nfd_show_migration_steps', false );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/OnboardingScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function OnboardingScreen({

useEffect(() => {
WordPressSdk.settings.get().then((res) => {
setIsMigrationCompleted( res.showMigrationSteps || false );
setIsMigrationCompleted( res.nfd_show_migration_steps || false );
setWebServersUpdated( res.update_site_server_clicked );
if (res?.page_on_front && res?.show_on_front === "page") {
setEditUrl(
Expand Down
10 changes: 5 additions & 5 deletions src/configs/OnboardingList.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const updateMigrateViewGuide = () => {
};

const updateStoreSetup = (setIsMigrationCompleted) => {
WordPressSdk.settings.put({ showMigrationSteps: false }).then(() => {
WordPressSdk.settings.put({ nfd_show_migration_steps: false }).then(() => {
WordPressSdk.settings.get();
setIsMigrationCompleted(false);
});
Expand Down Expand Up @@ -87,7 +87,7 @@ export function OnboardingListDefinition(props) {
),
state: {
isCompleted: (queries) => queries?.settings?.update_site_server_clicked || check_url_match(brandName),
isMigrated: (queries) => queries?.settings?.showMigrationSteps && props.isMigrationCompleted
isMigrated: (queries) => queries?.settings?.nfd_show_migration_steps && props.isMigrationCompleted
},
shouldRender: (state) => (state.isMigrated),
actions: {
Expand All @@ -110,7 +110,7 @@ export function OnboardingListDefinition(props) {
),
state: {
isCompleted: () => check_url_match( brandName ),
isMigrated: (queries) => queries?.settings?.showMigrationSteps && props.isMigrationCompleted,
isMigrated: (queries) => queries?.settings?.nfd_show_migration_steps && props.isMigrationCompleted,
},

"data-nfdhelpcenterquery": __(
Expand All @@ -133,7 +133,7 @@ export function OnboardingListDefinition(props) {
),
state: {
isCompleted: (queries) => (queries?.settings?.update_site_server_clicked && check_url_match(brandName)) || check_url_match(brandName),
isMigrated: (queries) => queries?.settings?.showMigrationSteps,
isMigrated: (queries) => queries?.settings?.nfd_show_migration_steps,
className: () => "nfd-bg-canvas",
hideCheck: () => true,
showText: () => <a className="nfd-underline" href={ VIEW_GUIDE_LINK[brandName] } target="_blank">View Guide</a>
Expand All @@ -154,7 +154,7 @@ export function OnboardingListDefinition(props) {
),
state: {
isCompleted: (queries) => !props.isMigrationCompleted,
isMigrated: (queries) => queries?.settings?.showMigrationSteps && (queries?.settings?.update_site_server_clicked || check_url_match(brandName)),
isMigrated: (queries) => queries?.settings?.nfd_show_migration_steps && (queries?.settings?.update_site_server_clicked || check_url_match(brandName)),
},
shouldRender: (state) => state.isMigrated && !state.isCompleted,
actions: {
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/integration/Home/migration.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe( 'Home page - post migration events with help center ', () => {
if ( pluginId !== 'bluehost' ) {
this.skip();
}
cy.exec( `npx wp-env run cli wp option set showMigrationSteps "true"` );
cy.exec( `npx wp-env run cli wp option set nfd_show_migration_steps "true"` );
cy.exec(
`npx wp-env run cli wp option delete _transient_nfd_site_capabilities`,
{ failOnNonZeroExit: false }
Expand Down
Loading