Next Commerce
UtilitiesFOMOReference

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.

OptionTypeDefaultDescription
itemsArray<{ text, image }>First 5 packages from the active campaign with imagesItems to show. text is the product name; image is the image URL or data URI
customers{ [country]: string[] }Built-in AU, GB, CA, US listsCustomer names grouped by country code
countrystringAuto-detected from browser timezoneCountry code that selects which customers[country] list to use
maxMobileShowsnumber2Cap for mobile (window.innerWidth <= 768). Auto-stops after this many popups
displayDurationnumber5000Time each popup is visible, in ms
delayBetweennumber12000Pause between popups, in ms
initialDelaynumber0Wait 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 substringResolved country
AustraliaAU
London, DublinGB
Toronto, VancouverCA
(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 image field
  • 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.

On this page