API
Methods
next.fomo(config?)
Initialize and start the FOMO popup rotation. Lazy-loads the enhancer on first call and replaces the active config on subsequent calls.
await next.fomo({
initialDelay: 0,
displayDuration: 5000,
delayBetween: 12000,
});Returns a Promise<void>. Safe to call inside or after next:initialized.
next.stopFomo()
Stop the rotation. The currently visible popup is hidden immediately and all pending timers are cleared. Calling next.fomo() again will restart from scratch.
next.stopFomo();Configuration Options
All options are optional. Defaults shown.
| Option | Type | Default | Description |
|---|---|---|---|
items | Array<{ text, image }> | First 5 packages from the active campaign with images | Items to show. text is the product name; image is the image URL or data URI |
customers | { [country]: string[] } | Built-in AU, GB, CA, US lists | Customer names grouped by country code |
country | string | Auto-detected from browser timezone | Country code that selects which customers[country] list to use |
maxMobileShows | number | 2 | Cap for mobile (window.innerWidth <= 768). Auto-stops after this many popups |
displayDuration | number | 5000 | Time each popup is visible, in ms |
delayBetween | number | 12000 | Pause between popups, in ms |
initialDelay | number | 0 | Wait before showing the first popup, in ms |
There is no per-popup maxShows for desktop. On desktop the rotation runs forever until stopFomo() is called or the page navigates.
Country Auto-Detection
When country is not provided, the active country is derived from the browser's IANA timezone:
| Timezone substring | Resolved country |
|---|---|
Australia | AU |
London, Dublin | GB |
Toronto, Vancouver | CA |
| (default) | US |
If the resolved country is missing from customers, the enhancer falls back to the US list. If US is missing too, customer names display as Someone.
Defaults Source
When no items are provided, items are pulled from campaignStore.data.packages:
- The first 5 packages
- Filtered to those with a non-empty
imagefield - Mapped to
{ text: pkg.name, image: pkg.image }
If the campaign has no packages with images, a single placeholder item is used so the rotation still runs.