{
    "$schema": "https://playground.wordpress.net/blueprint-schema.json",
    "meta": {
        "title": "FundCollector",
        "description": "Try FundCollector with a demo nonprofit, a short donation form, and seeded donations and donors.",
        "author": "brales"
    },
    "landingPage": "/donation/",
    "preferredVersions": {
        "php": "8.1",
        "wp": "latest"
    },
    "phpExtensionBundles": [
        "kitchen-sink"
    ],
    "features": {
        "networking": false
    },
    "steps": [
        {
            "step": "login",
            "username": "admin",
            "password": "password"
        },
        {
            "step": "installPlugin",
            "pluginData": {
                "resource": "wordpress.org/plugins",
                "slug": "fundcollector"
            },
            "options": {
                "activate": true
            }
        },
        {
            "step": "defineWpConfigConsts",
            "consts": {
                "FUNDCOLLECTOR_DEMO_MODE": true
            }
        },
        {
            "step": "setSiteOptions",
            "options": {
                "blogname": "Riverside Animal Shelter",
                "blogdescription": "A demo nonprofit powered by the FundCollector donation plugin"
            }
        },
        {
            "step": "runPHP",
            "code": "<?php\n/**\n * Demo data seed for the WordPress.org Live Preview blueprint (FundCollector Free).\n *\n * This file is the readable source of truth. It is embedded verbatim as the\n * `runPHP` step inside blueprint.json (WordPress.org blueprints must be a\n * single self-contained JSON file, so this code cannot be referenced from an\n * external file at runtime).\n *\n * After editing this file, copy its contents (minus the opening/closing PHP\n * tags) into the \"runPHP\" step's \"code\" value inside blueprint.json, then\n * re-test on playground.wordpress.net before committing the blueprint to SVN.\n *\n * Neither this file nor the rest of .wordpress-org/ ships in the plugin zip\n * (excluded via .distignore); only assets/blueprints/blueprint.json is\n * committed to the WordPress.org SVN assets directory.\n */\n\nrequire_once '/wordpress/wp-load.php';\n\n// Friendly permalinks so the demo Donation page has a clean, memorable URL.\nupdate_option('permalink_structure', '/%postname%/');\nflush_rewrite_rules();\n\n// Never show the setup wizard automatically in the demo.\ndelete_transient('fundcollector_activation_redirect');\n\n// --- Payment methods: enabled so donors see the real PayPal / bank transfer UI. ---\n// PayPal sandbox mode is on with no real credentials configured. Combined with\n// FUNDCOLLECTOR_DEMO_MODE (set via the blueprint's defineWpConfigConsts step),\n// the plugin blocks the final submission before any request reaches PayPal, so\n// no charge - not even a sandbox one - can ever be created from this demo.\nFundcollector_Settings::update_setting('enable_paypal', '1');\nFundcollector_Settings::update_setting('paypal_sandbox_mode', '1');\nFundcollector_Settings::update_setting('enable_bank_transfer', '1');\n\n// --- Emails: fully disabled for the demo (belt and suspenders). ---\nFundcollector_Settings::update_setting('donor_paypal_receipt_email', '0');\nFundcollector_Settings::update_setting('admin_paypal_notification_email', '0');\nFundcollector_Settings::update_setting('donor_bank_transfer_receipt_email', '0');\nFundcollector_Settings::update_setting('admin_bank_transfer_notification_email', '0');\nFundcollector_Settings::update_setting('bank_transfer_instructions_email_notification', '0');\nadd_filter('fundcollector_should_send_email', '__return_false');\n\n// --- Default form: short (Name, Last Name, Company/Organization, Email), clearly a donation form. ---\n$fundcollector_demo_form_fields = array(\n    'main_cta'      => array('enabled' => '1', 'required' => '0', 'value' => 'Donate to Riverside Animal Shelter'),\n    'secondary_cta' => array('enabled' => '1', 'required' => '0', 'value' => 'Your support helps rescued animals find a safe, loving home.'),\n    'name'          => array('enabled' => '1', 'required' => '0', 'value' => ''),\n    'last_name'     => array('enabled' => '1', 'required' => '0', 'value' => ''),\n    'company'       => array('enabled' => '1', 'required' => '0', 'value' => ''),\n    'email'         => array('enabled' => '1', 'required' => '1'),\n    'phone'         => array('enabled' => '0', 'required' => '0'),\n    'address'       => array('enabled' => '0', 'required' => '0'),\n    'postal_code'   => array('enabled' => '0', 'required' => '0'),\n    'city'          => array('enabled' => '0', 'required' => '0'),\n    'state'         => array('enabled' => '0', 'required' => '0'),\n    'nation'        => array('enabled' => '0', 'required' => '0'),\n    'tax_id'        => array('enabled' => '0', 'required' => '0'),\n    'privacy_text'  => array('enabled' => '1', 'required' => '0', 'value' => 'I agree to the privacy policy'),\n);\n\n$fundcollector_demo_design_settings = array(\n    'form_width'              => 600,\n    'primary_color'           => '#4CAF50',\n    'secondary_color'         => '#f9f9f9',\n    'border_radius'           => 8,\n    'button_background_color' => '#1976D2',\n    'button_text_color'       => '#ffffff',\n    'hover_effect'            => 'darken',\n    'font_family'             => 'system',\n    'font_size'               => 'medium',\n    'title_style'             => 'bold',\n    'show_required_notice'    => '1',\n);\n\nFundcollector_Forms_Manager::save_form_design('default', 'Demo Donation Form', $fundcollector_demo_form_fields, $fundcollector_demo_design_settings);\n\n// --- Publish the default \"Donation\" page (created as a draft on activation). ---\n$fundcollector_demo_donation_pages = get_posts(array(\n    'post_type'      => 'page',\n    'title'          => 'Donation',\n    'posts_per_page' => 1,\n    'post_status'    => array('draft', 'publish', 'pending', 'private'),\n));\n\nif (!empty($fundcollector_demo_donation_pages)) {\n    wp_update_post(array(\n        'ID'          => $fundcollector_demo_donation_pages[0]->ID,\n        'post_status' => 'publish',\n    ));\n}\n\n// --- Seed donors and donations so Donations List and Donors already look alive. ---\n$fundcollector_demo_now = time();\n$fundcollector_demo_day = DAY_IN_SECONDS;\n\n// [first name, last name, company (empty for individuals), donor type, email, amount, payment method, days ago]\n$fundcollector_demo_donation_seeds = array(\n    array('Amara', 'Okafor', '', 'individual', 'amara.okafor@example.com', 45.00, 'paypal', 2),\n    array('Ben', 'Castillo', '', 'individual', 'ben.castillo@example.com', 25.00, 'bank_transfer', 5),\n    array('Claire', 'Whitfield', 'Whitfield & Co', 'company', 'claire.whitfield@example.com', 250.00, 'paypal', 9),\n    array('Devon', 'Marsh', '', 'individual', 'devon.marsh@example.com', 15.00, 'paypal', 12),\n    array('Elena', 'Petrov', '', 'individual', 'elena.petrov@example.com', 60.00, 'bank_transfer', 16),\n    array('Frank', 'Delgado', 'Delgado Realty', 'company', 'frank.delgado@example.com', 500.00, 'bank_transfer', 20),\n    array('Grace', 'Lindqvist', '', 'individual', 'grace.lindqvist@example.com', 35.00, 'paypal', 24),\n    array('Hiro', 'Tanaka', '', 'individual', 'hiro.tanaka@example.com', 100.00, 'paypal', 29),\n    array('Imani', 'Brooks', 'Brooks Studio', 'company', 'imani.brooks@example.com', 150.00, 'bank_transfer', 34),\n    array('Jonas', 'Meyer', '', 'individual', 'jonas.meyer@example.com', 20.00, 'paypal', 40),\n    array('Amara', 'Okafor', '', 'individual', 'amara.okafor@example.com', 45.00, 'paypal', 3),\n    array('Ben', 'Castillo', '', 'individual', 'ben.castillo@example.com', 25.00, 'bank_transfer', 33),\n    array('Grace', 'Lindqvist', '', 'individual', 'grace.lindqvist@example.com', 35.00, 'paypal', 48),\n    array('Hiro', 'Tanaka', '', 'individual', 'hiro.tanaka@example.com', 100.00, 'paypal', 55),\n    array('Devon', 'Marsh', '', 'individual', 'devon.marsh@example.com', 15.00, 'paypal', 60),\n    array('Claire', 'Whitfield', 'Whitfield & Co', 'company', 'claire.whitfield@example.com', 250.00, 'paypal', 65),\n);\n\nforeach ($fundcollector_demo_donation_seeds as $fundcollector_demo_seed) {\n    list($fundcollector_demo_first, $fundcollector_demo_last, $fundcollector_demo_company, $fundcollector_demo_donor_type, $fundcollector_demo_email, $fundcollector_demo_amount, $fundcollector_demo_method, $fundcollector_demo_days_ago) = $fundcollector_demo_seed;\n\n    Fundcollector_Donations_Manager::add_donation(array(\n        'donor_email'             => $fundcollector_demo_email,\n        'donor_name'              => $fundcollector_demo_first,\n        'donor_last_name'         => $fundcollector_demo_last,\n        'donor_type'              => $fundcollector_demo_donor_type,\n        'donor_company'           => $fundcollector_demo_company,\n        'donation_amount'         => number_format($fundcollector_demo_amount, 2, '.', ''),\n        'donation_currency'       => 'USD',\n        'donation_payment_method' => $fundcollector_demo_method,\n        'donation_payment_status' => 'completed',\n        'donation_datetime'       => gmdate('Y-m-d H:i:s', $fundcollector_demo_now - ($fundcollector_demo_days_ago * $fundcollector_demo_day)),\n        'form_id'                 => 'default',\n        'donation_purpose'        => 'Demo donation form',\n    ));\n}"
        }
    ]
}