import type { PricingBanner, PricingPackage, PricingTopBanner } from './types'; import snapshot from './offerings.snapshot.json'; interface Offerings { packages: PricingPackage[]; banner: PricingBanner | null; // Missing in a generated file from before the top bar existed topBanner?: PricingTopBanner | null; } // The shoot packages and the optional banner. config/fetchOfferings.ts writes // offerings.generated.json before every build with what the CMS says; without // it (tests, a build without CMS address, a CMS that is down) the committed // snapshot is used. Andrea uses the small business scheme (KOR): no VAT. // Tests always use the snapshot, so they do not depend on a build. const generated = import.meta.env.MODE === 'test' ? {} : import.meta.glob('./offerings.generated.json', { eager: true, import: 'default', }); const offerings: Offerings = generated['./offerings.generated.json'] ?? (snapshot as Offerings); // In display order const packages: PricingPackage[] = offerings.packages; export const banner: PricingBanner | null = offerings.banner; export const topBanner: PricingTopBanner | null = offerings.topBanner ?? null; export default packages;