mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
The extension renders the same price two ways: Insights reads currency from
price_cache[].currency, but /api/meta-extraction returns a bare price with no
currency anywhere, so the Track tab can't format it. Store::currency and
Store::locale are accessors, not in $appends, so they never reach toArray().
Reading the raw settings blob is not a workaround - most stores have no
locale_settings key, so the real value only exists once the accessor applies
the app-config fallback.
Adds the resolved accessor values (ISO 4217 code, BCP-47 tag) to:
- StoreResource, which meta-extraction embeds as `store`
- MetaExtractionResource, at the top level next to `price`, falling back to
the app defaults when no store resolved and `store` is `{}`
- StoreTransformer, so GET /api/stores can format prices too
Locale is converted from the stored ICU form (en_AU) to BCP-47 (en-AU) at the
API boundary; Intl.NumberFormat rejects the underscore form. The accessors and
stored settings are unchanged.
currency/locale are deliberately absent from PaginationHandler's allowed
fields, since Spatie translates those into a select() and these are accessors,
not columns. Instead, a sparse fieldset forces `settings` into the select so
the accessors read real data rather than silently reporting the app-level
fallback.
Purely additive; no existing field changes.