Next Commerce
UtilitiesDebuggerReference

Methods

Every method and property exposed on the nextDebug global. Only available when the debugger is enabled (see Get Started).


Top-Level Properties

NameTypeDescription
nextDebug.overlay() => Promise<DebugOverlay>Lazy-loaded overlay controller. Call await to access .show(), .hide(), .toggle(), .isVisible()
nextDebug.testModeTestModeManagerTest mode toggle for forcing campaign/cart states
nextDebug.sdkNextCommerceThe active SDK singleton
nextDebug.storesobjectAll Zustand stores (see below)

Stores

NameStore
nextDebug.stores.cartuseCartStore
nextDebug.stores.campaignuseCampaignStore
nextDebug.stores.configuseConfigStore
nextDebug.stores.checkoutuseCheckoutStore
nextDebug.stores.orderuseOrderStore
nextDebug.stores.attributionuseAttributionStore

Each store exposes .getState(), .setState(), and .subscribe() from the Zustand API.


Mode Control

MethodDescription
enableDebug()Enable debug mode and reload with ?debugger=true
disableDebug()Disable debug mode and remove the URL parameter
toggleDebug()Flip the active debug mode
isDebugMode()Returns true when debug mode is currently active

SDK Lifecycle

MethodDescription
reinitialize()Tear down and reinitialize the SDK. Useful after manual config changes
getStats()Returns initialization stats (enhancer counts, scan time)

Cart Methods

MethodDescription
addToCart(packageId, quantity?)Add a package by ref_id. Defaults to quantity 1
removeFromCart(packageId)Remove a package by ref_id
updateQuantity(packageId, quantity)Set the quantity for an item already in the cart
addTestItems()Add packages 2, 7, and 9 with placeholder data — quick way to populate an empty cart

Campaign Methods

MethodDescription
loadCampaign()Re-fetch the campaign from the API. Returns a Promise
clearCampaignCache()Clear the cached campaign in campaignStore
getCacheInfo()Print the cache info as a console table and return it
inspectPackage(packageId)Print package details to the console as a grouped table
testShippingMethod(methodId)Set a shipping method on the cart and log the result. Returns a Promise
sortPackages(sortBy)Trigger a campaign-panel sort ('price' or 'name')

Order Methods

MethodDescription
order.getJourney()Print upsellJourney as a console table and return it
order.isExpired()Returns true when the order has aged out (15-min TTL)
order.clearCache()Clear the order from orderStore and sessionStorage
order.getStats()Object with hasOrder, refId, orderAge, viewedUpsells, completedUpsells, journeyLength

Attribution Methods

MethodDescription
attribution.debug()Print full attribution state (calls attributionStore.debug())
attribution.get()Returns the attribution payload that the SDK sends to the API
attribution.setFunnel(name)Manually set the funnel name
attribution.setEvclid(id)Manually set the Everflow click ID
attribution.getFunnel()Print and return the current funnel (with persisted fallback)
attribution.clearFunnel()Clear the persisted funnel name from local/session storage

Analytics Methods

All analytics methods are async — they lazy-load the analytics module on first call.

MethodDescription
analytics.getStatus()Returns provider status (enabled/disabled per provider)
analytics.getProviders()Returns the active providers list
analytics.track(event, data)Send a custom event through the analytics pipeline
analytics.setDebugMode(enabled)Toggle verbose console logging in analytics adapters
analytics.invalidateContext()Force re-evaluation of analytics context (page type, currency, etc.)

Accordion Methods

MethodDescription
accordion.open(id)Dispatch next:accordion-open for the given accordion ID
accordion.close(id)Dispatch next:accordion-close
accordion.toggle(id)Dispatch next:accordion-toggle

Custom Event Hooks

These two custom events are watched by the debug overlay. Dispatch them from your own code:

EventEffect
debug:logAdd an entry to the Event Timeline panel. Detail: { type, message, data }
debug:update-contentForce the active panel to re-render
window.dispatchEvent(new CustomEvent('debug:log', {
  detail: { type: 'custom', message: 'Hello', data: { foo: 1 } },
}));

On this page