Implement Phase 9 & reusable components; skip Phase 8 (emails)

Phase 8 (Emails) skipped: WooCommerce email rendering uses
wc_get_template_html() which bypasses the Twig pipeline entirely.
Email customization deferred to plugins or block email editor.

Phase 9 - Supplementary (7 templates):
- Brand description with thumbnail, taxonomy archive delegate
- Brands A-Z shortcode with alphabetical index navigation
- Single brand thumbnail shortcode
- REST API OAuth login and grant-access forms
- Back-in-stock notification form with email input

Reusable Components (6 templates):
- price: product price display with sale handling
- rating: star rating with Bootstrap Icons (filled/half/empty)
- address-card: billing/shipping address card with edit link
- status-badge: contextual order status badges
- quantity-input: +/- input group widget
- form-field: universal form field renderer (text/select/textarea/checkbox)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 10:53:44 +01:00
parent 8b1793097c
commit 49b1d52701
14 changed files with 657 additions and 35 deletions

View File

@@ -0,0 +1,72 @@
{#
# REST API Auth Grant Access Form (Bootstrap 5 Override)
#
# Confirmation page for granting third-party app access via OAuth.
# Rendered outside the WordPress theme (standalone page).
#
# Expected context:
# app_name - Name of the requesting application
# scope - Access scope (read, write, read_write)
# permissions - Array of permission description strings
# callback_url - Callback URL for the application
# return_url - URL to return to on deny
# granted_url - URL to redirect to on approve
# logout_url - URL to log out
# user - WP_User object of the logged-in user
#
# WooCommerce PHP equivalent: auth/form-grant-access.php
#
# @package WcBootstrap
# @since 0.1.0
#}
{{ do_action('woocommerce_auth_page_header') }}
<h1 class="h3 mb-4">
{{ __('%s would like to connect to your store')|format(app_name|esc_html) }}
</h1>
{{ wc_print_notices() }}
<p class="mb-3">
{{ __('This will give "%1$s" %2$s access which will allow it to:')|format(
'<strong>' ~ app_name|esc_html ~ '</strong>',
'<strong>' ~ scope|esc_html ~ '</strong>'
)|wp_kses_post }}
</p>
<ul class="list-group mb-4">
{% for permission in permissions %}
<li class="list-group-item">
<i class="bi bi-check-lg text-success me-2" aria-hidden="true"></i>
{{ permission|esc_html }}
</li>
{% endfor %}
</ul>
<div class="alert alert-warning mb-4" role="alert">
<i class="bi bi-exclamation-triangle me-2" aria-hidden="true"></i>
{{ __('Approving will share credentials with %s. Do not proceed if this looks suspicious in any way.')|format(
'<strong>' ~ wp_parse_url(callback_url, constant('PHP_URL_HOST'))|esc_html ~ '</strong>'
)|wp_kses_post }}
</div>
<div class="d-flex align-items-center gap-3 mb-4 p-3 bg-body-tertiary rounded">
{{ get_avatar(user.ID, 48)|raw }}
<div>
<span class="fw-semibold">{{ __('Logged in as %s')|format(user.display_name|esc_html) }}</span>
<a href="{{ logout_url|esc_url }}" class="d-block small">{{ __('Logout') }}</a>
</div>
</div>
<div class="d-flex gap-2">
<a href="{{ granted_url|esc_url }}" class="btn btn-primary">
<i class="bi bi-check-lg me-1" aria-hidden="true"></i>
{{ __('Approve') }}
</a>
<a href="{{ return_url|esc_url }}" class="btn btn-outline-secondary">
{{ __('Deny') }}
</a>
</div>
{{ do_action('woocommerce_auth_page_footer') }}