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

Find a way to track migration initiated from MFE #602

Merged
merged 8 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
setSettings,
initialize as initializeSettings,
} from '../../../utils/api/settings';
import { isEmpty, updateWPSettings } from '../../../utils/api/ecommerce';
import { fetchWPSettings, isEmpty, updateWPSettings } from '../../../utils/api/ecommerce';
import { store as nfdOnboardingStore } from '../../../store';
import { getQueryParam } from '../../../utils';
import { API_REQUEST } from '../../../../constants';
Expand Down Expand Up @@ -64,6 +64,7 @@
ACTION_MIGRATION_INITIATED,
ACTION_PAGEVIEW,
CATEGORY,
ACTION_MFE_MIGRATION_INITIATED,
} from '../../../utils/analytics/hiive/constants';

import { socialMediaStoreToState } from '../../SocialMediaForm/utils';
Expand Down Expand Up @@ -116,12 +117,13 @@
select( nfdOnboardingStore ).getinstaWpMigrationUrl(),
};
},
[ location.pathname ]

Check warning on line 120 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useSelect has an unnecessary dependency: 'location.pathname'. Either exclude it or remove the dependency array

Check warning on line 120 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useSelect has an unnecessary dependency: 'location.pathname'. Either exclude it or remove the dependency array
);

const [ isRequestPlaced, setIsRequestPlaced ] = useState( false );
const [ didVisitBasicInfo, setDidVisitBasicInfo ] = useState( false );
const [ didVisitEcommerce, setDidVisitEcommerce ] = useState( false );
const [ isMfeMigrationInitiated, setIsMfeMigrationInitiated ] = useState( false );
const {
setActiveChapter,
flushQueue,
Expand Down Expand Up @@ -389,7 +391,7 @@
if ( instaWpMigrationUrl ) {
sendOnboardingEvent(
new OnboardingEvent(
ACTION_MIGRATION_INITIATED,
isMfeMigrationInitiated ? ACTION_MFE_MIGRATION_INITIATED : ACTION_MIGRATION_INITIATED,
instaWpMigrationUrl
)
);
Expand All @@ -399,12 +401,13 @@

useEffect( () => {
trackChapters();
}, [ currentStep ] );

Check warning on line 404 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'trackChapters'. Either include it or remove the dependency array

Check warning on line 404 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'trackChapters'. Either include it or remove the dependency array

// Track Migration Initated Event in the Migration Step.
useEffect( () => {
fetchWPSettings().then( ( res ) => ( setIsMfeMigrationInitiated( res.nfd_migrate_site ) ) );
officiallygod marked this conversation as resolved.
Show resolved Hide resolved
trackInstaWpMigrationEvent();
}, [ instaWpMigrationUrl ] );

Check warning on line 410 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'trackInstaWpMigrationEvent'. Either include it or remove the dependency array

Check warning on line 410 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'trackInstaWpMigrationEvent'. Either include it or remove the dependency array

const prioritizeFlow = () => {
const currentFlow = window.nfdOnboarding.currentFlow;
Expand Down Expand Up @@ -445,13 +448,13 @@
initializeSettings();
setInterval( cronTrigger, 45000 );
}
}, [ initialize ] );

Check warning on line 451 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'pluginInstallHash'. Either include it or remove the dependency array

Check warning on line 451 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'pluginInstallHash'. Either include it or remove the dependency array

useEffect( () => {
if ( false !== brandConfig?.prioritization ) {
return prioritizeFlow();
}
}, [ experienceLevel, topPriority ] );

Check warning on line 457 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'brandConfig?.prioritization' and 'prioritizeFlow'. Either include them or remove the dependency array

Check warning on line 457 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'brandConfig?.prioritization' and 'prioritizeFlow'. Either include them or remove the dependency array

useEffect( () => {
document.body.classList.add( `nfd-brand-${ newfoldBrand }` );
Expand All @@ -461,7 +464,7 @@
syncStoreToDB();
handlePreviousStepTracking();
handleConditionalDesignStepsRoutes();
}, [ location.pathname, onboardingFlow ] );

Check warning on line 467 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'handleConditionalDesignStepsRoutes', 'handlePreviousStepTracking', and 'syncStoreToDB'. Either include them or remove the dependency array

Check warning on line 467 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'handleConditionalDesignStepsRoutes', 'handlePreviousStepTracking', and 'syncStoreToDB'. Either include them or remove the dependency array

useEffect( () => {
sendOnboardingEvent( new OnboardingEvent( ACTION_PAGEVIEW ) );
Expand Down
2 changes: 2 additions & 0 deletions src/OnboardingSPA/utils/analytics/hiive/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const ACTION_ONBOARDING_CHAPTER_STARTED = 'onboarding_chapter_started';
export const ACTION_ONBOARDING_CHAPTER_COMPLETE = 'onboarding_chapter_complete';
export const ACTION_SOCIAL_ADDED = 'social_added';
export const ACTION_MIGRATION_INITIATED = 'migration_initiated';
export const ACTION_MFE_MIGRATION_INITIATED = 'mfe_migration_initiated';

export const ACTION_SITEGEN_FORK_OPTION_SELECTED = 'fork_option_selected';
export const ACTION_SITEGEN_SITE_DETAILS_PROMPT_SET = 'site_details_prompt_set';
Expand Down Expand Up @@ -66,5 +67,6 @@ export const ACTION_TO_LABEL_KEY_MAP = {
[ ACTION_SITEGEN_HOMEPAGE_RENAMED ]: 'version',
[ ACTION_SITEGEN_SITE_GENERATION_TIME ]: 'time',
[ ACTION_MIGRATION_INITIATED ]: 'path',
[ ACTION_MFE_MIGRATION_INITIATED ]: 'path',
[ ACTION_SITEGEN_ERROR_STATE_TRIGGERED ]: 'identifier',
};
Loading