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' => '',
+ '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 ) . '