# Changelog

All notable changes to this project 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).

## [Unreleased]

## [v1.2.6] - 2026-03-25

### Changed
- Updated CSV upload file input options in `src/views/qvc/upload-csv.php` to use default preview behavior.

## [v1.2.5] - 2026-03-25

### Added
- Registered QVC shipping cart data type loading through the module bootstrap and added module shipping/cartline model support for imported orders

### Changed
- Normalized CSV mapping storage and processing to target-key format across detection, editing, and preview flows
- Updated mapped import persistence to use module cart and cartline models with additional default order and line field population
- Improved mapped import views and controller flow to preserve normalized mappings consistently

### Fixed
- Corrected mapped import grouping and validation when mappings are saved or submitted in target-to-column form

## [v1.2.3] - 2026-03-25

### Changed
- Release version bump and changelog maintenance.

## [v1.2.2] - 2026-03-23

### Added
- Added CSV mapping targets for shipping address fields under `cartsbe.fulladdresses.shipping.*` based on `backend\models\Address`
- Added mapping aliases for common shipping-address CSV header names

### Changed
- Updated mapped import handling to support nested dotted Cartsbe field paths and merge them into `fulladdresses` JSON safely

## [v1.2.0] - 2026-03-23

### Added
- Config-based CSV mapping profiles in `src/config/csv-maps.php` for reusable import maps
- Automatic mapping profile detection on upload with direct redirect to mapped preview when a profile matches

### Changed
- Mapping/preview flow now shows a detection banner when an auto-matched profile is applied

## [v1.1.0] - 2026-03-23

### Added
- Multi-step CSV import workflow for QVC orders: upload, column mapping, preview, and approval
- New mapped import routes in `QvcController`:
	- `upload-csv`
	- `map-csv`
	- `mapped-preview`
	- `approve-mapped-import`
- New views for mapped import flow:
	- `src/views/upload-csv.php`
	- `src/views/map-csv.php`
	- `src/views/mapped-preview.php`
- Direct mapped import support for `\backend\models\Cartsbe` and `\backend\models\Cartlines` with per-order transaction handling

### Changed
- Refactored CSV and import business logic out of `QvcController` into reusable components
- Added `src/components/CsvParser.php` for CSV parsing and row normalization
- Added `src/components/QvcImportService.php` for field mapping, row conversion, summary building, and import persistence
- Moved mapping auto-detection logic out of view-local function to `QvcImportService::guessMapping()`

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

### Added
- Initial release of the QVC API integration module for Yii2
- `Module.php` — bootstrap class that self-registers and attaches to NGauge product events
- `Qvc.php` — dynamic product model exposing QVC-specific attributes (`id`, `name`, `qty`, `haulierid`)
- Guzzle HTTP client dependency for API communication
- Auto-registration as a NGauge product data type via `products-set-data-types` event
- Data loading integration via `products-after-DataLoad-qvc` event
