keystone-design-bootstrap 1.0.98 → 1.0.99

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.
@@ -66,7 +66,9 @@ import { resourceFromAttributes } from "@opentelemetry/resources";
66
66
  import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
67
67
  var BUILD_CONSOLE_DISABLED = process.env.NEXT_PUBLIC_LOGGING_DISABLED === "1";
68
68
  var BUILD_POSTHOG_DISABLED = process.env.NEXT_PUBLIC_POSTHOG_LOGGING_DISABLED === "1";
69
+ var MAX_PENDING_POSTHOG_LOGS = 500;
69
70
  var otelLogger = null;
71
+ var pendingPostHogLogs = [];
70
72
  var browserConsole = globalThis == null ? void 0 : globalThis["console"];
71
73
  var CHANNEL_COLORS = {
72
74
  // Shared diagnostics
@@ -108,6 +110,12 @@ function flattenAttributes(input, prefix = "") {
108
110
  }
109
111
  return output;
110
112
  }
113
+ function enqueuePendingPostHogLog(entry) {
114
+ if (pendingPostHogLogs.length >= MAX_PENDING_POSTHOG_LOGS) {
115
+ pendingPostHogLogs.shift();
116
+ }
117
+ pendingPostHogLogs.push(entry);
118
+ }
111
119
  function isConsoleEnabled() {
112
120
  if (BUILD_CONSOLE_DISABLED) return false;
113
121
  if (typeof window === "undefined") return true;
@@ -140,7 +148,7 @@ function emitConsole(level, channel, event, detail) {
140
148
  (_d = browserConsole == null ? void 0 : browserConsole.log) == null ? void 0 : _d.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
141
149
  }
142
150
  function emitToPostHog(level, channel, event, detail) {
143
- if (!otelLogger) return;
151
+ if (!otelLogger) return false;
144
152
  const severityText = level === "warn" ? "WARNING" : level === "error" ? "ERROR" : "INFO";
145
153
  const attributes = flattenAttributes(__spreadValues({ channel }, detail));
146
154
  otelLogger.emit({
@@ -148,6 +156,7 @@ function emitToPostHog(level, channel, event, detail) {
148
156
  body: event,
149
157
  attributes
150
158
  });
159
+ return true;
151
160
  }
152
161
  function emit(level, channel, event, detail, options) {
153
162
  var _a;
@@ -156,7 +165,10 @@ function emit(level, channel, event, detail, options) {
156
165
  emitConsole(level, channel, event, detail);
157
166
  }
158
167
  if (shouldShip) {
159
- emitToPostHog(level, channel, event, detail);
168
+ const shipped = emitToPostHog(level, channel, event, detail);
169
+ if (!shipped) {
170
+ enqueuePendingPostHogLog({ level, channel, event, detail });
171
+ }
160
172
  }
161
173
  }
162
174
  function warn(channel, event, detail = {}, options) {