sitepong 0.2.13 → 0.2.15

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.
@@ -2876,7 +2876,7 @@ var SitePongClient = class {
2876
2876
  }
2877
2877
  for (const hook of this.identifyHooks) {
2878
2878
  try {
2879
- hook(userId);
2879
+ hook(userId, traits);
2880
2880
  } catch (err) {
2881
2881
  this.log("identify hook failed:", err);
2882
2882
  }
@@ -2982,6 +2982,10 @@ var SitePongClient = class {
2982
2982
  flushInterval: opts.flushInterval,
2983
2983
  blockSelector: opts.blockSelector,
2984
2984
  maskSelector: opts.maskSelector,
2985
+ // Channel defaults to the SDK environment; ignoreChannels defaults to
2986
+ // ['development'] inside the capture when omitted.
2987
+ channel: opts.channel ?? this.config.environment,
2988
+ ignoreChannels: opts.ignoreChannels,
2985
2989
  debug: this.config.debug
2986
2990
  });
2987
2991
  this.watchtowerCapture.start(this.analyticsManager?.getAutocaptureModule() ?? null);
@@ -6583,6 +6587,19 @@ var PerformanceManager = class {
6583
6587
  }
6584
6588
  };
6585
6589
 
6590
+ // src/analytics/channel.ts
6591
+ function normalize(v) {
6592
+ const c = v?.trim().toLowerCase();
6593
+ return c && c.length > 0 ? c : void 0;
6594
+ }
6595
+ function resolveChannel(explicit, buildDefault) {
6596
+ return normalize(explicit) ?? buildDefault;
6597
+ }
6598
+ function isChannelSuppressed(channel, ignoreChannels) {
6599
+ const ignore = (ignoreChannels ?? ["development"]).map((c) => normalize(c)).filter((c) => c !== void 0);
6600
+ return ignore.includes(channel);
6601
+ }
6602
+
6586
6603
  // ../capture-core/dist/index.mjs
6587
6604
  var DHASH_WIDTH = 9;
6588
6605
  var DHASH_HEIGHT = 8;
@@ -6786,6 +6803,10 @@ var WatchtowerWebCapture = class {
6786
6803
  this.flushTimer = null;
6787
6804
  this.flushFailures = 0;
6788
6805
  this.disabled = false;
6806
+ /** Resolved release channel tagged on every event. */
6807
+ this.channel = "production";
6808
+ /** When true, this channel is ignored → start() is a complete no-op. */
6809
+ this.channelSuppressed = false;
6789
6810
  this.active = false;
6790
6811
  this.distinctId = null;
6791
6812
  this.currentScreen = null;
@@ -6807,6 +6828,8 @@ var WatchtowerWebCapture = class {
6807
6828
  this.config = { ...config };
6808
6829
  this.transport = config.transport || fetchTransport;
6809
6830
  this.rasterizer = config.rasterizer || null;
6831
+ this.channel = resolveChannel(config.channel, "production");
6832
+ this.channelSuppressed = isChannelSuppressed(this.channel, config.ignoreChannels);
6810
6833
  }
6811
6834
  /**
6812
6835
  * Start capturing. Pass the existing AutocaptureModule (via
@@ -6815,6 +6838,10 @@ var WatchtowerWebCapture = class {
6815
6838
  */
6816
6839
  start(source) {
6817
6840
  if (this.active || typeof window === "undefined") return;
6841
+ if (this.channelSuppressed) {
6842
+ this.log("Suppressed channel", this.channel, "\u2014 not capturing");
6843
+ return;
6844
+ }
6818
6845
  this.active = true;
6819
6846
  if (!this.rasterizer) {
6820
6847
  this.rasterizer = new DomRasterizer({
@@ -6993,7 +7020,8 @@ var WatchtowerWebCapture = class {
6993
7020
  platform: "web",
6994
7021
  app_version: this.config.appVersion || void 0,
6995
7022
  distinct_id: this.distinctId || void 0,
6996
- os_version: typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0
7023
+ os_version: typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0,
7024
+ channel: this.channel
6997
7025
  };
6998
7026
  }
6999
7027
  enqueue(event) {