View file File name : 366.js Content :"use strict";(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[366],{9964:(e,t,a)=>{a.d(t,{A:()=>l});var s=a(1609),i=a(6942),n=a.n(i);const l=({className:e="",size:t,colGap:a=0,children:i})=>(0,s.createElement)("div",{className:n()("nfd-onboarding-grid",e),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,gridColumnGap:`${a}px`}},i)},5366:(e,t,a)=>{a.r(t),a.d(t,{default:()=>v});var s=a(1609),i=a(7143),n=a(8468),l=a(148),r=a(7675),c=a(3988),o=a(4639),d=a(8520),u=a(8969),g=a(1032),m=a(7044),h=a(8616),p=a(7723);var b=a(9964);const v=()=>{const e=(0,l.zy)(),[t,a]=(0,n.useState)(),[v,_]=(0,n.useState)([]),{currentStep:f,currentData:w,themeStatus:E,themeVariations:S}=(0,i.useSelect)((t=>({currentStep:t(r.M).getStepFromPath(e.pathname),currentData:t(r.M).getCurrentOnboardingData(),themeStatus:t(r.M).getThemeStatus(),themeVariations:t(r.M).getStepPreviewData()})),[]),{setDrawerActiveView:y,setSidebarActiveView:k,updateThemeStatus:C,setCurrentOnboardingData:A}=(0,i.useDispatch)(r.M);(0,n.useEffect)((()=>{k(u.Qe),y(u.VG)}),[]);const D=(e,t=!1)=>{_(e),w.data.sitePages.other=0!==e.length&&((e,t)=>!1!==t?t?.reduce(((t,a)=>e.includes(a.slug)?t.concat({slug:a.slug,title:a.title}):t),[]):void 0)(e,t),A(w)},P=(e,a)=>{!0!==e||v.includes(a)?!1===e&&D(v.filter((e=>e!==a)),t):D(v.concat(a),t)};(0,n.useEffect)((()=>{E===u.Er&&(async()=>{const e=await(0,d.O)(f?.data?.patternId);if(e?.error)return C(u.So);if(e?.body){if(w.data.sitePages?.other)if(!1===w.data.sitePages.other)_([]);else if(0!==w.data.sitePages.other.length)_(w.data.sitePages.other.map((e=>e.slug)));else{const t=e.body.reduce(((e,t)=>t?.selected?e.concat(t.slug):e),[]);D(t,e.body)}a(e.body)}})()}),[E]);const N={heading:(0,p.__)("You have ideas, we have page templates","wp-module-onboarding"),subheading:(0,p.__)("Begin closer to the finish line than a blank canvas.","wp-module-onboarding")};return(0,s.createElement)(g.UX,null,(0,s.createElement)(m.Th,null,(0,s.createElement)(c.A,null,(0,s.createElement)("div",{className:"site-pages"},(0,s.createElement)(o.A,{title:N.heading,subtitle:N.subheading}),(0,s.createElement)("div",{className:"site-pages__list"},(0,s.createElement)(b.A,{size:2},(0,s.createElement)(h.A,{className:"site-pages__list__item",count:S[f?.data?.patternId]?.previewCount,watch:t,isWithCard:!0,callback:()=>v&&t?.map(((e,t)=>(0,s.createElement)(m.z_,{key:t,className:"site-pages__list__item",blockGrammer:e.content,viewportWidth:1200,styling:"custom",overlay:!0,title:e?.title,slug:e.slug,selected:v.includes(e.slug),onClick:P,description:e?.description}))),viewportWidth:1200})))))))}}}]);