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 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { ThemeProvider } from '../../ThemeContextProvider';
import { stepTheFork } from '../../../steps/TheFork/step';
import { stepSiteGenMigration } from '../../../steps/SiteGen/Migration/step';
import { useWPSettings as getWPSettings } from '../../../steps/Ecommerce/useWPSettings';

// classes
import { HiiveAnalytics } from '@newfold-labs/js-utility-ui-analytics';
Expand Down Expand Up @@ -64,6 +65,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,7 +118,7 @@
select( nfdOnboardingStore ).getinstaWpMigrationUrl(),
};
},
[ location.pathname ]

Check warning on line 121 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 );
Expand Down Expand Up @@ -387,24 +389,24 @@
const trackInstaWpMigrationEvent = () => {
if ( currentStep?.path === stepSiteGenMigration?.path ) {
if ( instaWpMigrationUrl ) {
sendOnboardingEvent(
getWPSettings().then( ( res ) => sendOnboardingEvent(
new OnboardingEvent(
ACTION_MIGRATION_INITIATED,
res.nfd_migrate_site ? ACTION_MFE_MIGRATION_INITIATED : ACTION_MIGRATION_INITIATED,
instaWpMigrationUrl
)
);
) );
}
}
};

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

// Track Migration Initated Event in the Migration Step.
useEffect( () => {
trackInstaWpMigrationEvent();
}, [ instaWpMigrationUrl ] );

Check warning on line 409 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 +447,13 @@
initializeSettings();
setInterval( cronTrigger, 45000 );
}
}, [ initialize ] );

Check warning on line 450 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 456 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 +463,7 @@
syncStoreToDB();
handlePreviousStepTracking();
handleConditionalDesignStepsRoutes();
}, [ location.pathname, onboardingFlow ] );

Check warning on line 466 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