============================================================
 Greek VAT & Invoices for WooCommerce - What's New
============================================================

Version 1.2.3 (2026-09-12)
------------------------------------------------------------

 ★ Fixed: Two PHP Notices on Newer WordPress/WooCommerce

   Sites running WordPress 6.7+ and/or WooCommerce 11.0+ could see:

   "Function _load_textdomain_just_in_time was called incorrectly...
   Translations should be loaded at the init action or later."

   "Function woocommerce_register_additional_checkout_field was
   called incorrectly. Additional checkout fields should be
   registered on the woocommerce_init action or later."

   Both traced to the same cause: Block Checkout field registration
   ran on the `woocommerce_blocks_loaded` hook, which fires before
   WordPress's `init` action — too early for both the field labels'
   translation strings and the field-registration call itself.
   Registration now runs on `woocommerce_init` instead, exactly as
   WooCommerce's own guidance recommends. Purely a hook-timing fix —
   fields register and behave identically, verified against both
   Απόδειξη and Τιμολόγιο selections with WP_DEBUG logging on.

   Modified files:
   • includes/class-block-checkout.php — register_fields() now
     hooked to woocommerce_init instead of woocommerce_blocks_loaded

------------------------------------------------------------

Version 1.2.2 (2026-09-10)
------------------------------------------------------------

 ★ Clarified: Checkout ΑΦΜ "Valid" Message Was Misleading

   At checkout, typing any well-formed 9-digit number showed a
   green "✓ Έγκυρο" ("Valid") message — indistinguishable from a
   real verification, even though the plugin only checks digit
   count by default (no AADE lookup is performed unless a
   separate, not-yet-exposed AADE validation mode is manually
   enabled). A customer could see "Valid" for a made-up number,
   and there was no way for the store owner to tell the
   difference afterwards.

   The message now explicitly says the format is correct but the
   number has not been verified as real. Same wording change
   applied to the plugin's readme.txt FAQ, so this limitation is
   clear before installing, not just after.

   Modified files:
   • includes/class-vat-validator.php — basic-mode success
     message now states "correct format" instead of implying a
     genuine validation
   • assets/js/checkout.js — checkout now displays the server's
     actual per-mode message instead of a hardcoded generic
     "Valid" label

------------------------------------------------------------

Version 1.2.1 (2026-09-01)
------------------------------------------------------------

 ★ Bug Fix: Block Checkout Blocked Orders on "Απόδειξη" (Receipt)

   Selecting "Απόδειξη" correctly hid the Company Name, ΑΦΜ, ΔΟΥ,
   and Business Activity fields, but WooCommerce Blocks' own
   client-side validation still treated them as required, so the
   customer could not place the order. The required state is now
   evaluated against which invoice type is actually selected, both
   server-side and client-side, so Receipt orders are no longer
   blocked by fields the customer cannot see or fill in.

   Requires WooCommerce 9.9.0 or later for this per-field
   conditional behavior (needed for WooCommerce's own conditional
   required-field support). On older WooCommerce versions, the
   plugin falls back to enforcing required invoice fields on the
   server only, the same as before the required/optional fields
   feature existed, rather than incorrectly treating fields as
   always required client-side.

   Modified files:
   • includes/class-block-checkout.php — required flag is now a
     WooCommerce Blocks conditional rule tied to the invoice-type
     field, gated on WooCommerce 9.9.0+
   • assets/js/block-checkout.js — explicitly synchronizes each
     field's validation-store error with live visibility, the
     admin's required setting, and its current value

------------------------------------------------------------

Version 1.2.0 (2026-08-11)
------------------------------------------------------------

 ★ Per-Field Required/Optional Invoice Settings

   New settings section "Υποχρεωτικά Πεδία Τιμολογίου" under
   WooCommerce → Settings → Ελληνικά Τιμολόγια lets the store
   admin mark each of the 4 invoice fields as required or
   optional independently: Company Name, ΑΦΜ, ΔΟΥ, Business
   Activity. All 4 default to required, matching prior behavior
   for existing installs.

   New options (all default 'yes'):
   • GRVATIN_require_company
   • GRVATIN_require_vat
   • GRVATIN_require_doy
   • GRVATIN_require_activity

   ΑΦΜ format (9 digits) is still validated whenever a value is
   entered, regardless of the required/optional setting.

   Modified files:
   • includes/class-admin-settings.php — new settings section
   • includes/class-checkout-fields.php — gated PHP validation
     and optional-label display for Classic Checkout
   • assets/js/checkout.js — per-field required toggle
   • includes/class-block-checkout.php — gated required flags
     and validate callbacks for Block Checkout
   • greek-vat-invoices-for-woocommerce.php — localized the new
     settings to checkout.js

 ★ Bug Fix: Block Checkout "(Optional)" Label Mismatch

   Previously only ΑΦΜ was registered with required => true in
   Block Checkout; Company Name, ΔΟΥ, and Business Activity were
   registered required => false even though server-side
   validation already rejected them empty. Block Checkout's
   "(Optional)" label now accurately reflects each field's real
   required setting.

 ★ Bug Fix: Uppercase Conversion Setting

   The "Μετατροπή σε Κεφαλαία" checkbox saved to option
   GRVATIN_uppercase, but every consumer read
   GRVATIN_uppercase_fields — so toggling it never had any
   effect. The setting id now matches what's actually read.

 ★ Donate Link Updated

   Replaced the PayPal donate link with
   https://paypal.me/TheodoreSfakianakis across the plugin
   header, admin settings page, and all documentation files.

------------------------------------------------------------

Version 1.1.0 (2026-03-13)
------------------------------------------------------------

 ★ WooCommerce Block (Gutenberg) Checkout Support

   Full support for the new WooCommerce Block-based checkout
   page using the official Additional Checkout Fields API.

   New files:
   • includes/class-block-checkout.php
   • assets/js/block-checkout.js

   What it does:
   • Registers 5 checkout fields via woocommerce_register_additional_checkout_field():
     - Invoice Type (Τύπος Παραστατικού) — select: Απόδειξη / Τιμολόγιο
     - Company Name (Επωνυμία Επιχείρησης) — text
     - VAT Number (ΑΦΜ) — text, mandatory
     - Tax Office (ΔΟΥ) — text
     - Business Activity (Επάγγελμα) — text
   • Conditional field visibility: Company, VAT, DOY, Activity fields
     dynamically show/hide when the customer selects Τιμολόγιο or Απόδειξη
   • Server-side validation: VAT, DOY, Company, and Activity are
     validated as required only when invoice type is "invoice"
   • Field data saved to order meta using the same keys as classic checkout
     (_billing_invoice_type, _billing_vat_number, _billing_doy,
      _billing_business_activity, billing_company via set_billing_company)
   • Native admin order display — WooCommerce renders the fields
     automatically in the order edit screen (no duplicates)
   • Native email display — WooCommerce includes the fields in order
     emails automatically via WC_Emails::additional_checkout_fields()
   • JavaScript uses MutationObserver with 50ms debounce to detect
     DOM changes and toggle field visibility in the block checkout

 ★ New Admin Settings

   Modified file: includes/class-admin-settings.php

   • Checkout Type setting: Choose between "Classic (Shortcode)" and
     "Block (Checkout Block)" — saved as option 'grvatin_checkout_type'
   • Block Position setting: Choose where invoice fields appear in
     the block checkout — "Contact Information (top)" or
     "Additional Order Information (bottom)"
     Saved as option 'grvatin_block_position'
   • Classic Position setting: The existing 10-position dropdown,
     now only shown when Classic checkout type is selected
   • Admin JavaScript toggles visibility of the position dropdowns
     based on the selected checkout type

 ★ VAT Number (ΑΦΜ) Now Mandatory

   The VAT number field is now required (was optional before).
   In block checkout, server-side validation enforces this when
   invoice type is selected.

 ★ Smart Component Loading

   Modified file: greek-vat-invoices-for-woocommerce.php

   • GRVATIN_Checkout_Fields is always loaded (needed for admin
     order display and email hooks in both modes)
   • GRVATIN_Block_Checkout is loaded additionally when checkout
     type is set to "block"
   • In block mode, the classic display hooks (display_invoice_fields_admin
     and display_invoice_fields_email) return early to avoid duplicate
     display — WooCommerce handles rendering natively

 ★ Code Quality Improvements

   • Removed dead code: eliminated unused billing_address key check
     in get_submitted_invoice_type()
   • Added MutationObserver debounce (50ms) to prevent excessive
     DOM processing in block-checkout.js
   • Proper early returns in display hooks to prevent duplicate
     field rendering in admin orders and emails

------------------------------------------------------------

Version 1.0.8 (2025-01-17)
------------------------------------------------------------
   • Simplified plugin for WordPress.org release
   • Added real-time VAT validation (9 digits)
   • Added numeric-only input filter for VAT field
   • Beautified admin settings page with gradient styling
   • Added author information and donate button
   • Improved checkout JavaScript for better field toggle
   • Enhanced mobile responsiveness
   • Removed advanced features temporarily (moved to roadmap)

Version 1.0.7
------------------------------------------------------------
   • Fixed checkout field toggle functionality
   • Improved CSS styling
   • Bug fixes and performance improvements

Version 1.0.0
------------------------------------------------------------
   • Initial release
   • Basic invoice/receipt selection
   • Greek VAT fields (ΑΦΜ, ΔΟΥ)
   • Company information fields

============================================================
