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.
@@ -2872,7 +2872,7 @@ var SitePongClient = class {
2872
2872
  }
2873
2873
  for (const hook of this.identifyHooks) {
2874
2874
  try {
2875
- hook(userId);
2875
+ hook(userId, traits);
2876
2876
  } catch (err) {
2877
2877
  this.log("identify hook failed:", err);
2878
2878
  }
@@ -2978,6 +2978,10 @@ var SitePongClient = class {
2978
2978
  flushInterval: opts.flushInterval,
2979
2979
  blockSelector: opts.blockSelector,
2980
2980
  maskSelector: opts.maskSelector,
2981
+ // Channel defaults to the SDK environment; ignoreChannels defaults to
2982
+ // ['development'] inside the capture when omitted.
2983
+ channel: opts.channel ?? this.config.environment,
2984
+ ignoreChannels: opts.ignoreChannels,
2981
2985
  debug: this.config.debug
2982
2986
  });
2983
2987
  this.watchtowerCapture.start(this.analyticsManager?.getAutocaptureModule() ?? null);
@@ -6579,6 +6583,19 @@ var PerformanceManager = class {
6579
6583
  }
6580
6584
  };
6581
6585
 
6586
+ // src/analytics/channel.ts
6587
+ function normalize(v) {
6588
+ const c = v?.trim().toLowerCase();
6589
+ return c && c.length > 0 ? c : void 0;
6590
+ }
6591
+ function resolveChannel(explicit, buildDefault) {
6592
+ return normalize(explicit) ?? buildDefault;
6593
+ }
6594
+ function isChannelSuppressed(channel, ignoreChannels) {
6595
+ const ignore = (ignoreChannels ?? ["development"]).map((c) => normalize(c)).filter((c) => c !== void 0);
6596
+ return ignore.includes(channel);
6597
+ }
6598
+
6582
6599
  // ../capture-core/dist/index.mjs
6583
6600
  var DHASH_WIDTH = 9;
6584
6601
  var DHASH_HEIGHT = 8;
@@ -6782,6 +6799,10 @@ var WatchtowerWebCapture = class {
6782
6799
  this.flushTimer = null;
6783
6800
  this.flushFailures = 0;
6784
6801
  this.disabled = false;
6802
+ /** Resolved release channel tagged on every event. */
6803
+ this.channel = "production";
6804
+ /** When true, this channel is ignored → start() is a complete no-op. */
6805
+ this.channelSuppressed = false;
6785
6806
  this.active = false;
6786
6807
  this.distinctId = null;
6787
6808
  this.currentScreen = null;
@@ -6803,6 +6824,8 @@ var WatchtowerWebCapture = class {
6803
6824
  this.config = { ...config };
6804
6825
  this.transport = config.transport || fetchTransport;
6805
6826
  this.rasterizer = config.rasterizer || null;
6827
+ this.channel = resolveChannel(config.channel, "production");
6828
+ this.channelSuppressed = isChannelSuppressed(this.channel, config.ignoreChannels);
6806
6829
  }
6807
6830
  /**
6808
6831
  * Start capturing. Pass the existing AutocaptureModule (via
@@ -6811,6 +6834,10 @@ var WatchtowerWebCapture = class {
6811
6834
  */
6812
6835
  start(source) {
6813
6836
  if (this.active || typeof window === "undefined") return;
6837
+ if (this.channelSuppressed) {
6838
+ this.log("Suppressed channel", this.channel, "\u2014 not capturing");
6839
+ return;
6840
+ }
6814
6841
  this.active = true;
6815
6842
  if (!this.rasterizer) {
6816
6843
  this.rasterizer = new DomRasterizer({
@@ -6989,7 +7016,8 @@ var WatchtowerWebCapture = class {
6989
7016
  platform: "web",
6990
7017
  app_version: this.config.appVersion || void 0,
6991
7018
  distinct_id: this.distinctId || void 0,
6992
- os_version: typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0
7019
+ os_version: typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0,
7020
+ channel: this.channel
6993
7021
  };
6994
7022
  }
6995
7023
  enqueue(event) {