1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,U as n,W as r,n as i,r as a,t as o}from"./button-BhAQo6Sy.js";import{V as s,n as c,t as l,tt as u}from"./api-Bb85n68L.js";import{t as d}from"./checkbox-BvMiUPpO.js";import{t as f}from"./cloud-upload-C1d9L0C_.js";import{t as p}from"./spinner-B0ROFxgI.js";import{t as m}from"./sparkles-Sg_bA45R.js";import{t as h}from"./type-Df9tHIH_.js";import{c as g}from"./app-Di4tDCA1.js";import{a as _,i as v,n as y,o as b,t as x}from"./frame-Bg0IxU65.js";import{t as S}from"./separator-IZXL6QXg.js";import{t as C}from"./page-header-DHR4N007.js";var w=n(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),T=n(`brick-wall`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 9v6`,key:`199k2o`}],[`path`,{d:`M16 15v6`,key:`8rj2es`}],[`path`,{d:`M16 3v6`,key:`1j6rpj`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 15v6`,key:`1stoo3`}],[`path`,{d:`M8 3v6`,key:`vlvjmk`}]]),E=n(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),D=n(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),O=n(`database-backup`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 12a9 3 0 0 0 5 2.69`,key:`1ui2ym`}],[`path`,{d:`M21 9.3V5`,key:`6k6cib`}],[`path`,{d:`M3 5v14a9 3 0 0 0 6.47 2.88`,key:`i62tjy`}],[`path`,{d:`M12 12v4h4`,key:`1bxaet`}],[`path`,{d:`M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16`,key:`1f4ei9`}]]),k=n(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),A=n(`import`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m8 11 4 4 4-4`,key:`1dohi6`}],[`path`,{d:`M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4`,key:`1ywtjm`}]]),j=n(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),M=n(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),N=e(r(),1),P=a(),F=[{id:`custom-fonts-bricks`,name:`Bricks Custom Fonts`,endpoint:`bricks-custom-fonts`,icon:T,description:wp.i18n.__(`Move locally uploaded Bricks font families into the Jooosi Fon library, then retire the legacy records.`,`jooosi-fon`)},{id:`custom-fonts-brainstorm-force`,name:`Custom Fonts by Brainstorm Force`,endpoint:`brainstorm-force-custom-fonts`,icon:h,description:wp.i18n.__(`Import local and locally hosted Google font variants from the Custom Fonts plugin, including display and fallback settings.`,`jooosi-fon`)},{id:`custom-adobe-fonts`,name:`Custom Adobe Fonts`,endpoint:`custom-adobe-fonts`,icon:D,description:wp.i18n.__(`Move the Brainstorm Force Adobe project and its published families into Jooosi Fon’s native Adobe Fonts connection.`,`jooosi-fon`)},{id:`elementor-pro-custom-fonts`,name:`Elementor Pro Custom Fonts`,endpoint:`elementor-pro-custom-fonts`,icon:j,description:wp.i18n.__(`Import Elementor Pro font families, static variants, variable weight ranges, and supported uploaded files.`,`jooosi-fon`)},{id:`font-hero-dplugins`,name:`Font Hero`,endpoint:`font-hero-dplugins`,icon:m,description:wp.i18n.__(`Bring Font Hero families and files into Jooosi Fon while retaining a deliberate cleanup checkpoint.`,`jooosi-fon`)},{id:`use-any-font`,name:`Use Any Font`,endpoint:`use-any-font`,icon:f,description:wp.i18n.__(`Move uploaded families, weights, styles, stretches, and selector assignments from Use Any Font into Jooosi Fon.`,`jooosi-fon`)},{id:`fonts-plugin`,name:`Fonts Plugin / Google Fonts Typography`,endpoint:`fonts-plugin`,icon:h,description:wp.i18n.__(`Import uploaded Fonts Plugin families and variants, including preload, display, and Customizer selector assignments.`,`jooosi-fon`)}];function I(){return(0,P.jsxs)(`div`,{className:`space-y-6`,children:[(0,P.jsx)(C,{eyebrow:wp.i18n.__(`Data tools`,`jooosi-fon`),title:wp.i18n.__(`Migration studio`,`jooosi-fon`),description:wp.i18n.__(`Move font libraries through a guided import, validation, and cleanup sequence. Every destructive step stays separate and explicit.`,`jooosi-fon`)}),(0,P.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:F.map((e,t)=>(0,P.jsx)(x,{spacing:`sm`,className:`group`,children:(0,P.jsxs)(_,{className:`flex min-h-52 flex-col justify-between gap-6`,children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,P.jsxs)(`span`,{className:`text-xs text-muted-foreground/60`,children:[`0`,t+1]}),(0,P.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border bg-muted/50 shadow-xs`,children:(0,P.jsx)(A,{"aria-hidden":`true`,className:`size-4`})})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`m-0 text-base font-semibold`,children:e.name}),(0,P.jsx)(`p`,{className:`mb-4 mt-1.5 text-sm leading-5 text-muted-foreground`,children:e.description}),(0,P.jsxs)(s,{to:`/migrations/${e.id}`,className:i({variant:`outline`,size:`sm`}),children:[wp.i18n.__(`Open migration`,`jooosi-fon`),(0,P.jsx)(w,{})]})]})]})},e.id))}),(0,P.jsx)(x,{variant:`inverse`,children:(0,P.jsxs)(_,{className:`flex items-start gap-4`,children:[(0,P.jsx)(O,{className:`mt-0.5 shrink-0 text-warning-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`m-0 text-sm font-semibold`,children:wp.i18n.__(`Create a database backup first`,`jooosi-fon`)}),(0,P.jsx)(`p`,{className:`mb-0 mt-1 text-sm leading-6 text-muted-foreground`,children:wp.i18n.__(`Imports add Jooosi Fon records. Cleanup removes records from the source plugin and cannot be reversed from this screen.`,`jooosi-fon`)})]})]})})]})}function L({sourceId:e}){let n=F.find(t=>t.id===e)??F[0],[r,a]=(0,N.useState)(!1),[f,m]=(0,N.useState)(!1),[h,T]=(0,N.useState)(!1),[D,O]=(0,N.useState)(!0),[A,j]=(0,N.useState)(null),[I,L]=(0,N.useState)(null),R=n.icon,z=async e=>{if(!r){u.error(wp.i18n.__(`Confirm that a current database backup exists.`,`jooosi-fon`));return}if(!(e===`cleanup`&&!window.confirm(wp.i18n.__(`Delete the migrated source records now? This cleanup cannot be undone here.`,`jooosi-fon`)))){j(e),L(null);try{let{data:t}=await l.post(`/migrations/${n.endpoint}/${e===`import`?`import-fonts`:`clean-up`}`,e===`cleanup`?{confirm:!0}:void 0);e===`import`?m(!0):T(!0);let r=t?.message||(e===`import`?wp.i18n.__(`Fonts imported. Review the Jooosi Fon library before cleanup.`,`jooosi-fon`):wp.i18n.__(`Source records cleaned up.`,`jooosi-fon`));L(r),u.success(r)}catch(e){let t=c(e);L(t),u.error(t)}finally{j(null)}}};return(0,P.jsxs)(`div`,{className:`space-y-6`,children:[(0,P.jsx)(C,{eyebrow:wp.i18n.__(`Guided migration`,`jooosi-fon`),title:n.name,description:n.description,backTo:`/migrations/index`,actions:(0,P.jsx)(t,{variant:h||f&&D?`success-light`:f?`warning-light`:`secondary`,children:h?wp.i18n.__(`Complete`,`jooosi-fon`):f&&D?wp.i18n.__(`Source preserved`,`jooosi-fon`):f?wp.i18n.__(`Awaiting cleanup`,`jooosi-fon`):wp.i18n.__(`Not started`,`jooosi-fon`)})}),(0,P.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-[minmax(0,1fr)_340px]`,children:[(0,P.jsxs)(x,{children:[(0,P.jsxs)(v,{children:[(0,P.jsx)(b,{children:wp.i18n.__(`Migration runbook`,`jooosi-fon`)}),(0,P.jsx)(y,{children:wp.i18n.__(`Finish each checkpoint in order. Import is non-destructive; cleanup is intentionally separate.`,`jooosi-fon`)})]}),(0,P.jsxs)(_,{className:`p-0`,children:[(0,P.jsxs)(`section`,{className:`flex gap-4 p-5`,children:[(0,P.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-full bg-primary text-sm font-semibold text-primary-foreground`,children:`1`}),(0,P.jsxs)(`div`,{className:`flex-1`,children:[(0,P.jsx)(`h2`,{className:`m-0 text-sm font-semibold`,children:wp.i18n.__(`Confirm recovery`,`jooosi-fon`)}),(0,P.jsx)(`p`,{className:`mb-3 mt-1 text-sm text-muted-foreground`,children:wp.i18n.__(`Take a current database backup and verify that it can be restored.`,`jooosi-fon`)}),(0,P.jsxs)(`label`,{className:`inline-flex items-center gap-2 rounded-lg border bg-muted/30 px-3 py-2 text-sm`,children:[(0,P.jsx)(d,{checked:r,onCheckedChange:a}),wp.i18n.__(`I have a current database backup`,`jooosi-fon`)]})]})]}),(0,P.jsx)(S,{}),(0,P.jsxs)(`section`,{className:`flex gap-4 p-5`,children:[(0,P.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-full bg-primary text-sm font-semibold text-primary-foreground`,children:`2`}),(0,P.jsxs)(`div`,{className:`flex-1`,children:[(0,P.jsx)(`h2`,{className:`m-0 text-sm font-semibold`,children:wp.i18n.__(`Import font records`,`jooosi-fon`)}),(0,P.jsx)(`p`,{className:`mb-3 mt-1 text-sm text-muted-foreground`,children:wp.i18n.__(`Copy supported families into Jooosi Fon without deleting the source data.`,`jooosi-fon`)}),(0,P.jsxs)(o,{onClick:()=>z(`import`),disabled:!r||A!==null||f,children:[A===`import`?(0,P.jsx)(p,{}):f?(0,P.jsx)(E,{}):(0,P.jsx)(g,{}),f?wp.i18n.__(`Imported`,`jooosi-fon`):wp.i18n.__(`Run import`,`jooosi-fon`)]})]})]}),(0,P.jsx)(S,{}),(0,P.jsxs)(`section`,{className:`flex gap-4 p-5`,children:[(0,P.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-full bg-destructive text-sm font-semibold text-white`,children:`3`}),(0,P.jsxs)(`div`,{className:`flex-1`,children:[(0,P.jsx)(`h2`,{className:`m-0 text-sm font-semibold`,children:wp.i18n.__(`Review and choose source retention`,`jooosi-fon`)}),(0,P.jsx)(`p`,{className:`mb-3 mt-1 text-sm text-muted-foreground`,children:wp.i18n.__(`Source records are preserved by default. Disable preservation only after verifying the imported families.`,`jooosi-fon`)}),(0,P.jsxs)(`label`,{className:`mb-3 inline-flex items-center gap-2 rounded-lg border bg-muted/30 px-3 py-2 text-sm`,children:[(0,P.jsx)(d,{checked:D,onCheckedChange:O}),wp.i18n.__(`Keep source records (recommended)`,`jooosi-fon`)]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(s,{to:`/fonts/index`,className:i({variant:`outline`}),children:[wp.i18n.__(`Review font library`,`jooosi-fon`),(0,P.jsx)(w,{})]}),(0,P.jsxs)(o,{variant:`destructive`,onClick:()=>z(`cleanup`),disabled:!f||D||A!==null||h,children:[A===`cleanup`?(0,P.jsx)(p,{}):h?(0,P.jsx)(E,{}):(0,P.jsx)(k,{}),h?wp.i18n.__(`Cleanup complete`,`jooosi-fon`):wp.i18n.__(`Delete source records`,`jooosi-fon`)]})]})]})]})]})]}),(0,P.jsxs)(`div`,{className:`space-y-5`,children:[(0,P.jsx)(x,{variant:`inverse`,children:(0,P.jsxs)(_,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`grid size-10 place-items-center rounded-lg border bg-background`,children:(0,P.jsx)(R,{})}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`m-0 text-sm font-semibold`,children:n.name}),(0,P.jsx)(`p`,{className:`mb-0 mt-1 text-xs text-muted-foreground`,children:wp.i18n.__(`Source adapter detected at runtime`,`jooosi-fon`)})]})]}),(0,P.jsx)(S,{}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-3 text-sm`,children:[(0,P.jsx)(E,{className:r?`text-success`:`text-muted-foreground`}),(0,P.jsx)(`span`,{children:wp.i18n.__(`Backup confirmed`,`jooosi-fon`)}),(0,P.jsx)(E,{className:f?`text-success`:`text-muted-foreground`}),(0,P.jsx)(`span`,{children:wp.i18n.__(`Fonts imported`,`jooosi-fon`)}),(0,P.jsx)(E,{className:h?`text-success`:`text-muted-foreground`}),(0,P.jsx)(`span`,{children:wp.i18n.__(`Source cleaned`,`jooosi-fon`)})]})]})}),(0,P.jsx)(x,{children:(0,P.jsxs)(_,{className:`flex gap-3`,children:[(0,P.jsx)(M,{className:`mt-0.5 shrink-0 text-warning-foreground`}),(0,P.jsx)(`p`,{className:`m-0 text-sm leading-6 text-muted-foreground`,children:wp.i18n.__(`If the source plugin is missing, the API will stop safely and report that no records are available.`,`jooosi-fon`)})]})}),I&&(0,P.jsx)(x,{children:(0,P.jsx)(_,{children:(0,P.jsx)(`p`,{className:`m-0 text-sm leading-6`,role:`status`,children:I})})})]})]})]})}export{L as MigrationRunnerPage,I as MigrationsPage}; |