From 4d52886f16df4d1b2065bce0e1102b011f1600be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 9 Sep 2026 15:14:45 +0000 Subject: [PATCH] chore: sync funkycommerce-headless from monorepo Source: coded-letter/coded-letter-monorepo@91926789228a613709e0e3e6557551f58e9c4868 --- .monorepo-source.json | 2 +- functions.php | 2 +- inc/build-webhooks.php | 94 ++++++++++++++++++++++++++++++++++++++++-- package-lock.json | 4 +- package.json | 2 +- readme.txt | 7 +++- style.css | 2 +- 7 files changed, 103 insertions(+), 10 deletions(-) diff --git a/.monorepo-source.json b/.monorepo-source.json index 23b5df1..449af51 100644 --- a/.monorepo-source.json +++ b/.monorepo-source.json @@ -1,7 +1,7 @@ { "productId": "funkycommerce-headless", "repository": "coded-letter/superfunky-theme", - "source": "coded-letter/coded-letter-monorepo@2231c3290f97130c7f5a40820f205c0fb65f5687", + "source": "coded-letter/coded-letter-monorepo@91926789228a613709e0e3e6557551f58e9c4868", "sourcePath": "workspace/backend/wordpress/themes/free/funkycommerce-headless", "installSlug": "funkycommerce-headless", "kind": "theme", diff --git a/functions.php b/functions.php index 05e1a49..0d94a99 100644 --- a/functions.php +++ b/functions.php @@ -9,7 +9,7 @@ exit; } -define( 'FUNKYCOMMERCE_HEADLESS_VERSION', '1.2.31' ); +define( 'FUNKYCOMMERCE_HEADLESS_VERSION', '1.2.32' ); /** * Whether Superfunky Pro is active and licensed. diff --git a/inc/build-webhooks.php b/inc/build-webhooks.php index 319572e..c14207e 100644 --- a/inc/build-webhooks.php +++ b/inc/build-webhooks.php @@ -77,13 +77,13 @@ function funkycommerce_register_static_generation_graphql() { */ function funkycommerce_trigger_storefront_build( $reason = 'scheduled' ) { if ( ! funkycommerce_is_headless_mode() ) { - return; + return false; } $settings = funkycommerce_control_center_settings(); $webhook_url = $settings['build_webhook_url'] ?? ''; if ( empty( $webhook_url ) ) { - return; + return false; } $response = wp_safe_remote_post( @@ -114,7 +114,7 @@ function funkycommerce_trigger_storefront_build( $reason = 'scheduled' ) { ), admin_url( 'themes.php?page=funkycommerce-control-center' ) ); - return; + return false; } $status = wp_remote_retrieve_response_code( $response ); @@ -130,10 +130,98 @@ function funkycommerce_trigger_storefront_build( $reason = 'scheduled' ) { ), admin_url( 'themes.php?page=funkycommerce-control-center' ) ); + return false; } + return true; } add_action( FUNKYCOMMERCE_BUILD_EVENT, 'funkycommerce_trigger_storefront_build' ); +/** + * Add a manual storefront rebuild action and optional Netlify status badge. + * + * @param WP_Admin_Bar $admin_bar Admin toolbar. + */ +function funkycommerce_build_admin_bar( $admin_bar ) { + if ( ! is_admin_bar_showing() || ! current_user_can( 'manage_options' ) ) { + return; + } + $settings = funkycommerce_control_center_settings(); + $webhook_url = trim( (string) ( $settings['build_webhook_url'] ?? '' ) ); + if ( '' === $webhook_url ) { + return; + } + + $admin_bar->add_node( + array( + 'id' => 'funkycommerce-storefront-build', + 'title' => __( 'Rebuild storefront', 'funkycommerce-headless' ), + 'href' => wp_nonce_url( + admin_url( 'admin-post.php?action=funkycommerce_manual_storefront_build' ), + 'funkycommerce_manual_storefront_build' + ), + 'meta' => array( + 'title' => __( 'Publish current WordPress content to the static storefront', 'funkycommerce-headless' ), + ), + ) + ); + + $site_id = trim( (string) ( $settings['build_badge_id'] ?? '' ) ); + if ( '' === $site_id ) { + return; + } + $admin_bar->add_node( + array( + 'id' => 'funkycommerce-storefront-build-status', + 'parent' => 'funkycommerce-storefront-build', + 'title' => '' . esc_attr__( 'Netlify deploy status', 'funkycommerce-headless' ) . '', + 'href' => 'https://app.netlify.com/sites/' . rawurlencode( $site_id ) . '/deploys', + 'meta' => array( + 'html' => true, + 'target' => '_blank', + 'rel' => 'noopener noreferrer', + 'title' => __( 'Open Netlify deploys', 'funkycommerce-headless' ), + ), + ) + ); +} +add_action( 'admin_bar_menu', 'funkycommerce_build_admin_bar', 90 ); + +/** + * Handle the explicit administrator rebuild request. + */ +function funkycommerce_handle_manual_storefront_build() { + if ( ! current_user_can( 'manage_options' ) ) { + wp_die( esc_html__( 'You do not have permission to rebuild the storefront.', 'funkycommerce-headless' ), 403 ); + } + check_admin_referer( 'funkycommerce_manual_storefront_build' ); + $requested = funkycommerce_trigger_storefront_build( 'manual_admin_bar' ); + wp_safe_redirect( + add_query_arg( + 'funkycommerce_build_requested', + $requested ? '1' : '0', + wp_get_referer() ?: admin_url() + ) + ); + exit; +} +add_action( 'admin_post_funkycommerce_manual_storefront_build', 'funkycommerce_handle_manual_storefront_build' ); + +/** + * Confirm a manual build request in wp-admin. + */ +function funkycommerce_manual_storefront_build_notice() { + if ( ! current_user_can( 'manage_options' ) || ! isset( $_GET['funkycommerce_build_requested'] ) ) { + return; + } + $requested = '1' === sanitize_key( wp_unslash( $_GET['funkycommerce_build_requested'] ) ); + $class = $requested ? 'notice-success' : 'notice-error'; + $message = $requested + ? __( 'Storefront rebuild requested. Netlify will publish the updated static content when the build completes.', 'funkycommerce-headless' ) + : __( 'The storefront rebuild could not be requested. Check the build webhook configuration and notifications.', 'funkycommerce-headless' ); + echo '

' . esc_html( $message ) . '

'; +} +add_action( 'admin_notices', 'funkycommerce_manual_storefront_build_notice' ); + /** * Preserve the content-change reason while keeping the debounce event argument-free. */ diff --git a/package-lock.json b/package-lock.json index b07aad9..b7b8e3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "funkycommerce-headless-theme", - "version": "1.2.31", + "version": "1.2.32", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "funkycommerce-headless-theme", - "version": "1.2.31", + "version": "1.2.32", "devDependencies": { "autoprefixer": "^10.4.20", "esbuild": "^0.28.2", diff --git a/package.json b/package.json index dc7ef31..065b5bf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "funkycommerce-headless-theme", "private": true, - "version": "1.2.31", + "version": "1.2.32", "description": "Tailwind/build tooling for the FunkyCommerce Headless WordPress theme's native frontend assets (block templates, template parts, loader, and Spotify slot).", "scripts": { "build:css": "tailwindcss -i ./assets/css/theme-source.css -o ./assets/dist/theme.css --minify", diff --git a/readme.txt b/readme.txt index 5812253..893aefc 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: headless, woocommerce, wpgraphql, full-site-editing Requires at least: 6.7 Tested up to: 6.8 Requires PHP: 7.4 -Stable tag: 1.2.31 +Stable tag: 1.2.32 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -15,6 +15,11 @@ Control Center, the theme also ships a complete native WordPress rendering path "Native frontend theme" below) with accessible header/footer/navigation templates and core front/home/singular/archive/search/404 routes styled to match the storefront. +== 1.2.32 highlights == + +* Adds an administrator-toolbar action for manually publishing changed WordPress content to the static storefront. +* Displays the Netlify deployment status in the toolbar when a site ID is configured. + == 1.2.31 highlights == * Resolves canonical storefront blog posts before WordPress rewrite and old-slug redirect handling. diff --git a/style.css b/style.css index ee9d96d..f245bdf 100644 --- a/style.css +++ b/style.css @@ -7,7 +7,7 @@ Description: A minimal, content-first block theme for polished WordPress preview Requires at least: 6.7 Tested up to: 6.8 Requires PHP: 7.4 -Version: 1.2.31 +Version: 1.2.32 Update URI: https://github.com/coded-letter/superfunky-theme License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html