@titan-os/sdk 1.10.1 → 1.10.3

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/esm/sdk.js CHANGED
@@ -416,7 +416,8 @@ const createGuid = () => {
416
416
  const DEFAULT_DOM_READY_TIMEOUT_MS = 1e4;
417
417
  const DOM_READY_TIMEOUT_SECONDS = DEFAULT_DOM_READY_TIMEOUT_MS / 1e3;
418
418
  const MESSAGE_TIMEOUT_MS = 1e4;
419
- const IFRAME_TIMEOUT_MS = 3e3;
419
+ const IFRAME_TIMEOUT_MS = 1e4;
420
+ const CSP_WAIT_TIMEOUT_MS = 5e3;
420
421
  const MUTATION_OBSERVER_TIMEOUT_MS = 3e4;
421
422
  const POLLING_INTERVAL_MS = 50;
422
423
  const DOM_READY_WARNING_INTERVALS = [
@@ -640,7 +641,7 @@ const matchBrandFromUserAgent = (userAgent, regex) => {
640
641
  const match = userAgent.match(regex);
641
642
  return match ? match[1] : null;
642
643
  };
643
- const VERSION = "1.10.1";
644
+ const VERSION = "1.10.3";
644
645
  var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
645
646
  ErrorCode2["NOT_INITIALIZED"] = "NOT_INITIALIZED";
646
647
  ErrorCode2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
@@ -3745,27 +3746,6 @@ function detectStreamingSupport() {
3745
3746
  supportMPEG_DASH: "unknown"
3746
3747
  };
3747
3748
  }
3748
- function detect3DUHDSupport() {
3749
- try {
3750
- const sysinfoElement = document.createElement("object");
3751
- sysinfoElement.style.display = "none";
3752
- sysinfoElement.setAttribute("id", "sysinfo");
3753
- sysinfoElement.setAttribute("type", "systeminfoobject");
3754
- document.body.appendChild(sysinfoElement);
3755
- const sysinfo = sysinfoElement;
3756
- const result = {
3757
- support3d: Boolean(sysinfo.has3D),
3758
- supportUHD: sysinfo.panelinfo?.toLowerCase() === "3840x2160"
3759
- };
3760
- return { ...result, supportFHD: true };
3761
- } catch (error) {
3762
- return {
3763
- support3d: false,
3764
- supportUHD: false,
3765
- supportFHD: true
3766
- };
3767
- }
3768
- }
3769
3749
  function detectOIPFSupport() {
3770
3750
  try {
3771
3751
  if (oipfWindow.get("oipfObjectFactory") !== void 0) {
@@ -4117,15 +4097,7 @@ class BaseBridge {
4117
4097
  callback(data);
4118
4098
  };
4119
4099
  this.eventHandlers.get(type)?.add(handler);
4120
- window.addEventListener(
4121
- "message",
4122
- (event) => handler(event.data.data)
4123
- );
4124
4100
  return () => {
4125
- window.removeEventListener(
4126
- "message",
4127
- (event) => handler(event.data?.data)
4128
- );
4129
4101
  this.eventHandlers.get(type)?.delete(handler);
4130
4102
  };
4131
4103
  }
@@ -4140,6 +4112,7 @@ class BaseBridge {
4140
4112
  }
4141
4113
  if (data && (data.type === "BRIDGE_READY" || data.type === "LAUNCHER_READY") && this.iframe?.contentWindow === event.source) {
4142
4114
  this.connected = true;
4115
+ this.isInitialized = true;
4143
4116
  return;
4144
4117
  }
4145
4118
  if (data && data.type && Object.values(NOTIFICATION_MESSAGE_TYPES).includes(
@@ -4278,6 +4251,7 @@ class BaseBridge {
4278
4251
  const readyTimeout = setTimeout(() => {
4279
4252
  if (this.aborted) return;
4280
4253
  log$n.warn("Bridge iframe ready timeout - continuing anyway");
4254
+ window.removeEventListener("message", transferData);
4281
4255
  resolve();
4282
4256
  }, this.iframeTimeout);
4283
4257
  const checkReady = (event) => {
@@ -4285,8 +4259,10 @@ class BaseBridge {
4285
4259
  if (event.data && event.data.type === MESSAGE_TYPES.LAUNCHER_READY && this.iframe?.contentWindow === event.source) {
4286
4260
  log$n.debug("bridge iframe ready:", event.data);
4287
4261
  window.removeEventListener("message", checkReady);
4262
+ window.removeEventListener("message", transferData);
4288
4263
  clearTimeout(readyTimeout);
4289
4264
  this.connected = true;
4265
+ this.isInitialized = true;
4290
4266
  if (onLoad) {
4291
4267
  onLoad();
4292
4268
  }
@@ -4579,10 +4555,17 @@ class EnhancedBaseBridge extends BaseBridge {
4579
4555
  log$m.debug(
4580
4556
  "Iframe created but connection not established, waiting for CSP violation detection..."
4581
4557
  );
4582
- await this.cspViolationPromise;
4583
- log$m.debug(
4584
- "CSP violation detection completed (or connection established)"
4558
+ const cspTimeout = new Promise(
4559
+ (resolve) => setTimeout(resolve, CSP_WAIT_TIMEOUT_MS)
4585
4560
  );
4561
+ await Promise.race([this.cspViolationPromise, cspTimeout]);
4562
+ if (this.cspViolationDetected) {
4563
+ log$m.debug("CSP violation detected during wait");
4564
+ } else {
4565
+ log$m.warn(
4566
+ "CSP violation wait timed out - no CSP violation detected, connection may have been slow"
4567
+ );
4568
+ }
4586
4569
  }
4587
4570
  }
4588
4571
  }
@@ -5479,7 +5462,6 @@ class TPVLegacySDK {
5479
5462
  }
5480
5463
  }
5481
5464
  function getCapabilities(_platform) {
5482
- const uhdSupport = detect3DUHDSupport();
5483
5465
  const browserCapabilities = detectBrowserCapabilities();
5484
5466
  const streamingSupport = detectStreamingSupport();
5485
5467
  const drmMethodSupport = detectDRMMethodSupport();
@@ -5524,10 +5506,10 @@ function getCapabilities(_platform) {
5524
5506
  capabilities.supportHDR_DV = false;
5525
5507
  capabilities.supportDolbyAtmos = false;
5526
5508
  capabilities.supportHDR_HDR10Plus = false;
5509
+ capabilities.supportUHD = false;
5527
5510
  }
5528
5511
  return {
5529
5512
  ...capabilities,
5530
- ...uhdSupport,
5531
5513
  ...browserCapabilities,
5532
5514
  ...streamingSupport,
5533
5515
  ...drmMethodSupport,
@@ -6876,10 +6858,9 @@ class VestelBridge extends EnhancedBaseBridge {
6876
6858
  if (config?.gatewayUrl) {
6877
6859
  super({ gatewayUrl: config.gatewayUrl });
6878
6860
  } else {
6879
- const isDev01 = window.location.hostname.includes("dev01.devview");
6880
- const isDevEnv = window.location.hostname.startsWith("dev");
6861
+ const isDevEnv = /dev\d{2}\./.test(window.location.hostname);
6881
6862
  super({
6882
- gatewayUrl: `http://localhost:4660/gateway/${isDev01 || isDevEnv ? "dev01" : "index"}.html`
6863
+ gatewayUrl: `http://localhost:4660/gateway/${isDevEnv ? "dev01" : "index"}.html`
6883
6864
  });
6884
6865
  }
6885
6866
  }