PluginProbe
Extendify / 3.2.2
Extendify v3.2.2
3.2.2 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 All 128 releases
← All changes | src/AutoLaunch/hooks/useCreateSite.js +38 -36 3.1.4 → 3.2.2 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,9 +64,11 @@
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';
70 +import { siteImageUrls } from '@shared/lib/site-images';
68 71 import { useAIConsentStore } from '@shared/state/ai-consent';
69 72 import { useEffect, useRef, useState } from '@wordpress/element';
70 73 import { __ } from '@wordpress/i18n';
71 74 import useSWRImmutable from 'swr/immutable';
@@ -148,9 +151,9 @@
148 151 if (!data.sitePlugins?.length) return;
149 152
150 153 setStatus(
151 154 // translators: this is for a action log UI. Keep it short
152 - __('Setting up functionality for your website', 'extendify-local'),
155 + launchStrings().statusFunctionality,
153 156 );
154 157 ensurePluginsActive(
155 158 data.sitePlugins.map(({ wordpressSlug }) => wordpressSlug),
156 159 );
@@ -264,9 +267,9 @@
264 267 checkIn({ stage: 'set_general', siteProfile, sitePlugins, siteStyle });
265 268
266 269 const { title } = siteProfile;
267 270 // translators: this is for a action log UI. Keep it short
268 - addStatusMessage(__('Adding admin configurations', 'extendify-local'));
271 + addStatusMessage(launchStrings().statusAdmin);
269 272 await updateOption('permalink_structure', '/%postname%/');
270 273 setUserGaveConsent(true);
271 274 if (title) await updateOption('blogname', title);
272 275 },
@@ -321,8 +324,9 @@
321 324 const isSinglePageDesign =
322 325 structure === 'single-page' &&
323 326 Boolean(builtHome?.fullPage && builtHome.patterns?.length) &&
324 327 Boolean(designBuild?.pages?.length);
328 + const imageUrls = siteImageUrls(siteImages);
325 329 const intendedPlugins = (sitePlugins ?? []).map(
326 330 ({ wordpressSlug }) => wordpressSlug,
327 331 );
328 332
@@ -338,9 +342,9 @@
338 342 let variation = siteStyle?.variation;
339 343 if (customFonts?.length) {
340 344 checkIn({ stage: 'install_fonts' });
341 345 // translators: this is for a action log UI. Keep it short
342 - addStatusMessage(__('Installing fonts locally', 'extendify-local'));
346 + addStatusMessage(launchStrings().statusFonts);
343 347 const installed = await installFontFamilies(customFonts).catch(
344 348 () => [],
345 349 );
346 350 variation = mergeFontsIntoVariation(siteStyle.variation, installed);
@@ -347,19 +351,15 @@
347 351 }
348 352
349 353 if (siteStyle?.vibe && siteStyle.vibe !== 'natural-1') {
350 354 // translators: vibe in this context is a noun - the feeling of their site design.
351 - addStatusMessage(__('Setting the website style', 'extendify-local'));
355 + addStatusMessage(launchStrings().statusSiteStyle);
352 356 checkIn({ stage: 'compute_vibe' });
353 - const vibeBlocks = await computeVibeAdjustedBlocks(
357 + const vibe = await computeVibeAdjustments(
354 358 siteStyle.vibe,
359 + variation,
355 360 ).catch(() => null);
356 - if (vibeBlocks) {
357 - variation = {
358 - ...variation,
359 - styles: { ...variation.styles, blocks: vibeBlocks },
360 - };
361 - }
361 + if (vibe) variation = { ...variation, ...vibe };
362 362 }
363 363
364 364 checkIn({ stage: 'set_vibe' });
365 365 await updateVariation(variation);
@@ -364,9 +364,9 @@
364 364 checkIn({ stage: 'set_vibe' });
365 365 await updateVariation(variation);
366 366
367 367 // navigation menu
368 - addStatusMessage(__('Working on the navigation', 'extendify-local'));
368 + addStatusMessage(launchStrings().statusNavigation);
369 369 const { id: headerNavId } = await createNavigation({
370 370 title: __('Header Navigation', 'extendify-local'),
371 371 slug: 'site-navigation',
372 372 });
@@ -376,9 +376,9 @@
376 376 headerCode = injectNavExtras(headerCode, launchDecisions);
377 377 // remove the header navigation from the landing page
378 378 if (objective === 'landing-page') {
379 379 // translators: this is for a action log UI. Keep it short
380 - addStatusMessage(__('Perfecting a landing page', 'extendify-local'));
380 + addStatusMessage(launchStrings().statusLanding);
381 381 const social =
382 382 /<!--\s*wp:social-links\b[^>]*>.*?<!--\s*\/wp:social-links\s*-->/gis;
383 383 headerCode = headerCode
384 384 .replace(/<!--\s*wp:navigation\b[^>]*.*\/-->/gis, '')
@@ -416,9 +416,9 @@
416 416 await updateTemplatePart('extendable/footer', footerCode);
417 417
418 418 // pages
419 419 // translators: this is for a action log UI. Keep it short
420 - addStatusMessage(__('Creating pages', 'extendify-local'));
420 + addStatusMessage(launchStrings().statusCreatingPages);
421 421 const pagesToCreate = getPagesToCreate(data);
422 422 const titlePattern = pages?.[0]?.patterns?.find((p) =>
423 423 p.patternTypes?.includes('page-title'),
424 424 );
@@ -460,9 +460,15 @@
460 460 p.patternTypes?.includes('hero-header'),
461 461 );
462 462 const pMatch = heroPattern?.code?.match(/<p[^>]*>([\s\S]*?)<\/p>/);
463 463 const heroDesc = pMatch?.[1]?.replace(/<[^>]+>/g, '').trim();
464 - 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 + }
465 471
466 472 const createdPagesWP = await createWpPages(customPages, {
467 473 skipSectionIds: isSinglePageDesign,
468 474 });
@@ -472,18 +478,18 @@
472 478 );
473 479 if (siteProfile.blog || blogPattern) {
474 480 checkIn({ stage: 'create_blog_sample_data' });
475 481 // translators: this is for a action log UI. Keep it short
476 - addStatusMessage(__('Creating blog sample data', 'extendify-local'));
482 + addStatusMessage(launchStrings().statusBlog);
477 483 await createBlogSampleData(
478 484 { aiBlogTitles },
479 - siteImages,
485 + imageUrls,
480 486 blogPattern?.blogImages,
481 487 );
482 488 }
483 - if (siteImages?.length) {
489 + if (imageUrls.length) {
484 490 checkIn({ stage: 'set_hello_world_image' });
485 - await setHelloWorldFeaturedImage(siteImages);
491 + await setHelloWorldFeaturedImage(imageUrls);
486 492 }
487 493
488 494 let imprint = {};
489 495 if (needsImprint) {
@@ -495,9 +501,9 @@
495 501 if (alreadyActive(activePlugins, 'woocommerce')) {
496 502 checkIn({ stage: 'import_woocommerce_products' });
497 503 addStatusMessage(
498 504 // translators: this is for a action log UI. Keep it short
499 - __('Setting up your online store', 'extendify-local'),
505 + launchStrings().statusStore,
500 506 );
501 507 await apiFetchWithTimeout({
502 508 path: '/extendify/v1/auto-launch/import-woocommerce',
503 509 }).catch(() => null);
@@ -554,9 +560,14 @@
554 560
555 561 checkIn({ stage: 'set_navigation_links' });
556 562 if (objective !== 'landing-page') {
557 563 const orderedSlugs = designBuild?.pages?.map((p) => p.slug) ?? [];
558 - if (isSinglePageDesign) {
564 + // The tag only exists where the sections came back matched 1:1 to our list;
565 + // read it off what was planted, so menu and section ids can't disagree.
566 + const designOwnsNav =
567 + isSinglePageDesign ||
568 + Boolean(homePage?.patterns?.some(({ navSlug }) => navSlug));
569 + if (designOwnsNav) {
559 570 await addSectionLinksFromDesign(
560 571 headerNavId,
561 572 designBuild.pages,
562 573 pluginPages,
@@ -594,15 +605,16 @@
594 605 await prefetchAssistData();
595 606 checkIn({ stage: 'final_steps' });
596 607 await setThemeRenderingMode('template-locked');
597 608 await postLaunchFunctions();
598 - if (siteImages?.length) {
609 + if (imageUrls.length) {
599 610 await storeSiteImages(siteImages).catch(() => null);
600 611 }
601 612 // translators: this is for a action log UI. Keep it short
602 - addStatusMessage(__('All done!', 'extendify-local'));
613 + addStatusMessage(launchStrings().statusDone);
603 614 await Promise.all([
604 615 reportInactivePlugins(intendedPlugins).catch(() => null),
616 + reportFailedDependencies(pagesReplaced),
605 617 checkIn({ stage: 'finished', siteProfile, sitePlugins, siteStyle }),
606 618 ]);
607 619 setWarnOnReload(false);
608 620 setDone(true);
@@ -614,14 +626,9 @@
614 626 });
615 627 // if we error here we can try again by resetting the home stretch and stalling again to refetch data
616 628 homeStretch.current = false;
617 629 needToStall(true);
618 - setErrorMessage(
619 - __(
620 - 'Something went wrong during the final steps. We will try again but you may need to refresh the page.',
621 - 'extendify-local',
622 - ),
623 - );
630 + setErrorMessage(launchStrings().errorFinalSteps);
624 631 });
625 632 }, [data, needToStall, setUserGaveConsent]);
626 633
627 634 return { done };
@@ -645,12 +652,7 @@
645 652 useEffect(() => {
646 653 if (!error || needToStall()) return;
647 654 console.error(error);
648 655 digest({ error, details: { source: 'auto-launch', caller: 'run-step' } });
649 - setErrorMessage(
650 - __(
651 - 'Having some trouble with this step. Trying again...',
652 - 'extendify-local',
653 - ),
654 - );
656 + setErrorMessage(launchStrings().errorStep);
655 657 }, [error, setErrorMessage, needToStall]);
656 658 };