{
	"$schema": "https://playground.wordpress.net/blueprint-schema.json",
	"meta": {
		"title": "EthPress — Web3 Login",
		"description": "Ethereum / EVM crypto-wallet login for WordPress (MetaMask, Reown / WalletConnect). Installs EthPress and WooCommerce and opens the demo page: review the settings as admin, then press the button to sign out and test the wallet login.",
		"author": "ethereumicoio",
		"categories": [
			"demo"
		]
	},
	"landingPage": "/?ethpress_demo=1",
	"preferredVersions": {
		"php": "8.3",
		"wp": "latest"
	},
	"features": {
		"networking": true
	},
	"steps": [
		{
			"step": "login",
			"username": "admin"
		},
		{
			"step": "installPlugin",
			"pluginData": {
				"resource": "wordpress.org/plugins",
				"slug": "ethpress"
			},
			"options": {
				"activate": true
			}
		},
		{
			"step": "installPlugin",
			"pluginData": {
				"resource": "wordpress.org/plugins",
				"slug": "woocommerce"
			},
			"options": {
				"activate": true
			},
			"progress": {
				"caption": "Installing WooCommerce"
			}
		},
		{
			"step": "mkdir",
			"path": "/wordpress/wp-content/mu-plugins"
		},
		{
			"step": "writeFile",
			"path": "/wordpress/wp-content/mu-plugins/ethpress-playground-demo.php",
			"data": "<?php\n/**\n * EthPress Playground demo notice.\n *\n * Injected by assets/blueprints/blueprint.json. This file is not part of the\n * EthPress plugin and is never shipped in a release artifact.\n */\n\ndefined('ABSPATH') || die;\n\nconst ETHPRESS_DEMO_PARAM           = 'ethpress_demo';\nconst ETHPRESS_DEMO_LOGOUT_REDIRECT = '/wp-login.php?loggedout=true';\nconst ETHPRESS_DEMO_PRO_URL         = 'https://demo.ethereumico.io/my-account/';\n\n/**\n * Whether the demo notice should be shown for this request.\n */\nfunction ethpress_demo_is_admin_view(): bool\n{\n    return isset($_GET[ETHPRESS_DEMO_PARAM]) && current_user_can('manage_options');\n}\n\n/**\n * Logout URL that lands on the screen with the EthPress wallet button.\n */\nfunction ethpress_demo_logout_url(): string\n{\n    return wp_logout_url(home_url(ETHPRESS_DEMO_LOGOUT_REDIRECT));\n}\n\n/**\n * Builds the escaped notice markup.\n *\n * @param string $context Either 'front' or 'admin'.\n */\nfunction ethpress_demo_markup(string $context): string\n{\n    $style = 'margin:0;padding:16px 20px;border-bottom:3px solid #2271b1;background:#f0f6fc;color:#1d2327;font:15px/1.5 system-ui,sans-serif;';\n\n    $html  = '<div class=\"ethpress-demo-notice\" style=\"' . $style . '\">';\n    $html .= '<p style=\"margin:0 0 10px;\">' . esc_html__('You are signed in as the site administrator, so you can review the EthPress settings.', 'ethpress') . '</p>';\n    $html .= '<p style=\"margin:0 0 12px;\">' . esc_html__('To test crypto-wallet login, press the button below: it signs you out and opens the login screen where the EthPress wallet button is shown.', 'ethpress') . '</p>';\n    $html .= '<p style=\"margin:0;\">';\n    $btn   = 'display:inline-block;margin:0 10px 0 0;padding:9px 16px;border-radius:3px;text-decoration:none;font-weight:600;';\n    $html .= '<a class=\"button button-primary\" style=\"' . $btn . 'background:#2271b1;color:#fff;border:1px solid #2271b1;\" href=\"' . esc_url(ethpress_demo_logout_url()) . '\">' . esc_html__('Sign out and try wallet login', 'ethpress') . '</a>';\n    $html .= '<a class=\"button\" style=\"' . $btn . 'background:#fff;color:#2271b1;border:1px solid #2271b1;\" href=\"' . esc_url(admin_url('options-general.php?page=ethpress')) . '\">' . esc_html__('EthPress settings', 'ethpress') . '</a>';\n\n    if ('admin' === $context) {\n        $html .= '<span style=\"display:block;margin-top:12px;\">';\n        $html .= esc_html__('The PRO login page - wallet login on the WooCommerce My Account page - can be seen here:', 'ethpress');\n        $html .= ' <a href=\"' . esc_url(ETHPRESS_DEMO_PRO_URL) . '\" target=\"_blank\" rel=\"noopener noreferrer\">' . esc_html(ETHPRESS_DEMO_PRO_URL) . '</a>';\n        $html .= '</span>';\n    }\n\n    $html .= '</p></div>';\n\n    return $html;\n}\n\n/**\n * Prints the notice on the front end, at most once.\n */\nfunction ethpress_demo_render_front(): void\n{\n    static $printed = false;\n\n    if ($printed || !ethpress_demo_is_admin_view()) {\n        return;\n    }\n\n    $printed = true;\n\n    echo ethpress_demo_markup('front'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped\n}\n\nadd_action('wp_body_open', 'ethpress_demo_render_front', 1);\nadd_action('wp_footer', 'ethpress_demo_render_front', 1);\n\n/**\n * Prints the notice in wp-admin, with the extra PRO demo link.\n */\nfunction ethpress_demo_render_admin(): void\n{\n    if (!ethpress_demo_is_admin_view()) {\n        return;\n    }\n\n    echo ethpress_demo_markup('admin'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped\n}\n\nadd_action('admin_notices', 'ethpress_demo_render_admin');\n"
		},
		{
			"step": "setSiteOptions",
			"options": {
				"blogname": "EthPress Playground",
				"blogdescription": "Ethereum / EVM crypto-wallet login",
				"users_can_register": 1,
				"woocommerce_onboarding_profile": {
					"skipped": true
				},
				"woocommerce_task_list_hidden": "yes",
				"woocommerce_allow_tracking": "no",
				"woocommerce_default_country": "US:CA",
				"woocommerce_currency": "USD",
				"woocommerce_enable_myaccount_registration": "yes",
				"woocommerce_coming_soon": "no",
				"woocommerce_store_pages_only": "no"
			}
		}
	]
}
