diff --git a/src/promo-manager/core/index.ts b/src/promo-manager/core/index.ts index a1199af..fcf1451 100644 --- a/src/promo-manager/core/index.ts +++ b/src/promo-manager/core/index.ts @@ -2,18 +2,19 @@ import {Controller} from './controller'; import {getHooks} from './getHooks'; import type {PromoOptions} from './types'; -const getDebug = () => { +const getDebug = (options: PromoOptions) => { if (typeof window === 'undefined') { return false; } - const isDebugModeEnabled = Boolean(window.localStorage.getItem('debugPromoManager')); + const isDebugEnabledInLs = Boolean(window.localStorage.getItem('debugPromoManager')); + const isDebugEnabledInConfig = Boolean(options.debugMode); - return isDebugModeEnabled; + return isDebugEnabledInConfig || isDebugEnabledInLs; }; export function createPromoManager(options: PromoOptions) { - const controller = new Controller({...options, debugMode: getDebug()}); + const controller = new Controller({...options, debugMode: getDebug(options)}); const {usePromoManager, useActivePromo, usePromo} = getHooks(controller);