"use strict";(self.webpackChunknewfold_Onboarding=self.webpackChunknewfold_Onboarding||[]).push([[218],{90:(e,t,n)=>{n.d(t,{A:()=>c});var i=n(1609),a=n(6942),r=n.n(a),s=n(8468),o=n(8969),d=n(9269);const c=({title:e,subtitle:t})=>{const n=(0,s.useContext)(d.D),a=n?.theme||!1;return(0,i.createElement)("div",{className:"nfd-onboarding-step__heading"},(0,i.createElement)("h2",{className:"nfd-onboarding-step__heading__title"},e),t&&(0,i.createElement)("div",{className:"nfd-onboarding-step__heading__subtitle"},t,(0,i.createElement)("div",{className:r()("nfd-onboarding-step__heading__icon",a===o.Vw?"nfd-onboarding-step__heading__icon--light":null)})))}},1218:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var i=n(1609),a=n(8468),r=n(7143),s=n(7723);var o=n(7708),d=n(3988),c=n(90),l=n(1032),g=n(9034),_=n(3731),m=n(67),u=n(2940),p=n(7675),f=n(8969),w=n(1056),b=n(8744),E=n(2202);const h=()=>{const{setIsHeaderEnabled:e,setSidebarActiveView:t,setHeaderActiveView:n,setDrawerActiveView:h,setIsHeaderNavigationEnabled:v,setFooterActiveView:S,setHideFooterNav:N,updateSiteGenErrorStatus:y,updateAllSteps:A,setInstaWpMigrationUrl:M}=(0,r.useDispatch)(p.M),{siteGenErrorStatus:x,allSteps:C,canMigrateSite:O,currentBrandName:V}=(0,r.useSelect)((e=>({siteGenErrorStatus:e(p.M).getSiteGenErrorStatus(),allSteps:e(p.M).getAllSteps(),canMigrateSite:e(p.M).canMigrateSite(),currentBrandName:e(p.M).getNewfoldBrandName()})));(0,a.useEffect)((()=>{const i=C.filter((e=>e===_.O));if(0===i?.length){let e;e=window.nfdOnboarding.currentFlow===b.d0?(0,u.gK)(C,g.O):(0,u.gK)(C,m.H),A(e.allSteps)}N(!0),e(!1),t(!1),v(!1),n(f.Ix),h(!1),S(f.Sr)}),[]),(0,a.useEffect)((()=>{!1===x&&(async()=>{try{if(O){const e=await(0,o.OD)(),t=e?.body?.data?.redirect_url;t?(M(t),setTimeout((()=>{window.open(t,"_self")}),3e3)):((0,w.v)(new w.iC(E.cW,"migration",{source:b.d0})),y(!0))}else(0,w.v)(new w.iC(E.cW,"migration",{source:b.d0})),y(!0)}catch(e){console.error("Failed to fetch migration URL:",e),(0,w.v)(new w.iC(E.cW,"migration",{source:b.d0})),y(!0)}})()}),[x]);const H=(e=>({heading:(0,s.sprintf)(/* translators: %s: to replace Brand name */ /* translators: %s: to replace Brand name */
(0,s.__)("Let's migrate your existing site to %s","wp-module-onboarding"),e),description:(0,s.__)("Please wait a few seconds while we get your new account ready to import your existing WordPress site. ","wp-module-onboarding"),importText:(0,s.__)("Preparing your account","wp-module-onboarding")}))(V);return(0,i.createElement)(l.tR,null,(0,i.createElement)(d.A,{isVerticallyCentered:!0,className:"nfd-onboarding-step--site-gen__migration"},(0,i.createElement)(c.A,{title:H.heading}),(0,i.createElement)("div",{className:"nfd-onboarding-step--site-gen__migration--container"},(0,i.createElement)("div",{className:"nfd-onboarding-step--site-gen__migration--container__loader"}),(0,i.createElement)("p",{className:"nfd-onboarding-step--site-gen__migration--container__importtext"},H?.importText)),(0,i.createElement)("p",{className:"nfd-onboarding-step--site-gen__migration__description"},H?.description)))}}}]);