@npaw/forge-web 10.0.0 → 10.0.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.
Binary file
package/dist/index.cjs CHANGED
@@ -4684,6 +4684,9 @@ var VideoAdapter = class {
4684
4684
  var _a, _b;
4685
4685
  (_b = (_a = this.playerAdapter) == null ? void 0 : _a.detach) == null ? void 0 : _b.call(_a);
4686
4686
  this.playerAdapter = adapter;
4687
+ if (this.playerSetupAtMs === void 0 && typeof performance !== "undefined") {
4688
+ this.playerSetupAtMs = Math.round(performance.now());
4689
+ }
4687
4690
  adapter.attach(this);
4688
4691
  }
4689
4692
  setAdAdapter(adapter) {
@@ -4847,6 +4850,7 @@ var VideoAdapter = class {
4847
4850
  this.qos = qos;
4848
4851
  }
4849
4852
  this.metadata = withoutOneShotFields(mergedMetadata, ONE_SHOT_CONTENT_FIELDS);
4853
+ applyPageContextDefaults(mergedMetadata, this.playerSetupAtMs);
4850
4854
  const command = {
4851
4855
  type: "videoEvent",
4852
4856
  event,
@@ -5169,6 +5173,17 @@ function withOptionalString(value, key, optional) {
5169
5173
  [key]: optional
5170
5174
  };
5171
5175
  }
5176
+ function applyPageContextDefaults(metadata, playerSetupAtMs) {
5177
+ if (metadata.referer === void 0 && typeof location !== "undefined" && location.href) {
5178
+ metadata.referer = sanitizeCaptureUrl(location.href);
5179
+ }
5180
+ if (metadata.referral === void 0 && typeof document !== "undefined" && document.referrer) {
5181
+ metadata.referral = sanitizeCaptureUrl(document.referrer);
5182
+ }
5183
+ if (metadata.playerStartupTimeMs === void 0 && playerSetupAtMs !== void 0) {
5184
+ metadata.playerStartupTimeMs = playerSetupAtMs;
5185
+ }
5186
+ }
5172
5187
 
5173
5188
  // src/forge.ts
5174
5189
  var _NPAWForge = class _NPAWForge {