# Changelog

All notable changes to the GetAddress.io Address Autocomplete Magento 2 Extension will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.12] - 2026-02-19

### Fixed
- **Critical**: Fixed configuration not appearing in window.checkoutConfig in checkout
- Implemented ConfigBlock to directly inject getaddress_autocomplete config into checkout page
- Configuration is now reliably available to JavaScript component regardless of Magento configuration caching
- Added config injection template (config-inject.phtml) for guaranteed configuration delivery

### Added
- New ConfigBlock class (src/Block/Checkout/ConfigBlock.php) for direct config injection
- New config-inject.phtml template for injecting config via script tag
- Console logging for config injection success

### Changed
- Updated checkout_index_index.xml layout to include config injection block before component loads
- More reliable configuration delivery mechanism that bypasses CompositeConfigProvider merging issues

---

## [v1.0.11] - 2026-02-19

### Improved
- Enhanced JavaScript debugging with detailed console logging
- Added comprehensive troubleshooting information in console messages
- Improved ConfigProvider with better status tracking
- Added console separators for easier log identification

### Added
- Detailed console output showing all available checkoutConfig keys
- Additional config fields: is_enabled_flag, has_api_key
- Better error messages with specific reasons for component being disabled

### Changed
- JavaScript component now logs config structure and individual flag values
- Enhanced console output for better debugging on remote sites

---

## [v1.0.10] - 2026-02-19

### Added
- Visual layout enhancements for address autocomplete form
- Debug message display when module is disabled
- Blue-bordered prominent form container
- Enhanced styling with better visual hierarchy
- Loading spinner animation with CSS keyframes
- Improved responsive design for mobile devices
- Comprehensive layout documentation in README

### Improved
- Enhanced template styling with inline styles for better visibility
- Better visual distinction between enabled/disabled states
- Mobile-responsive address results dropdown
- Improved error message styling
- Better spacing and padding throughout form

### Changed
- Updated CSS with stronger border styling (2px solid blue)
- Improved form container background color (#f9f9f9)
- Enhanced shadow effects for depth
- Better input field focus states

---

## [v1.0.9] - 2026-02-19

### Added
- ConfigProvider implementation (Model/Checkout/ConfigProvider.php)
- Conditional rendering based on admin configuration
- Support for checking both enabled flag AND API key presence
- Module registers in Magento\Checkout\Model\CompositeConfigProvider

### Implemented
- Configuration validation in ConfigProvider
- Dynamic visibility control based on admin settings
- JavaScript component checks window.checkoutConfig.getaddress_autocomplete.enabled
- Template conditional rendering with Knockout binding

### Changed
- Updated di.xml to register ConfigProvider in CompositeConfigProvider
- JavaScript component now reads configuration from window.checkoutConfig
- Template wraps entire component in conditional <!-- ko if: isEnabled() --> binding

---

## [v1.0.8] - 2026-02-19

### Fixed
- Component attachment point changed from shippingAddress to form-shipping-address
- Corrected Magento checkout layout structure understanding
- Component now properly injects as child of shipping address form

### Changed
- Updated layout XML referenceBlock target to correct form
- Adjusted sort order to ensure proper positioning
- Component now appears at correct location in checkout flow

---

## [v1.0.7] - 2026-02-19

### Fixed
- RequireJS module path configuration and mappings
- JavaScript module naming to match path structure
- Proper ES6 module loading in Magento 2

### Added
- requirejs-config.js for module path mapping
- Correct alias mapping for address-autocomplete component

### Changed
- Updated module path in layout XML to match RequireJS config
- Corrected component reference structure

---

## [v1.0.6] - 2026-02-19

### Improved
- JavaScript component initialization flow
- Better observable property management
- Enhanced template rendering logic
- Improved checkout integration

### Added
- Proper component lifecycle management
- Better data binding in template
- Enhanced form field handling

---

## [v1.0.5] - 2026-02-19

### Added
- Admin configuration section (etc/adminhtml/system.xml)
- System configuration for Enable flag
- System configuration for API Key (password field)
- Admin settings under Stores > Configuration > Sales > Checkout > Address Autocomplete

### Implemented
- Configuration validation
- API key securely masked as password field
- Helpful comments directing users to getAddress.io for API key generation

---

## [v1.0.4] - 2026-02-19

### Added
- Test data integration for address autocomplete demonstration
- Sample UK addresses (SW1A 2AA, SW1P 3PA postcodes)
- Basic search functionality with test data
- Loading indicator and error handling
- Address selection and display logic

### Improved
- Component rendering with test data
- Better template structure
- Simplified layout XML
- Improved JavaScript initialization

---

## [v1.0.3] - 2026-02-19

### Fixed
- Invalid XML in frontend/di.xml (removed JavaScript path from type name)
- Corrected DI configuration structure
- Fixed XML validation errors

### Removed
- Incorrect type definition that referenced JavaScript file

---

## [v1.0.2] - 2026-02-19

### Added
- All source files to git repository
- API interfaces (Api/AddressAutocompleteInterface.php)
- Implementation class (Model/AddressAutocompleteManagement.php)
- Views and templates
- Layout configuration
- CSS styling

### Fixed
- Source directory properly committed

---

## [v1.0.1] - 2026-02-19

### Fixed
- Updated package name from magento-getaddress-autocomplete to magento-addresslookup
- Corrected composer.json repository URL
- Fixed composer package naming inconsistencies

### Changed
- Package name: portalpeople/magento-addresslookup
- Updated all references in configuration files

---

## [v1.0.0] - 2026-02-19

### Added
- Initial release of GetAddress.io Address Autocomplete Extension
- Complete module structure following Magento 2 standards
- Directory layout: src/ with registration.php, etc/, Model/, Api/, Block/, view/
- Basic composer.json with dependencies
- Module registration and module.xml
- DI configuration
- Extension attributes for quote address
- Placeholder API models and interfaces
- Basic frontend layout and templates
- CSS styling foundation
- README.md documentation

### Features
- Magento 2.3+ compatible
- Address autocomplete UI component
- Checkout integration
- Admin configuration support (initial setup)
- Responsive design foundation

---

## Development Notes

### Module Naming
- **Composer Package**: portalpeople/magento-addresslookup
- **Module Name**: PortalPeople_GetAddressAutocomplete
- **Namespace**: PortalPeople\GetAddressAutocomplete

### Key Components
- **ConfigProvider**: Manages admin configuration and passes to frontend
- **ConfigBlock**: Directly injects configuration into checkout page
- **UI Component**: address-autocomplete, renders autocomplete form
- **Admin Config**: System section at checkout/getaddress_autocomplete

### Debugging
Enable browser DevTools Console to see:
- Component initialization status
- Configuration availability
- Available checkoutConfig keys
- Enabled/disabled reasons with specific details

### Deployment
```bash
composer update portalpeople/magento-addresslookup
php bin/magento setup:upgrade
php bin/magento cache:clean
php bin/magento setup:static-content:deploy -f
```
