Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puzzle app: update blueprint #1499

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions packages/playground/puzzle/src/site-builder/blueprints/yith.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
{
"landingPage": "/wp-admin/edit.php?post_type=gift_card&post_status=publish&yith-plugin-fw-panel-skip-redirect=1",
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-add_to_wishlist",
"steps": [
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "woocommerce"
},
"options": {
"activate": true
}
},
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; update_option('woocommerce_onboarding_profile', ['skipped' => true]);"
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "wordpress-importer"
}
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "yith-woocommerce-gift-cards"
},
"options": {
"activate": true
"slug": "yith-woocommerce-wishlist"
}
},
{
"step": "wp-cli",
"command": "wp option update yith_wcwl_show_on_loop 'yes'"
},
{
"step": "wp-cli",
"command": "wp import /wordpress/wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=create"
},
{
"step": "wp-cli",
"command": "wp transient set _wc_activation_redirect 0 259200"
},
{
"step": "wp-cli",
"command": "wp option update woocommerce_onboarding_profile '{\"skipped\": true}' --format=json"
}
]
}
13 changes: 3 additions & 10 deletions packages/playground/puzzle/src/site-builder/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export const processImage = async (actions: string[]) => {
);
if (actions.includes('/wp-admin/')) {
blueprint['landingPage'] = '/wp-admin/';
} else if (actions.length > 1) {
blueprint['landingPage'] = '/wp-admin/plugins.php';
}

if (actions.includes('multisite')) {
Expand Down Expand Up @@ -188,7 +190,6 @@ const mergeBlueprints = (blueprints: any[]) => {
};

const landingPages: string[] = [];
let pluginsInstalled = 0;
let themeInstalled = false;
for (const blueprint of blueprints) {
if (!blueprint) {
Expand All @@ -207,10 +208,6 @@ const mergeBlueprints = (blueprints: any[]) => {
),
];

pluginsInstalled += blueprint.steps.filter(
(step: any) => step.step === 'installPlugin'
).length;

if (
themeInstalled === false &&
blueprint.steps.find((step: any) => step.step === 'installTheme')
Expand All @@ -219,12 +216,8 @@ const mergeBlueprints = (blueprints: any[]) => {
}
}

// If multiple plugins are installed, go to the plugins list
if (pluginsInstalled > 1) {
newBlueprint.landingPage = '/wp-admin/plugins.php';
}
// If one landing page is defined, use it
else if (themeInstalled) {
if (themeInstalled) {
newBlueprint.landingPage = '/';
}
// If multiple landing pages are defined, go to the first one
Expand Down
Loading