Show prices in the shop currency (STRIPE_CURRENCY), not hard-coded EUR
formatPrice always formatted EUR, so the public shop, checkout, basket and order confirmation showed € even when Stripe charged another currency. It now takes a currency; both apps pass STRIPE_CURRENCY to the blocks as layout data `currency` (like `timezone`), so one setting drives what Stripe charges and every price shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq6FzyGitv5gDZEcCHDGoo
This commit is contained in:
parent
de8d29beb4
commit
e29eaaa8e8
9 changed files with 93 additions and 65 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import { page } from '$app/state';
|
||||
import type { BasketLine, ShopBlockData, ItemRecord, SlotRecord } from '$shared/types';
|
||||
import { getBasketContext } from '$shared/basket.svelte';
|
||||
import { DEFAULT_TIMEZONE, addMonths, createCalendarMonth, formatInstant, formatPrice, startOfMonth, zonedDateKey } from '$shared/calendar';
|
||||
import { DEFAULT_CURRENCY, DEFAULT_TIMEZONE, addMonths, createCalendarMonth, formatInstant, formatPrice, startOfMonth, zonedDateKey } from '$shared/calendar';
|
||||
import { formatDateKey } from '$shared/slots';
|
||||
|
||||
let { data = {}, items = [], slots = [] } = $props<{
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
const MONTHS_SHOWN = 2;
|
||||
const weekdayLetters = ['M', 'T', 'W', 'T', 'F', 'S', 'S'];
|
||||
const timezone = $derived<string>(page.data.timezone ?? DEFAULT_TIMEZONE);
|
||||
const currency = $derived<string>(page.data.currency ?? DEFAULT_CURRENCY);
|
||||
|
||||
let visibleItems: ItemRecord[] = $derived.by(() => {
|
||||
let result: ItemRecord[] = items;
|
||||
|
|
@ -234,7 +235,7 @@
|
|||
{/if}
|
||||
|
||||
<div class="mt-auto flex flex-wrap items-center gap-x-3 gap-y-1 pt-3">
|
||||
<span class="text-lg font-semibold text-sage-dark">{formatPrice(item.price)}</span>
|
||||
<span class="text-lg font-semibold text-sage-dark">{formatPrice(item.price, currency)}</span>
|
||||
{#if isService && item.duration != null}
|
||||
<span class="text-xs text-charcoal/60">{item.duration} min</span>
|
||||
{:else if !isService && item.stock != null && item.stock > 0 && item.stock <= 5}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue