|
2 | 2 | import { useEffect, useState } from '@wordpress/element';
|
3 | 3 | import { useViewportMatch } from '@wordpress/compose';
|
4 | 4 | import { useDispatch, useSelect } from '@wordpress/data';
|
| 5 | +import apiFetch from '@wordpress/api-fetch'; |
5 | 6 |
|
6 | 7 | // Third part
|
7 | 8 | import classNames from 'classnames';
|
@@ -52,6 +53,7 @@ import {
|
52 | 53 | sendOnboardingEvent,
|
53 | 54 | } from '../../../utils/analytics/hiive';
|
54 | 55 | import { injectInAllSteps } from '../../../data/flows/utils';
|
| 56 | +import { migrateRestURL } from '../../../utils/api/common'; |
55 | 57 | import {
|
56 | 58 | ACTION_ONBOARDING_CHAPTER_COMPLETE,
|
57 | 59 | ACTION_ONBOARDING_CHAPTER_STARTED,
|
@@ -389,16 +391,21 @@ const SiteBuild = () => {
|
389 | 391 | const trackInstaWpMigrationEvent = () => {
|
390 | 392 | if ( currentStep?.path === stepSiteGenMigration?.path ) {
|
391 | 393 | if ( instaWpMigrationUrl ) {
|
392 |
| - getWPSettings().then( ( res ) => |
393 |
| - sendOnboardingEvent( |
394 |
| - new OnboardingEvent( |
395 |
| - res.nfd_migrate_site |
| 394 | + getWPSettings().then( ( res ) => { |
| 395 | + apiFetch( { |
| 396 | + url: migrateRestURL( 'migrate/events' ), |
| 397 | + method: 'POST', |
| 398 | + data: { |
| 399 | + key: res.nfd_migrate_site |
396 | 400 | ? ACTION_MFE_MIGRATION_INITIATED
|
397 | 401 | : ACTION_MIGRATION_INITIATED,
|
398 |
| - instaWpMigrationUrl |
399 |
| - ) |
400 |
| - ) |
401 |
| - ); |
| 402 | + data: { |
| 403 | + path: instaWpMigrationUrl, |
| 404 | + page: window.location.href, |
| 405 | + }, |
| 406 | + }, |
| 407 | + } ); |
| 408 | + } ); |
402 | 409 | }
|
403 | 410 | }
|
404 | 411 | };
|
|
0 commit comments