myio-js-library 0.1.97 → 0.1.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1911,38 +1911,59 @@ function base64ToBytesStrict(b64) {
1911
1911
  init_template_card();
1912
1912
 
1913
1913
  // src/components/SelectionStore.js
1914
- var MyIOSelectionStoreClass = class {
1914
+ var MyIOSelectionStoreClass = class _MyIOSelectionStoreClass {
1915
+ // Global debug flag - controls all console logs
1916
+ static GlobalDebug = false;
1917
+ /**
1918
+ * Enable or disable all console logs from SelectionStore
1919
+ * @param {boolean} enabled - true to enable logs, false to disable
1920
+ */
1921
+ static setGlobalDebug(enabled) {
1922
+ _MyIOSelectionStoreClass.GlobalDebug = !!enabled;
1923
+ console.log(`[SelectionStore] \u{1F527} Global debug ${enabled ? "ENABLED" : "DISABLED"}`);
1924
+ }
1925
+ /**
1926
+ * Internal logging method - respects GlobalDebug flag
1927
+ */
1928
+ _log(level, ...args) {
1929
+ if (!_MyIOSelectionStoreClass.GlobalDebug) return;
1930
+ const logMethod = console[level] || console.log;
1931
+ logMethod.apply(console, args);
1932
+ }
1915
1933
  constructor() {
1916
- console.log("[SelectionStore] \u{1F50D} Constructor called - checking for existing instance...");
1917
- console.log("[SelectionStore] typeof document:", typeof document);
1934
+ this._log("log", "[SelectionStore] \u{1F50D} Constructor called - checking for existing instance...");
1935
+ this._log("log", "[SelectionStore] typeof document:", typeof document);
1918
1936
  if (typeof window !== "undefined") {
1919
- console.log("[SelectionStore] window.top === window:", window.top === window);
1920
- console.log("[SelectionStore] document location:", window.location.href);
1921
- console.log("[SelectionStore] Is in iframe:", window !== window.top);
1937
+ this._log("log", "[SelectionStore] window.top === window:", window.top === window);
1938
+ this._log("log", "[SelectionStore] document location:", window.location.href);
1939
+ this._log("log", "[SelectionStore] Is in iframe:", window !== window.top);
1922
1940
  }
1923
- console.log("[SelectionStore] document.__MyIOSelectionStore_INSTANCE__:", !!document?.__MyIOSelectionStore_INSTANCE__);
1941
+ this._log("log", "[SelectionStore] document.__MyIOSelectionStore_INSTANCE__:", !!document?.__MyIOSelectionStore_INSTANCE__);
1924
1942
  if (typeof document !== "undefined") {
1925
1943
  const myioProps = Object.getOwnPropertyNames(document).filter((key) => key.startsWith("__MyIO"));
1926
- console.log("[SelectionStore] All __MyIO* properties on document:", myioProps);
1944
+ this._log("log", "[SelectionStore] All __MyIO* properties on document:", myioProps);
1927
1945
  }
1928
1946
  let existingInstance = null;
1929
1947
  try {
1930
1948
  const targetWindow = typeof window !== "undefined" && window.top ? window.top : window;
1931
1949
  existingInstance = targetWindow?.__MyIOSelectionStore_INSTANCE__;
1932
- console.log("[SelectionStore] Checking window.top.__MyIOSelectionStore_INSTANCE__:", !!existingInstance);
1950
+ this._log("log", "[SelectionStore] Checking window.top.__MyIOSelectionStore_INSTANCE__:", !!existingInstance);
1933
1951
  } catch (e) {
1934
- console.warn("[SelectionStore] Cannot access window.top:", e.message);
1952
+ this._log("warn", "[SelectionStore] Cannot access window.top:", e.message);
1935
1953
  }
1936
1954
  if (!existingInstance) {
1937
1955
  existingInstance = typeof document !== "undefined" && document.__MyIOSelectionStore_INSTANCE__ || typeof window !== "undefined" && window.__MyIOSelectionStore_INSTANCE__;
1938
1956
  }
1939
1957
  if (existingInstance) {
1940
- console.warn("[SelectionStore] \u26A0\uFE0F Constructor called but instance already exists! Returning existing instance.");
1941
- console.log("[SelectionStore] Existing instance has listeners:", existingInstance.eventListeners.get("selection:change")?.length || 0);
1958
+ this._log("warn", "[SelectionStore] \u26A0\uFE0F Constructor called but instance already exists! Returning existing instance.");
1959
+ this._log("log", "[SelectionStore] Existing instance has listeners:", existingInstance.eventListeners.get("selection:change")?.length || 0);
1942
1960
  return existingInstance;
1943
1961
  }
1944
- console.log("[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
1945
- console.trace("[SelectionStore] Constructor called from:");
1962
+ this._log("log", "[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
1963
+ if (_MyIOSelectionStoreClass.GlobalDebug) {
1964
+ console.trace("[SelectionStore] Constructor called from:");
1965
+ }
1966
+ this.MAX_SELECTION = 6;
1946
1967
  this.state = { selectedDevice: null };
1947
1968
  this.selectedIds = /* @__PURE__ */ new Set();
1948
1969
  this.entities = /* @__PURE__ */ new Map();
@@ -1952,38 +1973,54 @@ var MyIOSelectionStoreClass = class {
1952
1973
  this.cacheExpiry = 5 * 60 * 1e3;
1953
1974
  this.eventListeners.set("selection:change", []);
1954
1975
  this.eventListeners.set("selection:totals", []);
1976
+ this.eventListeners.set("selection:limit-reached", []);
1955
1977
  this.eventListeners.set("comparison:open", []);
1956
1978
  this.eventListeners.set("comparison:too_many", []);
1957
1979
  try {
1958
1980
  const targetWindow = typeof window !== "undefined" && window.top ? window.top : window;
1959
1981
  if (targetWindow) {
1960
- console.log("[SelectionStore] \u{1F4BE} Storing instance in window.top.__MyIOSelectionStore_INSTANCE__");
1982
+ this._log("log", "[SelectionStore] \u{1F4BE} Storing instance in window.top.__MyIOSelectionStore_INSTANCE__");
1961
1983
  targetWindow.__MyIOSelectionStore_INSTANCE__ = this;
1962
- console.log("[SelectionStore] \u2705 Stored in top window! Verify:", !!targetWindow.__MyIOSelectionStore_INSTANCE__);
1984
+ this._log("log", "[SelectionStore] \u2705 Stored in top window! Verify:", !!targetWindow.__MyIOSelectionStore_INSTANCE__);
1963
1985
  }
1964
1986
  } catch (e) {
1965
- console.warn("[SelectionStore] \u26A0\uFE0F Cannot access window.top (cross-origin iframe):", e.message);
1987
+ this._log("warn", "[SelectionStore] \u26A0\uFE0F Cannot access window.top (cross-origin iframe):", e.message);
1966
1988
  if (typeof document !== "undefined") {
1967
- console.log("[SelectionStore] \u{1F4BE} Storing instance in document.__MyIOSelectionStore_INSTANCE__ (fallback)");
1989
+ this._log("log", "[SelectionStore] \u{1F4BE} Storing instance in document.__MyIOSelectionStore_INSTANCE__ (fallback)");
1968
1990
  document.__MyIOSelectionStore_INSTANCE__ = this;
1969
- console.log("[SelectionStore] \u2705 Stored! Verify:", !!document.__MyIOSelectionStore_INSTANCE__);
1991
+ this._log("log", "[SelectionStore] \u2705 Stored! Verify:", !!document.__MyIOSelectionStore_INSTANCE__);
1970
1992
  }
1971
1993
  }
1972
1994
  }
1973
1995
  // Core Selection Methods
1974
1996
  add(id) {
1975
- console.log("[MyIOSelectionStoreClass] Entrou na LIB", id);
1997
+ this._log("log", "[MyIOSelectionStoreClass] Entrou na LIB", id);
1976
1998
  const wasSelected = this.selectedIds.has(id);
1977
- this.selectedIds.add(id);
1978
- if (!wasSelected) {
1979
- this._emitSelectionChange("add", id);
1980
- this._trackEvent("footer_dock.drop_add", { entityId: id });
1999
+ if (wasSelected) {
2000
+ this._log("log", "[MyIOSelectionStoreClass] Item j\xE1 est\xE1 selecionado:", id);
2001
+ return;
1981
2002
  }
2003
+ if (this.selectedIds.size >= this.MAX_SELECTION) {
2004
+ this._log("warn", `[MyIOSelectionStoreClass] Limite de sele\xE7\xE3o atingido (${this.MAX_SELECTION})`);
2005
+ this._emit("selection:limit-reached", {
2006
+ maxAllowed: this.MAX_SELECTION,
2007
+ currentCount: this.selectedIds.size,
2008
+ attemptedId: id
2009
+ });
2010
+ this._trackEvent("selection.limit_reached", {
2011
+ entityId: id,
2012
+ limit: this.MAX_SELECTION
2013
+ });
2014
+ return;
2015
+ }
2016
+ this.selectedIds.add(id);
2017
+ this._emitSelectionChange("add", id);
2018
+ this._trackEvent("footer_dock.drop_add", { entityId: id });
1982
2019
  }
1983
2020
  remove(id) {
1984
- console.log("[MyIOSelectionStoreClass] ITEM PARA REMO\xC7\xC3O ID", id);
2021
+ this._log("log", "[MyIOSelectionStoreClass] ITEM PARA REMO\xC7\xC3O ID", id);
1985
2022
  if (!this.selectedIds.has(id)) return;
1986
- console.log("[MyIOSelectionStoreClass] DELETE ID", id);
2023
+ this._log("log", "[MyIOSelectionStoreClass] DELETE ID", id);
1987
2024
  this.selectedIds.delete(id);
1988
2025
  this._emitSelectionChange("remove", id);
1989
2026
  this._trackEvent("footer_dock.remove_chip", { entityId: id });
@@ -2036,7 +2073,7 @@ var MyIOSelectionStoreClass = class {
2036
2073
  return Array.from(this.selectedIds);
2037
2074
  }
2038
2075
  getSelectedEntities() {
2039
- console.log("[MyIOSelectionStoreClass] biblioteca:", this.getSelectedIds());
2076
+ this._log("log", "[MyIOSelectionStoreClass] biblioteca:", this.getSelectedIds());
2040
2077
  return this.getSelectedIds().map((id) => this.entities.get(id)).filter((entity) => entity !== void 0);
2041
2078
  }
2042
2079
  getTotals() {
@@ -2103,17 +2140,17 @@ var MyIOSelectionStoreClass = class {
2103
2140
  }
2104
2141
  // Event System
2105
2142
  on(event, callback) {
2106
- console.log(`[SelectionStore] \u{1F4DD} Registering listener for event: ${event}`);
2143
+ this._log("log", `[SelectionStore] \u{1F4DD} Registering listener for event: ${event}`);
2107
2144
  if (typeof event !== "string" || typeof callback !== "function") {
2108
- console.error(`[SelectionStore] \u274C Invalid registration: event=${typeof event}, callback=${typeof callback}`);
2145
+ this._log("error", `[SelectionStore] \u274C Invalid registration: event=${typeof event}, callback=${typeof callback}`);
2109
2146
  return;
2110
2147
  }
2111
2148
  if (!this.eventListeners.has(event)) {
2112
- console.log(`[SelectionStore] \u{1F195} Creating new listener array for: ${event}`);
2149
+ this._log("log", `[SelectionStore] \u{1F195} Creating new listener array for: ${event}`);
2113
2150
  this.eventListeners.set(event, []);
2114
2151
  }
2115
2152
  this.eventListeners.get(event).push(callback);
2116
- console.log(`[SelectionStore] \u2705 Listener registered! Total for ${event}: ${this.eventListeners.get(event).length}`);
2153
+ this._log("log", `[SelectionStore] \u2705 Listener registered! Total for ${event}: ${this.eventListeners.get(event).length}`);
2117
2154
  }
2118
2155
  off(event, callback) {
2119
2156
  if (!this.eventListeners.has(event)) return;
@@ -2221,22 +2258,22 @@ var MyIOSelectionStoreClass = class {
2221
2258
  });
2222
2259
  }
2223
2260
  _emit(event, data) {
2224
- console.log(`[SelectionStore] \u{1F514} Emitting event: ${event}, listeners: ${this.eventListeners.get(event)?.length || 0}`);
2225
- console.log(`[SelectionStore] \u{1F4E6} Event data:`, data);
2261
+ this._log("log", `[SelectionStore] \u{1F514} Emitting event: ${event}, listeners: ${this.eventListeners.get(event)?.length || 0}`);
2262
+ this._log("log", `[SelectionStore] \u{1F4E6} Event data:`, data);
2226
2263
  if (!this.eventListeners.has(event)) {
2227
- console.warn(`[SelectionStore] \u26A0\uFE0F No listener map for event: ${event}`);
2264
+ this._log("warn", `[SelectionStore] \u26A0\uFE0F No listener map for event: ${event}`);
2228
2265
  return;
2229
2266
  }
2230
2267
  const listeners = this.eventListeners.get(event);
2231
2268
  if (listeners.length === 0) {
2232
- console.warn(`[SelectionStore] \u26A0\uFE0F No listeners registered for event: ${event}`);
2269
+ this._log("warn", `[SelectionStore] \u26A0\uFE0F No listeners registered for event: ${event}`);
2233
2270
  }
2234
2271
  listeners.forEach((callback, index) => {
2235
- console.log(`[SelectionStore] \u{1F3AF} Calling listener #${index} for ${event}`);
2272
+ this._log("log", `[SelectionStore] \u{1F3AF} Calling listener #${index} for ${event}`);
2236
2273
  try {
2237
2274
  callback(data);
2238
2275
  } catch (error) {
2239
- console.error(`[SelectionStore] \u274C Error in ${event} listener #${index}:`, error);
2276
+ this._log("error", `[SelectionStore] \u274C Error in ${event} listener #${index}:`, error);
2240
2277
  }
2241
2278
  });
2242
2279
  }
@@ -2248,7 +2285,7 @@ var MyIOSelectionStoreClass = class {
2248
2285
  ...payload
2249
2286
  });
2250
2287
  } catch (error) {
2251
- console.error("Analytics tracking error:", error);
2288
+ this._log("error", "Analytics tracking error:", error);
2252
2289
  }
2253
2290
  }
2254
2291
  _convertToKwh(value, unit) {
@@ -2285,28 +2322,33 @@ var MyIOSelectionStoreClass = class {
2285
2322
  return data;
2286
2323
  }
2287
2324
  };
2325
+ function _moduleLog(level, ...args) {
2326
+ if (!MyIOSelectionStoreClass.GlobalDebug) return;
2327
+ const logMethod = console[level] || console.log;
2328
+ logMethod.apply(console, args);
2329
+ }
2288
2330
  var MyIOSelectionStore;
2289
2331
  var _singletonInstance = null;
2290
2332
  if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
2291
- console.log("[SelectionStore] \u{1F527} Module initialization - checking for existing instance...");
2333
+ _moduleLog("log", "[SelectionStore] \u{1F527} Module initialization - checking for existing instance...");
2292
2334
  if (!globalThis.window.__MyIOLibrary_PROTECTED__) {
2293
- console.log("[SelectionStore] \u{1F6E1}\uFE0F Protecting window.MyIOLibrary object from UMD overwrites...");
2335
+ _moduleLog("log", "[SelectionStore] \u{1F6E1}\uFE0F Protecting window.MyIOLibrary object from UMD overwrites...");
2294
2336
  const existingLib = globalThis.window.MyIOLibrary;
2295
2337
  Object.defineProperty(globalThis.window, "MyIOLibrary", {
2296
2338
  get: function() {
2297
2339
  if (!globalThis.window.__MyIOLibrary_INSTANCE__) {
2298
- console.log("[SelectionStore] \u{1F4E6} Creating protected MyIOLibrary container object");
2340
+ _moduleLog("log", "[SelectionStore] \u{1F4E6} Creating protected MyIOLibrary container object");
2299
2341
  globalThis.window.__MyIOLibrary_INSTANCE__ = existingLib || {};
2300
2342
  }
2301
2343
  return globalThis.window.__MyIOLibrary_INSTANCE__;
2302
2344
  },
2303
2345
  set: function(value) {
2304
- console.log("[SelectionStore] \u{1F504} UMD tried to overwrite MyIOLibrary - merging properties instead");
2346
+ _moduleLog("log", "[SelectionStore] \u{1F504} UMD tried to overwrite MyIOLibrary - merging properties instead");
2305
2347
  if (value && typeof value === "object") {
2306
2348
  const currentLib = globalThis.window.__MyIOLibrary_INSTANCE__ || {};
2307
2349
  Object.keys(value).forEach((key) => {
2308
2350
  if (key === "MyIOSelectionStore" && currentLib.MyIOSelectionStore) {
2309
- console.log("[SelectionStore] \u23ED\uFE0F Skipping MyIOSelectionStore - already set");
2351
+ _moduleLog("log", "[SelectionStore] \u23ED\uFE0F Skipping MyIOSelectionStore - already set");
2310
2352
  return;
2311
2353
  }
2312
2354
  currentLib[key] = value[key];
@@ -2318,52 +2360,52 @@ if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined
2318
2360
  enumerable: true
2319
2361
  });
2320
2362
  globalThis.window.__MyIOLibrary_PROTECTED__ = true;
2321
- console.log("[SelectionStore] \u2705 window.MyIOLibrary protected!");
2363
+ _moduleLog("log", "[SelectionStore] \u2705 window.MyIOLibrary protected!");
2322
2364
  }
2323
2365
  let existingInstance = null;
2324
2366
  try {
2325
2367
  const targetWindow = globalThis.window.top ? globalThis.window.top : globalThis.window;
2326
2368
  existingInstance = targetWindow.__MyIOSelectionStore_INSTANCE__;
2327
- console.log("[SelectionStore] window.top.__MyIOSelectionStore_INSTANCE__:", !!existingInstance);
2369
+ _moduleLog("log", "[SelectionStore] window.top.__MyIOSelectionStore_INSTANCE__:", !!existingInstance);
2328
2370
  } catch (e) {
2329
- console.warn("[SelectionStore] Cannot access window.top during module init:", e.message);
2371
+ _moduleLog("warn", "[SelectionStore] Cannot access window.top during module init:", e.message);
2330
2372
  }
2331
2373
  if (!existingInstance) {
2332
2374
  existingInstance = typeof document !== "undefined" && document.__MyIOSelectionStore_INSTANCE__ || globalThis.window.__MyIOSelectionStore_INSTANCE__;
2333
- console.log("[SelectionStore] document.__MyIOSelectionStore_INSTANCE__:", !!(typeof document !== "undefined" && document.__MyIOSelectionStore_INSTANCE__));
2334
- console.log("[SelectionStore] window.__MyIOSelectionStore_INSTANCE__:", !!globalThis.window.__MyIOSelectionStore_INSTANCE__);
2375
+ _moduleLog("log", "[SelectionStore] document.__MyIOSelectionStore_INSTANCE__:", !!(typeof document !== "undefined" && document.__MyIOSelectionStore_INSTANCE__));
2376
+ _moduleLog("log", "[SelectionStore] window.__MyIOSelectionStore_INSTANCE__:", !!globalThis.window.__MyIOSelectionStore_INSTANCE__);
2335
2377
  }
2336
2378
  if (existingInstance) {
2337
- console.log("[SelectionStore] \u{1F504} REUSING constructor-created instance from __MyIOSelectionStore_INSTANCE__");
2379
+ _moduleLog("log", "[SelectionStore] \u{1F504} REUSING constructor-created instance from __MyIOSelectionStore_INSTANCE__");
2338
2380
  _singletonInstance = existingInstance;
2339
2381
  MyIOSelectionStore = _singletonInstance;
2340
2382
  if (!Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore")?.get) {
2341
- console.log("[SelectionStore] \u{1F517} Defining window.MyIOSelectionStore getter to point to singleton");
2383
+ _moduleLog("log", "[SelectionStore] \u{1F517} Defining window.MyIOSelectionStore getter to point to singleton");
2342
2384
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
2343
2385
  get: function() {
2344
2386
  return _singletonInstance;
2345
2387
  },
2346
2388
  set: function(value) {
2347
- console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2389
+ _moduleLog("warn", "[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2348
2390
  },
2349
2391
  configurable: false,
2350
2392
  enumerable: true
2351
2393
  });
2352
2394
  }
2353
2395
  if (globalThis.window.MyIOLibrary && typeof globalThis.window.MyIOLibrary === "object") {
2354
- console.log("[SelectionStore] \u{1F517} Updating window.MyIOLibrary.MyIOSelectionStore to point to singleton");
2396
+ _moduleLog("log", "[SelectionStore] \u{1F517} Updating window.MyIOLibrary.MyIOSelectionStore to point to singleton");
2355
2397
  globalThis.window.MyIOLibrary.MyIOSelectionStore = _singletonInstance;
2356
2398
  }
2357
2399
  } else if (Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore")?.get) {
2358
- console.log("[SelectionStore] \u{1F504} REUSING protected global instance via getter");
2400
+ _moduleLog("log", "[SelectionStore] \u{1F504} REUSING protected global instance via getter");
2359
2401
  MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
2360
2402
  _singletonInstance = MyIOSelectionStore;
2361
2403
  if (globalThis.window.MyIOLibrary && typeof globalThis.window.MyIOLibrary === "object") {
2362
- console.log("[SelectionStore] \u{1F517} Updating window.MyIOLibrary.MyIOSelectionStore to point to singleton");
2404
+ _moduleLog("log", "[SelectionStore] \u{1F517} Updating window.MyIOLibrary.MyIOSelectionStore to point to singleton");
2363
2405
  globalThis.window.MyIOLibrary.MyIOSelectionStore = _singletonInstance;
2364
2406
  }
2365
2407
  } else if (globalThis.window.MyIOSelectionStore && typeof globalThis.window.MyIOSelectionStore === "object") {
2366
- console.log("[SelectionStore] \u{1F512} UPGRADING existing instance to protected");
2408
+ _moduleLog("log", "[SelectionStore] \u{1F512} UPGRADING existing instance to protected");
2367
2409
  _singletonInstance = globalThis.window.MyIOSelectionStore;
2368
2410
  MyIOSelectionStore = _singletonInstance;
2369
2411
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
@@ -2371,17 +2413,17 @@ if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined
2371
2413
  return _singletonInstance;
2372
2414
  },
2373
2415
  set: function(value) {
2374
- console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2416
+ _moduleLog("warn", "[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2375
2417
  },
2376
2418
  configurable: false,
2377
2419
  enumerable: true
2378
2420
  });
2379
2421
  if (globalThis.window.MyIOLibrary && typeof globalThis.window.MyIOLibrary === "object") {
2380
- console.log("[SelectionStore] \u{1F517} Updating window.MyIOLibrary.MyIOSelectionStore to point to singleton");
2422
+ _moduleLog("log", "[SelectionStore] \u{1F517} Updating window.MyIOLibrary.MyIOSelectionStore to point to singleton");
2381
2423
  globalThis.window.MyIOLibrary.MyIOSelectionStore = _singletonInstance;
2382
2424
  }
2383
2425
  } else {
2384
- console.log("[SelectionStore] \u{1F195} Creating new protected singleton instance");
2426
+ _moduleLog("log", "[SelectionStore] \u{1F195} Creating new protected singleton instance");
2385
2427
  _singletonInstance = new MyIOSelectionStoreClass();
2386
2428
  MyIOSelectionStore = _singletonInstance;
2387
2429
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
@@ -2389,16 +2431,16 @@ if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined
2389
2431
  return _singletonInstance;
2390
2432
  },
2391
2433
  set: function(value) {
2392
- console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2434
+ _moduleLog("warn", "[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2393
2435
  },
2394
2436
  configurable: false,
2395
2437
  enumerable: true
2396
2438
  });
2397
2439
  if (globalThis.window.MyIOLibrary && typeof globalThis.window.MyIOLibrary === "object") {
2398
- console.log("[SelectionStore] \u{1F517} Setting window.MyIOLibrary.MyIOSelectionStore to singleton");
2440
+ _moduleLog("log", "[SelectionStore] \u{1F517} Setting window.MyIOLibrary.MyIOSelectionStore to singleton");
2399
2441
  globalThis.window.MyIOLibrary.MyIOSelectionStore = _singletonInstance;
2400
2442
  }
2401
- console.log("[SelectionStore] \u{1F512} Instance protected and ready");
2443
+ _moduleLog("log", "[SelectionStore] \u{1F512} Instance protected and ready");
2402
2444
  }
2403
2445
  if (!globalThis.window.MyIOSelectionStoreClass) {
2404
2446
  globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
package/dist/index.d.cts CHANGED
@@ -776,6 +776,17 @@ declare let MyIOSelectionStore: any;
776
776
  * @author MYIO Frontend Guild
777
777
  */
778
778
  declare class MyIOSelectionStoreClass {
779
+ static GlobalDebug: boolean;
780
+ /**
781
+ * Enable or disable all console logs from SelectionStore
782
+ * @param {boolean} enabled - true to enable logs, false to disable
783
+ */
784
+ static setGlobalDebug(enabled: boolean): void;
785
+ /**
786
+ * Internal logging method - respects GlobalDebug flag
787
+ */
788
+ _log(level: any, ...args: any[]): void;
789
+ MAX_SELECTION: number;
779
790
  state: {
780
791
  selectedDevice: any;
781
792
  };