Skip to content

Add support for Blueprints defineSiteUrl#2516

Merged
bcotrim merged 7 commits intotrunkfrom
stu-830-add-support-for-blueprints-definesiteurl
Feb 4, 2026
Merged

Add support for Blueprints defineSiteUrl#2516
bcotrim merged 7 commits intotrunkfrom
stu-830-add-support-for-blueprints-definesiteurl

Conversation

@bcotrim
Copy link
Copy Markdown
Contributor

@bcotrim bcotrim commented Feb 2, 2026

Related issues

Proposed Changes

  • Extract defineSiteUrl from blueprint steps to pre-populate the custom domain field
  • Create bidirectional mapping utilities between blueprint settings and form values (extractFormValuesFromBlueprint / updateBlueprintWithFormValues)
  • Add BlueprintSiteSettings type for shared settings between blueprints and forms
  • Pre-populate custom domain from defineSiteUrl step and expand advanced settings
  • Pre-populate HTTPS toggle based on the protocol in defineSiteUrl (https vs http)
  • Update blueprint with final user selections before site creation (only updates existing properties)

Testing Instructions

Test 1: HTTPS URL in blueprint

  1. Create a blueprint file with a defineSiteUrl step using https:
{
  "steps": [
    {
      "step": "defineSiteUrl",
      "siteUrl": "https://mysite.local"
    }
  ]
}
  1. Open Studio and go to Add Site → Start from Blueprint → Choose Blueprint file
  2. Upload the blueprint file
  3. Verify:
    • Custom domain field shows mysite.local
    • Advanced settings are expanded
    • HTTPS toggle is ON
  4. Create the site and verify it works with HTTPS

Test 2: HTTP URL in blueprint

  1. Create a blueprint file with a defineSiteUrl step using http:
{
  "steps": [
    {
      "step": "defineSiteUrl",
      "siteUrl": "http://mysite.local"
    }
  ]
}
  1. Upload the blueprint file
  2. Verify:
    • Custom domain field shows mysite.local
    • HTTPS toggle is OFF

Test 3: URL with port (port is stripped)

  1. Create a blueprint file with a port in the URL:
{
  "steps": [
    {
      "step": "defineSiteUrl",
      "siteUrl": "https://mysite.local:8443"
    }
  ]
}
  1. Upload the blueprint file
  2. Verify custom domain field shows mysite.local (port is stripped - domain validation doesn't support ports)

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@bcotrim bcotrim self-assigned this Feb 2, 2026
bcotrim and others added 3 commits February 3, 2026 16:16
- Add comprehensive tests for extractFormValuesFromBlueprint and
  updateBlueprintWithFormValues utility functions
- Add tests for defineSiteUrl step extraction in blueprint deeplink hook
- Cover edge cases: port preservation, invalid URLs, http vs https
@bcotrim bcotrim requested a review from a team February 3, 2026 18:06
@bcotrim bcotrim marked this pull request as ready for review February 3, 2026 18:06
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Feb 3, 2026

📊 Performance Test Results

Comparing 815dff1 vs trunk

site-editor

Metric trunk 815dff1 Diff Change
load 2843.00 ms 2850.00 ms +7.00 ms 🔴 0.2%

site-startup

Metric trunk 815dff1 Diff Change
siteCreation 7068.00 ms 7094.00 ms +26.00 ms 🔴 0.4%
siteStartup 3923.00 ms 3922.00 ms -1.00 ms 🟢 -0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

Copy link
Copy Markdown
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the PR with and without https and I confirm Studio pre-fills the custom domain extracting it from defineSiteUrl step.

The only case that fails is Test 3: URL with port - Verify custom domain field shows mysite.local:8443 (port preserved). I don't see the port preserved, and I'm not sure if we should support it at all.

if ( defineSiteUrlStep?.siteUrl ) {
try {
const url = new URL( defineSiteUrlStep.siteUrl );
values.customDomain = url.hostname;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify custom domain field shows mysite.local:8443 (port preserved)

If we want to preserve the port we might need to use host instead of hostname. Although I'm not sure if we should just show a warning or error to avoid falling into a rabbit hole.

Suggested change
values.customDomain = url.hostname;
values.customDomain = url.host;

@bcotrim
Copy link
Copy Markdown
Contributor Author

bcotrim commented Feb 4, 2026

Good catch! This is intentional - we're using url.hostname instead of url.host to strip ports.

The reason is that domain validation (getDomainNameValidationError in common/lib/domains.ts) doesn't support ports:

  1. The regex pattern doesn't allow : characters
  2. Validation requires the domain to end with .local

If we preserved the port (e.g., mysite.local:8443), users would see a validation error in the form. Stripping the port avoids this issue.

I've updated the PR description to reflect this behavior. 👍

@bcotrim bcotrim requested review from sejas February 4, 2026 08:28
Copy link
Copy Markdown
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works as expected. The advance settings are expanded when suing the site url step definition, and the custom domain is pre-populated as expected. I also modified the pre-populated domain and I confirm it respected my custom domain.

Image

@bcotrim bcotrim merged commit 1554807 into trunk Feb 4, 2026
9 checks passed
@bcotrim bcotrim deleted the stu-830-add-support-for-blueprints-definesiteurl branch February 4, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants