import type { WidgetConfig } from '../types'; /** * Everything under `src/demo/` belongs to the aisthetix demo store, not to the * product. It ships in the same bundle because there is only one bundle, and it * stays dead unless a store deliberately turns it on. * * Deliberately strict: only a literal `true` counts. A merchant config that * happens to carry a truthy value under this key (a stray "1", a filter that * returns a string) must not switch a shopper into demo behaviour by accident. */ export function isDemo( config: WidgetConfig ): boolean { return config.demo === true; } /** * How many try-ons the demo advertises. Zero (or an absent/absurd value) means * "do not put a number on screen" rather than "no try-ons left". */ export function demoTryOnLimit( config: WidgetConfig ): number { const limit = config.demoTryOnLimit; if ( typeof limit !== 'number' || ! Number.isFinite( limit ) || limit <= 0 ) { return 0; } return Math.floor( limit ); }