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 +26 -31 3.1.5 → 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,
@@ -53,9 +54,9 @@
53 54 setThemeRenderingMode,
54 55 updateTemplatePart,
55 56 updateVariation,
56 57 } from '@auto-launch/functions/theme';
57 -import { computeVibeAdjustedBlocks } from '@auto-launch/functions/vibes';
58 +import { computeVibeAdjustments } from '@auto-launch/functions/vibes';
58 59 import {
59 60 createBlogSampleData,
60 61 getOption,
61 62 getPageById,
@@ -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,19 +351,15 @@
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 - const vibeBlocks = await computeVibeAdjustedBlocks(
357 + const vibe = await computeVibeAdjustments(
356 358 siteStyle.vibe,
359 + variation,
357 360 ).catch(() => null);
358 - if (vibeBlocks) {
359 - variation = {
360 - ...variation,
361 - styles: { ...variation.styles, blocks: vibeBlocks },
362 - };
363 - }
361 + if (vibe) variation = { ...variation, ...vibe };
364 362 }
365 363
366 364 checkIn({ stage: 'set_vibe' });
367 365 await updateVariation(variation);
@@ -366,9 +364,9 @@
366 364 checkIn({ stage: 'set_vibe' });
367 365 await updateVariation(variation);
368 366
369 367 // navigation menu
370 - addStatusMessage(__('Working on the navigation', 'extendify-local'));
368 + addStatusMessage(launchStrings().statusNavigation);
371 369 const { id: headerNavId } = await createNavigation({
372 370 title: __('Header Navigation', 'extendify-local'),
373 371 slug: 'site-navigation',
374 372 });
@@ -378,9 +376,9 @@
378 376 headerCode = injectNavExtras(headerCode, launchDecisions);
379 377 // remove the header navigation from the landing page
380 378 if (objective === 'landing-page') {
381 379 // translators: this is for a action log UI. Keep it short
382 - addStatusMessage(__('Perfecting a landing page', 'extendify-local'));
380 + addStatusMessage(launchStrings().statusLanding);
383 381 const social =
384 382 /<!--\s*wp:social-links\b[^>]*>.*?<!--\s*\/wp:social-links\s*-->/gis;
385 383 headerCode = headerCode
386 384 .replace(/<!--\s*wp:navigation\b[^>]*.*\/-->/gis, '')
@@ -418,9 +416,9 @@
418 416 await updateTemplatePart('extendable/footer', footerCode);
419 417
420 418 // pages
421 419 // translators: this is for a action log UI. Keep it short
422 - addStatusMessage(__('Creating pages', 'extendify-local'));
420 + addStatusMessage(launchStrings().statusCreatingPages);
423 421 const pagesToCreate = getPagesToCreate(data);
424 422 const titlePattern = pages?.[0]?.patterns?.find((p) =>
425 423 p.patternTypes?.includes('page-title'),
426 424 );
@@ -462,9 +460,15 @@
462 460 p.patternTypes?.includes('hero-header'),
463 461 );
464 462 const pMatch = heroPattern?.code?.match(/<p[^>]*>([\s\S]*?)<\/p>/);
465 463 const heroDesc = pMatch?.[1]?.replace(/<[^>]+>/g, '').trim();
466 - 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 + }
467 471
468 472 const createdPagesWP = await createWpPages(customPages, {
469 473 skipSectionIds: isSinglePageDesign,
470 474 });
@@ -474,9 +478,9 @@
474 478 );
475 479 if (siteProfile.blog || blogPattern) {
476 480 checkIn({ stage: 'create_blog_sample_data' });
477 481 // translators: this is for a action log UI. Keep it short
478 - addStatusMessage(__('Creating blog sample data', 'extendify-local'));
482 + addStatusMessage(launchStrings().statusBlog);
479 483 await createBlogSampleData(
480 484 { aiBlogTitles },
481 485 imageUrls,
482 486 blogPattern?.blogImages,
@@ -497,9 +501,9 @@
497 501 if (alreadyActive(activePlugins, 'woocommerce')) {
498 502 checkIn({ stage: 'import_woocommerce_products' });
499 503 addStatusMessage(
500 504 // translators: this is for a action log UI. Keep it short
501 - __('Setting up your online store', 'extendify-local'),
505 + launchStrings().statusStore,
502 506 );
503 507 await apiFetchWithTimeout({
504 508 path: '/extendify/v1/auto-launch/import-woocommerce',
505 509 }).catch(() => null);
@@ -605,11 +609,12 @@
605 609 if (imageUrls.length) {
606 610 await storeSiteImages(siteImages).catch(() => null);
607 611 }
608 612 // translators: this is for a action log UI. Keep it short
609 - addStatusMessage(__('All done!', 'extendify-local'));
613 + addStatusMessage(launchStrings().statusDone);
610 614 await Promise.all([
611 615 reportInactivePlugins(intendedPlugins).catch(() => null),
616 + reportFailedDependencies(pagesReplaced),
612 617 checkIn({ stage: 'finished', siteProfile, sitePlugins, siteStyle }),
613 618 ]);
614 619 setWarnOnReload(false);
615 620 setDone(true);
@@ -621,14 +626,9 @@
621 626 });
622 627 // if we error here we can try again by resetting the home stretch and stalling again to refetch data
623 628 homeStretch.current = false;
624 629 needToStall(true);
625 - setErrorMessage(
626 - __(
627 - 'Something went wrong during the final steps. We will try again but you may need to refresh the page.',
628 - 'extendify-local',
629 - ),
630 - );
630 + setErrorMessage(launchStrings().errorFinalSteps);
631 631 });
632 632 }, [data, needToStall, setUserGaveConsent]);
633 633
634 634 return { done };
@@ -652,12 +652,7 @@
652 652 useEffect(() => {
653 653 if (!error || needToStall()) return;
654 654 console.error(error);
655 655 digest({ error, details: { source: 'auto-launch', caller: 'run-step' } });
656 - setErrorMessage(
657 - __(
658 - 'Having some trouble with this step. Trying again...',
659 - 'extendify-local',
660 - ),
661 - );
656 + setErrorMessage(launchStrings().errorStep);
662 657 }, [error, setErrorMessage, needToStall]);
663 658 };