# Changelog

All notable changes to BW 2Checkout Pricing are documented here.

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

## [Unreleased]

## [0.5.6] - 2026-07-18

## [0.5.5] - 2026-07-18

## [0.5.4] - 2026-07-18

### Changed
- Moved the Term + Users controls into the header, under the product title. Restyled both as
  consistent white controls (matched height) on the accent header, with general spacing/sizing
  polish for a cleaner, more modern look. Header title is now a link (header is a container).

## [0.5.3] - 2026-07-17

### Changed
- Reworked the selector row: Term is a styled custom dropdown (not a native select); the users
  control is a compact number box with the up/down stacked on the right; label shortened to
  "Users"; both on one compact line.

## [0.5.2] - 2026-07-17

### Fixed
- Price could overflow instead of shrinking: removed a max-width cap that made the auto-fit measure
  the capped width (looked like it fit) rather than the true content width.

## [0.5.1] - 2026-07-17

### Fixed
- Monthly price display now sizes every part (symbol, integer, fraction, /month) relative to one
  base font-size (em units), and auto-fits that base to the card width so long amounts or long
  symbols/codes (e.g. VND) stay on a single line. The server sets a close starting size; the JS
  refines it exactly and re-fits on window resize. Currency symbol renders left or right per the
  currency (suffix currencies like SEK/VND go on the right).

## [0.5.0] - 2026-07-17

### Added
- Full block editor UI (inspector panels): Product & title (+ lock edition/term), Ribbon (toggle +
  text), Price labels (per-month, annual), Icons (media gallery), Footer (toggle, title, rows, image),
  Gmail banner (toggle + image), Checkout (button label, tpl), Style (accent). Media via MediaUpload.
- Currency symbol side inferred from the currency: suffix currencies (SEK, NOK, DKK, PLN, CZK, HUF,
  RON, …) render the symbol after the number; ambiguous ones (e.g. EUR) default to the left.

## [0.4.0] - 2026-07-17

### Changed
- Rebuilt the card to reproduce Copernic's bw-desktop-pricing design: square edges, brand orange
  (#f36923), clickable header with the flag-style ribbon, the exact big-number price layout
  (symbol / integer / fractional-with-underline / per), #ffeee6 price panel, 5-per-row icon grid,
  footer box, gmail banner slot, and invert-on-hover buy button. Price, currency symbol, and
  buy-link are API-driven; Term is a pill toggle and Users a stepper.

### Added
- Card content fields (shortcode attrs + block attributes): title, ribbon + ribbon title, per-month
  label, annual text, icons, footer (title / rows / image), gmail banner image, button text.

### Note
- Editor (inspector) controls for the new content fields — including the media gallery for icons —
  are the next pass. For now the block renders with defaults; all fields are drivable via the
  shortcode (used to reproduce the live pricing page on the test page).

## [0.3.0] - 2026-07-17

### Added
- Fully designed pricing card: accent-coloured header + plan heading, **Term** as a segmented pill
  toggle, a **Users** stepper, a big-number price (dollars large, cents superscript, "/month") with
  the billed total beneath, and a full-width Buy button.
- Block settings: plan heading, accent colour (colour palette), button label, and a per-block cart
  template (`tpl`, e.g. COPERNIC-two-columns) that overrides the plugin default.
- Currency-symbol map for the big-number display.

### Changed
- Reworked the widget markup/CSS/JS from the rough layout into the designed card; term/edition
  selectors render as pills, users as a stepper. Buy-link `tpl` is now threaded through the REST
  route and the server-side prefill.

## [0.2.2] - 2026-07-16

### Changed
- The default-selection price is now rendered server-side, so it appears immediately on page load
  instead of briefly showing "—" while the browser makes its first request. The front-end script
  skips its initial fetch when the server already prefilled, and only re-queries on user changes.

## [0.2.1] - 2026-07-16

### Changed
- Locked selectors now apply their value silently (hidden input) with no visible heading, so a
  locked widget shows only the remaining controls (e.g. Term + Number of users).
- Removed the product title heading from the widget output (not needed for now).

## [0.2.0] - 2026-07-16

### Added
- Gutenberg block **BW 2Checkout Pricing** (`bw-2checkout-pricing/pricing`). Dynamic/server-rendered,
  reusing the shortcode renderer (no JS build step). Inspector controls for the product and a
  per-selector "Lock" (e.g. lock Edition so it renders as a heading), with a live editor preview.
- Full internationalization. All code strings are translatable (`languages/bw-2checkout-pricing.pot`,
  58 strings). Config-driven labels (product / selector / option names) are WPML-aware — registered
  with WPML String Translation when WPML is active, passthrough otherwise.

## [0.1.3] - 2026-07-16

### Added
- Live currency conversion for all currencies. The pricing config only stores USD; other
  currencies are 2Checkout's runtime FX. We derive the exact FX multiplier from an order-preview
  (`PUT /orders/0/`) of the product in both currencies and apply it to the USD tier rate, matching
  what checkout charges. Cached like other API responses.

### Fixed
- Non-USD selections previously fell back to mock (the config has no non-USD rows); now converted live.
- Buy-link now sends the raw user count in the `users` scale option with `qty=1` (was sending the
  bucket code with `qty=user_count`), matching the construct Copernic provided.

## [0.1.2] - 2026-07-15

### Fixed
- Monthly price now divides by the full term length (12 × term years), not always 12, so
  2-year and 3-year terms no longer read 2–3× too high. Term length is derived from the
  selected term code, so no option-group name is hardcoded.

### Added
- `term_months` in the REST price response.
- All 52 account currencies available in the selector.

## [0.1.1] - 2026-07-15

### Added
- Live pricing via the 2Checkout REST API (reads the eStore-default pricing configuration,
  matches the selected option combination + currency).
- `lock_<key>="value"` shortcode attribute to fix a selector to a value and render it as a
  heading instead of an editable control (e.g. `lock_edition="advanced"`).
- Price presented monthly (total ÷ 12) with the billed total shown for reference.
- Currency selector on its own row, with a "will autodetect" note.

### Fixed
- Pricing is per-seat, not flat per tier: total = per-user rate × user count.
- Buy-link sent `qty=1` regardless of user count; now sends the actual count so the cart's
  unit × qty math matches the displayed price.
- Mock-fallback notice now reflects the actual per-response source rather than only the
  configured mode.

## [0.1.0] - 2026-07-13

### Added
- Initial scaffold.
