Viewing File: /usr/local/cpanel/base/frontend/meridian/_assets/meridian-shell/assets/module5.js

import{r as e}from"./rolldown-runtime.js";import{Un as t,b as n,bn as r,v as i,wn as a,x as o}from"./src.js";import{Q as s,St as c,bt as l,xt as u,yt as d}from"./src2.js";import{a as f,i as p,n as m,r as h,t as g}from"./index.js";var _=e(t(),1),v=e(r(),1),y=2e3,b={progress:0,steps:[],status:`installing`,error:null,message:``,existingInstallations:[],isRemoving:!1,taskId:null};function x(e){return[{min:0,titles:[e]}]}function S(e){return e}function C({domain:e,state:t,startedAtMs:n,phases:r,onRetry:i,onReplace:a,onSkipToDashboard:o,t:s}){let{displayProgress:c,rotatingMessage:l}=f({state:t,phases:r,startedAtMs:n});return(0,v.jsx)(g,{domain:e,state:t,displayProgress:c,rotatingMessage:l,onRetry:i,onReplace:a,onSkipToDashboard:o,t:s,hideDefaultDoneState:!0})}function w({bridge:e,domain:t,onComplete:n,onSkipToDashboard:r,t:i,phases:a}){let o=p(e,t),[f,m]=(0,_.useState)(null);(0,_.useLayoutEffect)(()=>(e.setActiveJob(t),()=>{e.setActiveJob(null)}),[e,t]),(0,_.useEffect)(()=>{m(e.startInstall(t))},[e,t]);let h=o?.state??b,g=(0,_.useRef)(!1),x=(0,_.useRef)(null),S=(0,_.useRef)(o);S.current=o,(0,_.useEffect)(()=>{if(g.current||o?.phase!==`success`||!o.completion)return;g.current=!0;let{completion:r}=o;x.current=setTimeout(()=>{e.dismissJob(t),n(r)},y)},[o,e,t,n]),(0,_.useEffect)(()=>()=>{x.current&&clearTimeout(x.current),S.current?.phase===`success`&&e.dismissJob(t)},[e,t]);let w=(0,_.useCallback)(()=>{m(e.retryInstall(t))},[e,t]),T=(0,_.useCallback)(()=>{e.replaceExisting(t)},[e,t]);return f===`at-capacity`?(0,v.jsx)(s,{"data-testid":`step-wp-install-at-capacity`,align:`center`,justify:`center`,height:`full`,paddingY:`xl`,children:(0,v.jsxs)(s,{gap:`lg`,width:`full`,maxWidth:`md`,children:[(0,v.jsxs)(d,{intent:`warning`,children:[(0,v.jsx)(u,{children:i(`wpInstall.atCapacityTitle`)}),(0,v.jsx)(l,{children:i(`wpInstall.atCapacity`,{count:3})})]}),(0,v.jsx)(c,{variant:`outline`,onClick:r,children:i(`wpInstall.close`)})]})}):(0,v.jsx)(C,{domain:t,state:h,startedAtMs:o?.startedAtMs,phases:a,onRetry:w,onReplace:T,onSkipToDashboard:r,t:i},o?.startedAtMs??0)}function T({state:e,setState:t,advance:n,closeModal:r}){let{t:i}=a(`features`),o=e.__wizardContext,s=o?.wpTranslate??S,c=o?.wpTranslateCommon??S,l=o?.wpPhases??x(i(`wpInstall.starting`)),u=o?.wpInstallJobs,d=(0,_.useCallback)(e=>{t(t=>({...t,wpAdminUrl:e.adminUrl,wpInstallationId:e.installationId,wpCredentials:e.credentials,wpCredentialsStatus:e.credentialsStatus})),n()},[t,n]);return u?(0,v.jsx)(w,{bridge:u,domain:e.domain,onComplete:d,onSkipToDashboard:r,t:s,phases:l}):(0,v.jsx)(m,{domain:e.domain,onComplete:d,onSkipToDashboard:r,t:s,tCommon:c,phases:l,hideDefaultDoneState:!0})}function E(e){return e}function D({state:e,closeModal:t}){let n=e.__wizardContext,r=n?.wpTranslate??E,i=e.wpCredentials,a=e.wpCredentialsStatus;return(0,v.jsx)(h,{domain:e.domain,adminUrl:e.wpAdminUrl,wpInstallationId:e.wpInstallationId,wpCredentials:i,credentialsStatus:a,onOpenWordPress:n?.onOpenWordPress,onClose:t,t:r})}var O={ok:!1,code:`aborted`,error:`Open was cancelled`},k={async fetchDomainRecords(e){let t=await n.listInstallations(e),r=new Set,i=[];for(let e of t??[])r.has(e.domain)||(r.add(e.domain),i.push({domain:e.domain,isLive:!0,hasDraft:!1}));return i},changedEvent:`wordpress:changed`,launch:{kind:`in-place-install`,steps:{"wp-install":T,"wp-success":D},async openInstalled({domain:e,installedId:t,signal:r}){let a=`https://${e}/wp-admin/`;if(t===void 0)return window.open(a,`_blank`,`noopener,noreferrer`),{ok:!0};let s=i(e);try{let e=await n.getCredentials(t,void 0,s);return r?.aborted?O:(window.location.href=e.loginUrl&&o(e.loginUrl)?e.loginUrl:a,{ok:!0})}catch{return r?.aborted?O:(window.location.href=a,{ok:!0})}}}};export{k as wordpressRuntime};
;!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="608d7ccd-1a79-4b74-a880-ba5064708695",e._sentryDebugIdIdentifier="sentry-dbid-608d7ccd-1a79-4b74-a880-ba5064708695")}catch(e){}}();
//# debugId=608d7ccd-1a79-4b74-a880-ba5064708695
Back to Directory