PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/AutoLaunch/hooks/useCreateSite.js +22 -23 3.1.6 → trunk View file →
@@ -41,8 +41,9 @@
41 41 alreadyActive,
42 42 ensurePluginsActive,
43 43 getActivePlugins,
44 44 replacePlaceholderPatterns,
45 + reportFailedDependencies,
45 46 reportInactivePlugins,
46 47 } from '@auto-launch/functions/plugins';
47 48 import {
48 49 postLaunchFunctions,
@@ -63,8 +64,9 @@
63 64 updateOption,
64 65 } from '@auto-launch/functions/wp';
65 66 import { useWarnOnLeave } from '@auto-launch/hooks/useWarnOnLeave';
66 67 import { useLaunchDataStore } from '@auto-launch/state/launch-data';
68 +import { launchStrings } from '@auto-launch/strings';
67 69 import { digest } from '@shared/api/digest';
68 70 import { siteImageUrls } from '@shared/lib/site-images';
69 71 import { useAIConsentStore } from '@shared/state/ai-consent';
70 72 import { useEffect, useRef, useState } from '@wordpress/element';
@@ -149,9 +151,9 @@
149 151 if (!data.sitePlugins?.length) return;
150 152
151 153 setStatus(
152 154 // translators: this is for a action log UI. Keep it short
153 - __('Setting up functionality for your website', 'extendify-local'),
155 + launchStrings().statusFunctionality,
154 156 );
155 157 ensurePluginsActive(
156 158 data.sitePlugins.map(({ wordpressSlug }) => wordpressSlug),
157 159 );
@@ -265,9 +267,9 @@
265 267 checkIn({ stage: 'set_general', siteProfile, sitePlugins, siteStyle });
266 268
267 269 const { title } = siteProfile;
268 270 // translators: this is for a action log UI. Keep it short
269 - addStatusMessage(__('Adding admin configurations', 'extendify-local'));
271 + addStatusMessage(launchStrings().statusAdmin);
270 272 await updateOption('permalink_structure', '/%postname%/');
271 273 setUserGaveConsent(true);
272 274 if (title) await updateOption('blogname', title);
273 275 },
@@ -340,9 +342,9 @@
340 342 let variation = siteStyle?.variation;
341 343 if (customFonts?.length) {
342 344 checkIn({ stage: 'install_fonts' });
343 345 // translators: this is for a action log UI. Keep it short
344 - addStatusMessage(__('Installing fonts locally', 'extendify-local'));
346 + addStatusMessage(launchStrings().statusFonts);
345 347 const installed = await installFontFamilies(customFonts).catch(
346 348 () => [],
347 349 );
348 350 variation = mergeFontsIntoVariation(siteStyle.variation, installed);
@@ -349,9 +351,9 @@
349 351 }
350 352
351 353 if (siteStyle?.vibe && siteStyle.vibe !== 'natural-1') {
352 354 // translators: vibe in this context is a noun - the feeling of their site design.
353 - addStatusMessage(__('Setting the website style', 'extendify-local'));
355 + addStatusMessage(launchStrings().statusSiteStyle);
354 356 checkIn({ stage: 'compute_vibe' });
355 357 const vibe = await computeVibeAdjustments(
356 358 siteStyle.vibe,
357 359 variation,
@@ -362,9 +364,9 @@
362 364 checkIn({ stage: 'set_vibe' });
363 365 await updateVariation(variation);
364 366
365 367 // navigation menu
366 - addStatusMessage(__('Working on the navigation', 'extendify-local'));
368 + addStatusMessage(launchStrings().statusNavigation);
367 369 const { id: headerNavId } = await createNavigation({
368 370 title: __('Header Navigation', 'extendify-local'),
369 371 slug: 'site-navigation',
370 372 });
@@ -374,9 +376,9 @@
374 376 headerCode = injectNavExtras(headerCode, launchDecisions);
375 377 // remove the header navigation from the landing page
376 378 if (objective === 'landing-page') {
377 379 // translators: this is for a action log UI. Keep it short
378 - addStatusMessage(__('Perfecting a landing page', 'extendify-local'));
380 + addStatusMessage(launchStrings().statusLanding);
379 381 const social =
380 382 /<!--\s*wp:social-links\b[^>]*>.*?<!--\s*\/wp:social-links\s*-->/gis;
381 383 headerCode = headerCode
382 384 .replace(/<!--\s*wp:navigation\b[^>]*.*\/-->/gis, '')
@@ -414,9 +416,9 @@
414 416 await updateTemplatePart('extendable/footer', footerCode);
415 417
416 418 // pages
417 419 // translators: this is for a action log UI. Keep it short
418 - addStatusMessage(__('Creating pages', 'extendify-local'));
420 + addStatusMessage(launchStrings().statusCreatingPages);
419 421 const pagesToCreate = getPagesToCreate(data);
420 422 const titlePattern = pages?.[0]?.patterns?.find((p) =>
421 423 p.patternTypes?.includes('page-title'),
422 424 );
@@ -458,9 +460,15 @@
458 460 p.patternTypes?.includes('hero-header'),
459 461 );
460 462 const pMatch = heroPattern?.code?.match(/<p[^>]*>([\s\S]*?)<\/p>/);
461 463 const heroDesc = pMatch?.[1]?.replace(/<[^>]+>/g, '').trim();
462 - setData('heroDescription', heroDesc || data.heroDescription);
464 + const heroDescription = heroDesc || data.heroDescription;
465 + setData('heroDescription', heroDescription);
466 + if (heroDescription) {
467 + await updateOption('extendify_hero_description', heroDescription).catch(
468 + () => null,
469 + );
470 + }
463 471
464 472 const createdPagesWP = await createWpPages(customPages, {
465 473 skipSectionIds: isSinglePageDesign,
466 474 });
@@ -470,9 +478,9 @@
470 478 );
471 479 if (siteProfile.blog || blogPattern) {
472 480 checkIn({ stage: 'create_blog_sample_data' });
473 481 // translators: this is for a action log UI. Keep it short
474 - addStatusMessage(__('Creating blog sample data', 'extendify-local'));
482 + addStatusMessage(launchStrings().statusBlog);
475 483 await createBlogSampleData(
476 484 { aiBlogTitles },
477 485 imageUrls,
478 486 blogPattern?.blogImages,
@@ -493,9 +501,9 @@
493 501 if (alreadyActive(activePlugins, 'woocommerce')) {
494 502 checkIn({ stage: 'import_woocommerce_products' });
495 503 addStatusMessage(
496 504 // translators: this is for a action log UI. Keep it short
497 - __('Setting up your online store', 'extendify-local'),
505 + launchStrings().statusStore,
498 506 );
499 507 await apiFetchWithTimeout({
500 508 path: '/extendify/v1/auto-launch/import-woocommerce',
501 509 }).catch(() => null);
@@ -601,11 +609,12 @@
601 609 if (imageUrls.length) {
602 610 await storeSiteImages(siteImages).catch(() => null);
603 611 }
604 612 // translators: this is for a action log UI. Keep it short
605 - addStatusMessage(__('All done!', 'extendify-local'));
613 + addStatusMessage(launchStrings().statusDone);
606 614 await Promise.all([
607 615 reportInactivePlugins(intendedPlugins).catch(() => null),
616 + reportFailedDependencies(pagesReplaced),
608 617 checkIn({ stage: 'finished', siteProfile, sitePlugins, siteStyle }),
609 618 ]);
610 619 setWarnOnReload(false);
611 620 setDone(true);
@@ -617,14 +626,9 @@
617 626 });
618 627 // if we error here we can try again by resetting the home stretch and stalling again to refetch data
619 628 homeStretch.current = false;
620 629 needToStall(true);
621 - setErrorMessage(
622 - __(
623 - 'Something went wrong during the final steps. We will try again but you may need to refresh the page.',
624 - 'extendify-local',
625 - ),
626 - );
630 + setErrorMessage(launchStrings().errorFinalSteps);
627 631 });
628 632 }, [data, needToStall, setUserGaveConsent]);
629 633
630 634 return { done };
@@ -648,12 +652,7 @@
648 652 useEffect(() => {
649 653 if (!error || needToStall()) return;
650 654 console.error(error);
651 655 digest({ error, details: { source: 'auto-launch', caller: 'run-step' } });
652 - setErrorMessage(
653 - __(
654 - 'Having some trouble with this step. Trying again...',
655 - 'extendify-local',
656 - ),
657 - );
656 + setErrorMessage(launchStrings().errorStep);
658 657 }, [error, setErrorMessage, needToStall]);
659 658 };