File size: 2,276 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
import page from '@automattic/calypso-router';
import i18n from 'i18n-calypso';
import { recordTracksEvent } from 'calypso/state/analytics/actions';
import BookCalendarStep from './book/calendar-step';
import BookConfirmationStep from './book/confirmation-step';
import BookInfoStep from './book/info-step';
import BookSkeleton from './book/skeleton';
import ConciergeCancel from './cancel';
import ConciergeMain from './main';
import RescheduleCalendarStep from './reschedule/calendar-step';
import RescheduleConfirmationStep from './reschedule/confirmation-step';
import RescheduleSkeleton from './reschedule/skeleton';
import './style.scss';
const book = ( context, next ) => {
context.primary = (
<ConciergeMain
analyticsPath="/me/quickstart/:site/book"
analyticsTitle="Concierge > Book"
skeleton={ BookSkeleton }
siteSlug={ context.params.siteSlug }
steps={ [ BookInfoStep, BookCalendarStep, BookConfirmationStep ] }
rescheduling={ false }
/>
);
next();
};
const cancel = ( context, next ) => {
context.primary = (
<ConciergeCancel
analyticsPath="/me/quickstart/:site/:appointment/cancel"
analyticsTitle="Concierge > Cancel"
appointmentId={ context.params.appointmentId }
siteSlug={ context.params.siteSlug }
/>
);
next();
};
const reschedule = ( context, next ) => {
context.primary = (
<ConciergeMain
analyticsPath="/me/quickstart/:site/:appointment/reschedule"
analyticsTitle="Concierge > Reschedule"
appointmentId={ context.params.appointmentId }
skeleton={ RescheduleSkeleton }
siteSlug={ context.params.siteSlug }
steps={ [ RescheduleCalendarStep, RescheduleConfirmationStep ] }
rescheduling
/>
);
next();
};
const siteSelector = ( context, next ) => {
context.store.dispatch( recordTracksEvent( 'calypso_concierge_site_selection_step' ) );
context.getSiteSelectionHeaderText = () =>
i18n.translate( 'Select a site for your {{strong}}Quick Start Session{{/strong}}', {
components: { strong: <strong /> },
} );
next();
};
const redirectToQuickStart = ( context, next ) => {
const newPath = context.path.replace( '/me/concierge', '/me/quickstart' );
page.redirect( newPath );
next();
};
export default {
book,
cancel,
reschedule,
siteSelector,
redirectToQuickStart,
};
|