@shipeasy/sdk 7.1.0 → 7.1.1

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.
@@ -515,6 +515,14 @@ function onDocument(type, handler, opts) {
515
515
  } catch {
516
516
  }
517
517
  }
518
+ function dispatchWindow(type) {
519
+ try {
520
+ if (hasDomEvents() && typeof window.dispatchEvent === "function" && typeof CustomEvent === "function") {
521
+ window.dispatchEvent(new CustomEvent(type));
522
+ }
523
+ } catch {
524
+ }
525
+ }
518
526
  var FLUSH_INTERVAL_MS = 5e3;
519
527
  var MAX_BUFFER = 100;
520
528
  var ANON_ID_KEY = "__se_anon_id";
@@ -1421,7 +1429,7 @@ var Engine = class _Engine {
1421
1429
  getConfig: (n) => this.getConfig(n)
1422
1430
  };
1423
1431
  window.__shipeasy = bridge;
1424
- window.dispatchEvent(new CustomEvent("se:state:update"));
1432
+ dispatchWindow("se:state:update");
1425
1433
  return bridge;
1426
1434
  }
1427
1435
  track(eventName, props) {
@@ -1793,9 +1801,7 @@ var flags = {
1793
1801
  */
1794
1802
  notifyMounted() {
1795
1803
  _mountedAndReady = true;
1796
- if (typeof window !== "undefined") {
1797
- window.dispatchEvent(new CustomEvent("se:override:change"));
1798
- }
1804
+ dispatchWindow("se:override:change");
1799
1805
  },
1800
1806
  /** Subscribe for change notifications (identify/override). Used by framework adapters. */
1801
1807
  subscribe(listener) {
@@ -462,6 +462,14 @@ function onDocument(type, handler, opts) {
462
462
  } catch {
463
463
  }
464
464
  }
465
+ function dispatchWindow(type) {
466
+ try {
467
+ if (hasDomEvents() && typeof window.dispatchEvent === "function" && typeof CustomEvent === "function") {
468
+ window.dispatchEvent(new CustomEvent(type));
469
+ }
470
+ } catch {
471
+ }
472
+ }
465
473
  var FLUSH_INTERVAL_MS = 5e3;
466
474
  var MAX_BUFFER = 100;
467
475
  var ANON_ID_KEY = "__se_anon_id";
@@ -1368,7 +1376,7 @@ var Engine = class _Engine {
1368
1376
  getConfig: (n) => this.getConfig(n)
1369
1377
  };
1370
1378
  window.__shipeasy = bridge;
1371
- window.dispatchEvent(new CustomEvent("se:state:update"));
1379
+ dispatchWindow("se:state:update");
1372
1380
  return bridge;
1373
1381
  }
1374
1382
  track(eventName, props) {
@@ -1740,9 +1748,7 @@ var flags = {
1740
1748
  */
1741
1749
  notifyMounted() {
1742
1750
  _mountedAndReady = true;
1743
- if (typeof window !== "undefined") {
1744
- window.dispatchEvent(new CustomEvent("se:override:change"));
1745
- }
1751
+ dispatchWindow("se:override:change");
1746
1752
  },
1747
1753
  /** Subscribe for change notifications (identify/override). Used by framework adapters. */
1748
1754
  subscribe(listener) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipeasy/sdk",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "description": "Shipeasy SDK — feature gates, runtime configs, experiments, and metrics for the Shipeasy hosted service.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://shipeasy.ai",