@arcware-cloud/pixelstreaming-websdk 1.3.13 → 1.3.16

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/README.md CHANGED
@@ -80,6 +80,11 @@ For more detailed examples and advanced usage, please refer to our documentation
80
80
 
81
81
  # Changelog
82
82
 
83
+ ### 1.3.16
84
+
85
+ - added white labeling options for loader icon and screen
86
+ - options can be loaded via base64 encoded string in URL, fetched via API (configured on platform) or set as properties on the SDK
87
+
83
88
  ### 1.3.12
84
89
 
85
90
  - added orientationZoom field for managing zoom
package/index.cjs.js CHANGED
@@ -23353,11 +23353,14 @@ exports.ArcwareApplication = ArcwareApplication;
23353
23353
 
23354
23354
  Object.defineProperty(exports, "__esModule", ({ value: true }));
23355
23355
  exports.ArcwareConfig = exports.DefaultUrl = void 0;
23356
+ const tslib_1 = __webpack_require__(655);
23356
23357
  const zod_1 = __webpack_require__(8754);
23357
23358
  const lib_pixelstreamingfrontend_ue5_5_1 = __webpack_require__(693);
23358
23359
  const Session_1 = __webpack_require__(2469);
23359
23360
  const ArcwareSettingsSchema_1 = __webpack_require__(5602);
23360
23361
  const whiteLabelling_1 = __webpack_require__(3545);
23362
+ const ZWhiteLabel_1 = __webpack_require__(467);
23363
+ const EventHandler_1 = __webpack_require__(3379);
23361
23364
  /** Default arcware signalling endpoint. */
23362
23365
  exports.DefaultUrl = `wss://signalling-client.ragnarok.arcware.cloud`;
23363
23366
  // The below Logger overrides can likely be removed as PSInfra 5.5 logger supports setting log verbosity
@@ -23373,6 +23376,14 @@ Logger.Error = (message: string) => {
23373
23376
  console.error(message);
23374
23377
  };*/
23375
23378
  lib_pixelstreamingfrontend_ue5_5_1.Logger.InitLogging(2, false);
23379
+ function deepEqual(a, b) {
23380
+ try {
23381
+ return JSON.stringify(a) === JSON.stringify(b);
23382
+ }
23383
+ catch (_a) {
23384
+ return false;
23385
+ }
23386
+ }
23376
23387
  class ArcwareConfig extends lib_pixelstreamingfrontend_ue5_5_1.Config {
23377
23388
  /**
23378
23389
  * Can be used to fetch projectId and shareId from the current url.
@@ -23421,7 +23432,13 @@ class ArcwareConfig extends lib_pixelstreamingfrontend_ue5_5_1.Config {
23421
23432
  if (!config.initialSettings.ss)
23422
23433
  config.initialSettings.ss = exports.DefaultUrl;
23423
23434
  super(config);
23424
- this.VERSION = "1.3.13";
23435
+ this.VERSION = "1.3.16";
23436
+ this.whiteLabellingChanged = new EventHandler_1.EventHandler();
23437
+ this.signallingWlURL = "https://signalling-client.arcware.cloud/whiteLabel/";
23438
+ console.log(config);
23439
+ if (config.envName) {
23440
+ this.signallingWlURL = `https://signalling-client.${config.envName}.arcware.cloud/whiteLabel/`;
23441
+ }
23425
23442
  this.settings = settings;
23426
23443
  this.session = new Session_1.Session();
23427
23444
  this._initialSettings = config.initialSettings;
@@ -23433,14 +23450,66 @@ class ArcwareConfig extends lib_pixelstreamingfrontend_ue5_5_1.Config {
23433
23450
  if (this.useUrlParams) {
23434
23451
  // Get the query string from URL
23435
23452
  const qs = new URLSearchParams(window.location.search);
23436
- // Retrieve image loading from there
23437
- const wlParsed = this.useUrlParams ? (0, whiteLabelling_1.readWhiteLabelFromQuery)(qs) : undefined; // respect useUrlParams
23438
- if (wlParsed) {
23439
- this.settings.whiteLabelling = Object.assign(Object.assign({}, ((_c = this.settings.whiteLabelling) !== null && _c !== void 0 ? _c : {})), wlParsed);
23453
+ if (qs.has("wl") && qs.get("wl") !== "") {
23454
+ // Retrieve image loading from there
23455
+ const wlParsed = this.useUrlParams ? (0, whiteLabelling_1.readWhiteLabelFromQuery)(qs) : undefined; // respect useUrlParams
23456
+ if (wlParsed) {
23457
+ this.settings.whiteLabelling = Object.assign(Object.assign({}, ((_c = this.settings.whiteLabelling) !== null && _c !== void 0 ? _c : {})), wlParsed);
23458
+ }
23440
23459
  }
23441
23460
  this.settings.infoButton = qs.has("i") || qs.has("info");
23442
23461
  }
23443
23462
  }
23463
+ getWhiteLabelling(ShareId) {
23464
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23465
+ const qs = new URLSearchParams(window.location.search);
23466
+ // Only fetch when wl param is present and empty (as before)
23467
+ if (!(qs.has("wl") && qs.get("wl") === ""))
23468
+ return undefined;
23469
+ // Build final URL safely (trim trailing slashes, encode ShareId)
23470
+ const base = this.signallingWlURL.replace(/\/+$/, "");
23471
+ const requestUrl = `${base}/${encodeURIComponent(ShareId)}`;
23472
+ const controller = new AbortController();
23473
+ const timeoutId = setTimeout(() => controller.abort(), 1000);
23474
+ try {
23475
+ const res = yield fetch(requestUrl, {
23476
+ method: "GET",
23477
+ signal: controller.signal,
23478
+ headers: { Accept: "application/json, text/plain" },
23479
+ credentials: "omit"
23480
+ });
23481
+ if (!res.ok)
23482
+ return undefined;
23483
+ const text = yield res.text();
23484
+ if (!text || text.trim() === "")
23485
+ return undefined;
23486
+ let json;
23487
+ try {
23488
+ json = JSON.parse(text);
23489
+ }
23490
+ catch (_a) {
23491
+ return undefined;
23492
+ }
23493
+ const parsed = ZWhiteLabel_1.ZWhiteLabel.safeParse(json);
23494
+ if (!parsed.success)
23495
+ return undefined;
23496
+ // Only apply & emit if it actually changed
23497
+ const prev = this.settings.whiteLabelling;
23498
+ const next = parsed.data;
23499
+ if (!deepEqual(prev, next)) {
23500
+ this.settings.whiteLabelling = next;
23501
+ EventHandler_1.EventHandler.Emit(this.whiteLabellingChanged, next);
23502
+ }
23503
+ return parsed.data;
23504
+ }
23505
+ catch (_b) {
23506
+ return undefined;
23507
+ }
23508
+ finally {
23509
+ clearTimeout(timeoutId);
23510
+ }
23511
+ });
23512
+ }
23444
23513
  /** Setup connection string. */
23445
23514
  get urlFlags() {
23446
23515
  var _a;
@@ -23515,6 +23584,7 @@ let globalApplication = null;
23515
23584
  let previousShareId = null;
23516
23585
  let previousProjectId = null;
23517
23586
  function ArcwareInit({ shareId, projectId }, configuration, forceRefresh = false) {
23587
+ var _a;
23518
23588
  if (shareId && !shareId.startsWith("share-"))
23519
23589
  throw new Error(`Unexpected shareId-format: '${shareId}'.`);
23520
23590
  if (shareId && previousShareId !== shareId) {
@@ -23554,7 +23624,8 @@ function ArcwareInit({ shareId, projectId }, configuration, forceRefresh = false
23554
23624
  splashScreenMode: undefined,
23555
23625
  splashScreenPosition: undefined,
23556
23626
  splashScreenBgColor: undefined
23557
- } }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23627
+ } }, configuration === null || configuration === void 0 ? void 0 : configuration.settings),
23628
+ envName: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.envName) !== null && _a !== void 0 ? _a : undefined
23558
23629
  });
23559
23630
  const PixelStreaming = new ArcwarePixelStreaming_1.ArcwarePixelStreaming(Config);
23560
23631
  const Application = new ArcwareApplication_1.ArcwareApplication({ stream: PixelStreaming });
@@ -23722,6 +23793,32 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
23722
23793
  });
23723
23794
  // Set override config.
23724
23795
  this.config = config;
23796
+ // Re-apply branding whenever config's WL changes
23797
+ this.config.whiteLabellingChanged.add(() => {
23798
+ try {
23799
+ this.applyBrandingFromSettings();
23800
+ }
23801
+ catch (_a) { }
23802
+ });
23803
+ // Kick off WL fetch once (if we have a shareId); on success it will emit and re-apply
23804
+ (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
23805
+ try {
23806
+ const sid = this.config.settings.shareId;
23807
+ if (sid) {
23808
+ yield this.config.getWhiteLabelling(sid); // will emit if it changes
23809
+ }
23810
+ }
23811
+ catch (_d) {
23812
+ // ignore
23813
+ }
23814
+ finally {
23815
+ // Make sure we paint with whatever we have initially
23816
+ try {
23817
+ this.applyBrandingFromSettings();
23818
+ }
23819
+ catch (_e) { }
23820
+ }
23821
+ }))();
23725
23822
  this.loveLettersList = [];
23726
23823
  this.microphoneOverlay = new MicrophoneOverlay_1.MicrophoneOverlay(this);
23727
23824
  this.diagnosticsCollector = new DiagnosticsCollector_1.DiagnosticsCollector({
@@ -23903,7 +24000,7 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
23903
24000
  });
23904
24001
  }
23905
24002
  }
23906
- this.applyBrandingFromSettings();
24003
+ //this.applyBrandingFromSettings();
23907
24004
  this.handleMouseLock();
23908
24005
  this.injectCustomUI();
23909
24006
  }
@@ -24245,8 +24342,6 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24245
24342
  (_a = logoLoader.setHostElement) === null || _a === void 0 ? void 0 : _a.call(logoLoader, loaderRoot);
24246
24343
  loveLettersContainer.appendChild(lettersBlock);
24247
24344
  lettersBlock.appendChild(lettersWrapper);
24248
- // apply current (local) settings immediately
24249
- this.applyBrandingFromSettings();
24250
24345
  }
24251
24346
  }
24252
24347
  pushLetter(letter) {
@@ -24361,7 +24456,7 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24361
24456
  });
24362
24457
  }
24363
24458
  applyBrandingFromSettings() {
24364
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
24459
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
24365
24460
  const cfg = ((_b = (_a = this === null || this === void 0 ? void 0 : this.config) === null || _a === void 0 ? void 0 : _a.settings.whiteLabelling) !== null && _b !== void 0 ? _b : {});
24366
24461
  // Loader image + fade
24367
24462
  try {
@@ -24370,25 +24465,36 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24370
24465
  (_f = (_e = this.logoLoader).setFade) === null || _f === void 0 ? void 0 : _f.call(_e, cfg.loadingIconFadeMs);
24371
24466
  }
24372
24467
  }
24373
- catch (_p) { }
24374
- // Splash on loveLettersContainer (preferred), fallback to player parent
24468
+ catch (_q) { }
24469
+ // Pick splash host: loveLettersContainer (preferred) or player parent
24375
24470
  try {
24376
24471
  const el = (_m = (_g = this.loveLettersContainer) !== null && _g !== void 0 ? _g : (_l = (_k = (_j = (_h = this.webRtcController) === null || _h === void 0 ? void 0 : _h.videoPlayer) === null || _j === void 0 ? void 0 : _j.getVideoParentElement) === null || _k === void 0 ? void 0 : _k.call(_j)) === null || _l === void 0 ? void 0 : _l.parentElement) !== null && _m !== void 0 ? _m : null;
24377
24472
  if (!el)
24378
24473
  return;
24379
- // Clear previous inline choices
24380
24474
  const s = el.style;
24475
+ // Nuke previous inline styles (longhands only; never touch 'background' shorthand here)
24381
24476
  s.removeProperty("background-image");
24382
24477
  s.removeProperty("background-size");
24383
24478
  s.removeProperty("background-repeat");
24384
24479
  s.removeProperty("background-position");
24385
24480
  s.removeProperty("background-color");
24481
+ // Also clear any earlier 'background' inline shorthand that might have been set elsewhere
24482
+ // (we set to 'initial' first, then re-apply longhands)
24483
+ s.setProperty("background", "initial");
24386
24484
  el.classList.remove("aw-splash");
24387
- if (cfg.splashScreenUrl) {
24388
- el.classList.add("aw-splash"); // keeps your global defaults
24389
- // Compute mode (default to 'contain' if not provided)
24390
- const mode = ((_o = cfg.splashScreenMode) !== null && _o !== void 0 ? _o : "contain");
24391
- // Apply sizing/repeat per mode
24485
+ // If neither color nor image is provided, nothing to do
24486
+ const haveColor = !!cfg.splashScreenBgColor;
24487
+ const haveImage = !!cfg.splashScreenUrl;
24488
+ if (!haveColor && !haveImage)
24489
+ return;
24490
+ // Always ensure our class is present when we brand
24491
+ el.classList.add("aw-splash");
24492
+ // Apply color with !important so external 'background: ... !important' can't wipe it
24493
+ const bgColor = (_o = cfg.splashScreenBgColor) !== null && _o !== void 0 ? _o : "var(--color0)";
24494
+ s.setProperty("background-color", bgColor, "important");
24495
+ if (haveImage) {
24496
+ // Mode → size/repeat mapping
24497
+ const mode = ((_p = cfg.splashScreenMode) !== null && _p !== void 0 ? _p : "contain");
24392
24498
  switch (mode) {
24393
24499
  case "contain":
24394
24500
  s.backgroundSize = "contain";
@@ -24403,17 +24509,25 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24403
24509
  s.backgroundRepeat = "no-repeat";
24404
24510
  break;
24405
24511
  case "repeat":
24406
- s.backgroundSize = "auto"; // keep intrinsic px
24512
+ s.backgroundSize = "auto"; // intrinsic
24407
24513
  s.backgroundRepeat = "repeat";
24408
24514
  break;
24409
24515
  }
24410
- // Position & color (optional)
24516
+ // Position
24411
24517
  s.backgroundPosition = cfg.splashScreenPosition || "center center";
24412
- s.backgroundColor = cfg.splashScreenBgColor || "var(--color0)";
24518
+ // Image last (longhand so it won't reset color)
24519
+ // Use quotes to be safe with URLs containing parentheses/spaces
24413
24520
  s.backgroundImage = `url("${cfg.splashScreenUrl}")`;
24414
24521
  }
24522
+ else {
24523
+ // No image → ensure any previous image is cleared
24524
+ s.backgroundImage = "none";
24525
+ s.backgroundRepeat = "no-repeat";
24526
+ s.backgroundPosition = "center center";
24527
+ s.backgroundSize = "auto";
24528
+ }
24415
24529
  }
24416
- catch (_q) { }
24530
+ catch (_r) { }
24417
24531
  }
24418
24532
  }
24419
24533
  exports.ArcwarePixelStreaming = ArcwarePixelStreaming;
@@ -24429,6 +24543,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
24429
24543
  exports.ArcwareSettingsSchema = void 0;
24430
24544
  const zod_1 = __webpack_require__(8754);
24431
24545
  const shared_pixelstreaming_websdk_1 = __webpack_require__(7910);
24546
+ const ZWhiteLabel_1 = __webpack_require__(467);
24432
24547
  /** Arcware Settings. */
24433
24548
  exports.ArcwareSettingsSchema = zod_1.z.object({
24434
24549
  /** Overwrites the Session-Tool and uses the provided session instead. */
@@ -24487,7 +24602,7 @@ exports.ArcwareSettingsSchema = zod_1.z.object({
24487
24602
  .strict()
24488
24603
  .optional(),
24489
24604
  /** Loader customization */
24490
- whiteLabelling: shared_pixelstreaming_websdk_1.ZWhiteLabel.optional()
24605
+ whiteLabelling: ZWhiteLabel_1.ZWhiteLabel.optional()
24491
24606
  });
24492
24607
 
24493
24608
 
@@ -25278,6 +25393,40 @@ class DiagnosticsCollector {
25278
25393
  exports.DiagnosticsCollector = DiagnosticsCollector;
25279
25394
 
25280
25395
 
25396
+ /***/ }),
25397
+
25398
+ /***/ 467:
25399
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
25400
+
25401
+
25402
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
25403
+ exports.ZWhiteLabel = void 0;
25404
+ const zod_1 = __webpack_require__(8754);
25405
+ /** Absolute HTTPS URL (no http) */
25406
+ const AbsoluteHttpsUrl = zod_1.z
25407
+ .string()
25408
+ .url()
25409
+ .refine((u) => u.startsWith("https://"), { message: "URL must use https://" });
25410
+ /** Relative path (no scheme like http:, data:, javascript:, etc.) */
25411
+ const RelativePath = zod_1.z
25412
+ .string()
25413
+ .min(1)
25414
+ .refine((s) => !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(s), { message: "Expected a relative path without a URL scheme" });
25415
+ /** Image URL can be absolute (https) or relative (e.g. /assets/logo.png, ./img.png) */
25416
+ const ImageUrl = zod_1.z.union([AbsoluteHttpsUrl, RelativePath]);
25417
+ /** Strict allowlist for white-label brand fields coming from the URL */
25418
+ exports.ZWhiteLabel = zod_1.z
25419
+ .object({
25420
+ loadingIconUrl: ImageUrl.optional(),
25421
+ loadingIconFadeMs: zod_1.z.number().int().positive().optional(),
25422
+ splashScreenUrl: ImageUrl.optional(),
25423
+ splashScreenMode: zod_1.z.enum(["contain", "cover", "stretch", "repeat"]).optional(),
25424
+ splashScreenPosition: zod_1.z.string().optional(),
25425
+ splashScreenBgColor: zod_1.z.string().optional()
25426
+ })
25427
+ .strict();
25428
+
25429
+
25281
25430
  /***/ }),
25282
25431
 
25283
25432
  /***/ 2483:
@@ -25414,7 +25563,7 @@ exports.waitForElement = waitForElement;
25414
25563
 
25415
25564
  Object.defineProperty(exports, "__esModule", ({ value: true }));
25416
25565
  exports.readWhiteLabelFromQuery = void 0;
25417
- const shared_pixelstreaming_websdk_1 = __webpack_require__(7910);
25566
+ const ZWhiteLabel_1 = __webpack_require__(467);
25418
25567
  function decodeBase64OrBase64Url(raw) {
25419
25568
  const normalized = raw.replace(/-/g, "+").replace(/_/g, "/");
25420
25569
  const padded = normalized + "===".slice((normalized.length + 3) % 4);
@@ -25425,14 +25574,13 @@ function decodeBase64OrBase64Url(raw) {
25425
25574
  }
25426
25575
  /** Parse ?wl=... (or ?whitelabel=...) → validated partial settings */
25427
25576
  function readWhiteLabelFromQuery(qs) {
25428
- var _a;
25429
25577
  try {
25430
- const raw = (_a = qs.get("wl")) !== null && _a !== void 0 ? _a : qs.get("whitelabel");
25578
+ const raw = qs.get("wl");
25431
25579
  if (!raw)
25432
25580
  return undefined;
25433
25581
  const jsonStr = decodeBase64OrBase64Url(raw);
25434
25582
  const obj = JSON.parse(jsonStr);
25435
- const parsed = shared_pixelstreaming_websdk_1.ZWhiteLabel.safeParse(obj);
25583
+ const parsed = ZWhiteLabel_1.ZWhiteLabel.safeParse(obj);
25436
25584
  if (!parsed.success) {
25437
25585
  //console.warn("[ArcwareConfig] Invalid wl payload:", parsed.error?.flatten?.());
25438
25586
  return undefined;
@@ -27146,40 +27294,6 @@ exports.Send = {
27146
27294
  };
27147
27295
 
27148
27296
 
27149
- /***/ }),
27150
-
27151
- /***/ 6750:
27152
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
27153
-
27154
-
27155
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27156
- exports.ZWhiteLabel = void 0;
27157
- const zod_1 = __webpack_require__(8754);
27158
- /** Absolute HTTPS URL (no http) */
27159
- const AbsoluteHttpsUrl = zod_1.z
27160
- .string()
27161
- .url()
27162
- .refine((u) => u.startsWith("https://"), { message: "URL must use https://" });
27163
- /** Relative path (no scheme like http:, data:, javascript:, etc.) */
27164
- const RelativePath = zod_1.z
27165
- .string()
27166
- .min(1)
27167
- .refine((s) => !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(s), { message: "Expected a relative path without a URL scheme" });
27168
- /** Image URL can be absolute (https) or relative (e.g. /assets/logo.png, ./img.png) */
27169
- const ImageUrl = zod_1.z.union([AbsoluteHttpsUrl, RelativePath]);
27170
- /** Strict allowlist for white-label brand fields coming from the URL */
27171
- exports.ZWhiteLabel = zod_1.z
27172
- .object({
27173
- loadingIconUrl: ImageUrl.optional(),
27174
- loadingIconFadeMs: zod_1.z.number().int().positive().optional(),
27175
- splashScreenUrl: ImageUrl.optional(),
27176
- splashScreenMode: zod_1.z.enum(["contain", "cover", "stretch", "repeat"]).optional(),
27177
- splashScreenPosition: zod_1.z.string().optional(),
27178
- splashScreenBgColor: zod_1.z.string().optional()
27179
- })
27180
- .strict();
27181
-
27182
-
27183
27297
  /***/ }),
27184
27298
 
27185
27299
  /***/ 318:
@@ -27187,10 +27301,8 @@ exports.ZWhiteLabel = zod_1.z
27187
27301
 
27188
27302
 
27189
27303
  Object.defineProperty(exports, "__esModule", ({ value: true }));
27190
- exports.ZWhiteLabel = exports.Messages = void 0;
27304
+ exports.Messages = void 0;
27191
27305
  exports.Messages = __webpack_require__(5387);
27192
- var ZWhiteLabel_1 = __webpack_require__(6750);
27193
- Object.defineProperty(exports, "ZWhiteLabel", ({ enumerable: true, get: function () { return ZWhiteLabel_1.ZWhiteLabel; } }));
27194
27306
 
27195
27307
 
27196
27308
  /***/ }),