Skip to content

Commit 632e871

Browse files
committed
Disable coming soon page after fork step
1 parent 13ac6be commit 632e871

File tree

6 files changed

+34
-3
lines changed

6 files changed

+34
-3
lines changed

build/2.7.4/onboarding.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-media-utils', 'wp-preferences', 'wp-url'), 'version' => 'c2e556c47af49034b3bd');
1+
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-core-data', 'wp-data', 'wp-deprecated', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-media-utils', 'wp-preferences', 'wp-url'), 'version' => 'ea31651aae79aab1f7a2');

build/2.7.4/onboarding.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/steps/Canvas/HeaderActions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const HeaderActions = () => {
3535
const handleSelectAndCustomize = async () => {
3636
await handlePublishSite();
3737

38+
// Analytics: Onboarding complete event.
3839
sendOnboardingEvent(
3940
new OnboardingEvent( ACTION_ONBOARDING_COMPLETE, 'select_and_customize', {
4041
source: 'quickstart',
@@ -48,6 +49,7 @@ const HeaderActions = () => {
4849
const handleSaveAndPublish = async () => {
4950
await handlePublishSite();
5051

52+
// Analytics: Onboarding complete event.
5153
sendOnboardingEvent(
5254
new OnboardingEvent( ACTION_ONBOARDING_COMPLETE, 'save_and_publish', {
5355
source: 'quickstart',

src/app/steps/Fork/ForkStep.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import SiteCreatorCard from './SiteCreatorCard';
66
import MigrationCard from './MigrationCard';
77
import { OnboardingEvent, trackOnboardingEvent } from '@/utils/analytics/hiive';
88
import { ACTION_ONBOARDING_STARTED } from '@/utils/analytics/hiive/constants';
9+
import { disableComingSoon } from '@/utils/api';
910

1011
const ForkStep = () => {
1112
const { canMigrateSite, migrationFallbackUrl } = useSelect(
@@ -22,6 +23,17 @@ const ForkStep = () => {
2223
trackOnboardingEvent(
2324
new OnboardingEvent( ACTION_ONBOARDING_STARTED )
2425
);
26+
/**
27+
* Before unmounting: Disable the site coming soon page.
28+
* This is necessary for the Screenshot Service to be able to load the sitegen previews.
29+
* As a side effect (intentionally), this will also send the 'site_launched' event.
30+
* See coming soon module for more details.
31+
*
32+
* Analytics: Site launched event.
33+
*/
34+
return () => {
35+
disableComingSoon();
36+
};
2537
}, [] );
2638

2739
return (

src/app/steps/Generating/ExperienceOptions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { FeaturesSelect, Title } from '@newfold/ui-component-library';
44
import { nfdOnboardingStore } from '@/data/store';
55

66
const ExperienceOptions = () => {
7-
87
const { selectedExperienceLevel } = useSelect( ( select ) => {
98
return {
109
selectedExperienceLevel: select( nfdOnboardingStore ).getExperienceLevel(),

src/app/utils/api/onboarding.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,24 @@ export const completeOnboarding = async ( selectedSitegenHomepage ) => {
5757
);
5858
};
5959

60+
/**
61+
* Disable the site coming soon page.
62+
*
63+
* @return {Promise<boolean>} true if the coming soon page was disabled successfully, false otherwise
64+
*/
65+
export const disableComingSoon = async () => {
66+
const comingSoon = window?.NewfoldRuntime.comingSoon;
67+
if ( comingSoon ) {
68+
const result = await comingSoon.disable();
69+
if ( result?.success ) {
70+
return true;
71+
}
72+
// eslint-disable-next-line no-console
73+
console.error( 'Failed to disable coming soon' );
74+
return false;
75+
}
76+
};
77+
6078
/**
6179
* Set a color palette array of WordPress color objects.
6280
*

0 commit comments

Comments
 (0)