UtilitiesDebuggerReference Every method and property exposed on the nextDebug global. Only available when the debugger is enabled (see Get Started).
| Name | Type | Description |
|---|
nextDebug.overlay | () => Promise<DebugOverlay> | Lazy-loaded overlay controller. Call await to access .show(), .hide(), .toggle(), .isVisible() |
nextDebug.testMode | TestModeManager | Test mode toggle for forcing campaign/cart states |
nextDebug.sdk | NextCommerce | The active SDK singleton |
nextDebug.stores | object | All Zustand stores (see below) |
| Name | Store |
|---|
nextDebug.stores.cart | useCartStore |
nextDebug.stores.campaign | useCampaignStore |
nextDebug.stores.config | useConfigStore |
nextDebug.stores.checkout | useCheckoutStore |
nextDebug.stores.order | useOrderStore |
nextDebug.stores.attribution | useAttributionStore |
Each store exposes .getState(), .setState(), and .subscribe() from the Zustand API.
| Method | Description |
|---|
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 |
| Method | Description |
|---|
reinitialize() | Tear down and reinitialize the SDK. Useful after manual config changes |
getStats() | Returns initialization stats (enhancer counts, scan time) |
| Method | Description |
|---|
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 |
| Method | Description |
|---|
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') |
| Method | Description |
|---|
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 |
| Method | Description |
|---|
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 |
All analytics methods are async — they lazy-load the analytics module on first call.
| Method | Description |
|---|
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.) |
| Method | Description |
|---|
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 |
These two custom events are watched by the debug overlay. Dispatch them from your own code:
| Event | Effect |
|---|
debug:log | Add an entry to the Event Timeline panel. Detail: { type, message, data } |
debug:update-content | Force the active panel to re-render |
window.dispatchEvent(new CustomEvent('debug:log', {
detail: { type: 'custom', message: 'Hello', data: { foo: 1 } },
}));