Home > widget-integration > CountdownTimerAPI
CountdownTimerAPI class
API service for fetching countdown timer campaigns from the backend.
Resolves the current page context (product/cart) and fetches the most relevant active campaign. The backend handles scope filtering, country targeting, and time-window validation — this class only needs to identify the page scope and make the request.
Signature:
export declare class CountdownTimerAPI extends BoostAPI
Extends: BoostAPI
Remarks
The base URL is resolved once during construction via . If overriding this method via extend(), the override will be called during construction of the extended class.
Example
Extend to support countdown timers on collection pages:
window.boostWidgetIntegration.extend('CountdownTimerAPI', (CountdownTimerAPI) => {
return class CustomCountdownTimerAPI extends CountdownTimerAPI {
resolveTimerScope() {
const scope = super.resolveTimerScope();
if (scope) return scope;
if (this.platformLoader.platform.router.page === 'collection') return 'collection_page';
return null;
}
};
});
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Constructs a new instance of the |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
| |||
|
|
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
Fetch the most relevant countdown timer for the current page context. Resolves the page scope, builds query params (scope, country, shop, product), and calls | ||
|
Fetch the countdown timer for an explicit placement scope. Unlike , this does not auto-detect the scope from the current page — the caller provides it directly. Used by cart drawer integration where the timer scope is independent of the page type. | ||
|
|
Derive the countdown-timer base URL from the filterUrl. | |
|
|
Map the current page type to a countdown timer placement scope. Override this method to add timer support on additional page types (e.g., collection, homepage, custom landing pages). |