Skip to content

Commit

Permalink
Capture step: Update logic proving fromUrl as query param
Browse files Browse the repository at this point in the history
This allows us to have direct access support of ready screens, getting rid of urlData dependency from the capture screen.
  • Loading branch information
bogiii committed Jan 11, 2024
1 parent 8062d69 commit 648eeb3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion client/blocks/import/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export type GoToStep = ( stepName: string, stepSectionName?: string, flowName?: string ) => void;
export type GoToStep = (
stepName: string,
stepSectionName?: string,
params?: { fromUrl: string }
) => void;
export type GoToNextStep = () => void;
export type RecordTracksEvent = ( name: string, properties: { [ key: string ]: string } ) => void;
export type UrlData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import CaptureStep from 'calypso/blocks/import/capture';
import DocumentHead from 'calypso/components/data/document-head';
import { useCurrentRoute } from 'calypso/landing/stepper/hooks/use-current-route';
import useMigrationConfirmation from 'calypso/landing/stepper/hooks/use-migration-confirmation';
import { useSiteSlug } from 'calypso/landing/stepper/hooks/use-site-slug';
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
import { BASE_ROUTE } from './config';
import { generateStepPath } from './helper';
Expand Down Expand Up @@ -82,12 +83,18 @@ export const ImportWrapper: Step = function ( props ) {

const ImportStep: Step = function ImportStep( props ) {
const { navigation, flow } = props;
const siteSlug = useSiteSlug();

return (
<ImportWrapper { ...props }>
<CaptureStep
disableImportListStep={ IMPORT_HOSTED_SITE_FLOW === flow }
goToStep={ ( step, section ) => navigation.goToStep?.( generateStepPath( step, section ) ) }
goToStep={ ( step, section, params ) => {
const stepPath = generateStepPath( step, section );
const from = encodeURIComponent( params?.fromUrl || '' );

navigation.goToStep?.( `${ stepPath }?siteSlug=${ siteSlug }&from=${ from }` );
} }
/>
</ImportWrapper>
);
Expand Down

0 comments on commit 648eeb3

Please sign in to comment.