keystone-design-bootstrap 1.0.98 → 1.0.100

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.
@@ -72,7 +72,9 @@ import { resourceFromAttributes } from "@opentelemetry/resources";
72
72
  import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
73
73
  var BUILD_CONSOLE_DISABLED = process.env.NEXT_PUBLIC_LOGGING_DISABLED === "1";
74
74
  var BUILD_POSTHOG_DISABLED = process.env.NEXT_PUBLIC_POSTHOG_LOGGING_DISABLED === "1";
75
+ var MAX_PENDING_POSTHOG_LOGS = 500;
75
76
  var otelLogger = null;
77
+ var pendingPostHogLogs = [];
76
78
  var browserConsole = globalThis == null ? void 0 : globalThis["console"];
77
79
  var CHANNEL_COLORS = {
78
80
  // Shared diagnostics
@@ -114,6 +116,12 @@ function flattenAttributes(input, prefix = "") {
114
116
  }
115
117
  return output;
116
118
  }
119
+ function enqueuePendingPostHogLog(entry) {
120
+ if (pendingPostHogLogs.length >= MAX_PENDING_POSTHOG_LOGS) {
121
+ pendingPostHogLogs.shift();
122
+ }
123
+ pendingPostHogLogs.push(entry);
124
+ }
117
125
  function isConsoleEnabled() {
118
126
  if (BUILD_CONSOLE_DISABLED) return false;
119
127
  if (typeof window === "undefined") return true;
@@ -146,7 +154,7 @@ function emitConsole(level, channel, event, detail) {
146
154
  (_d = browserConsole == null ? void 0 : browserConsole.log) == null ? void 0 : _d.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
147
155
  }
148
156
  function emitToPostHog(level, channel, event, detail) {
149
- if (!otelLogger) return;
157
+ if (!otelLogger) return false;
150
158
  const severityText = level === "warn" ? "WARNING" : level === "error" ? "ERROR" : "INFO";
151
159
  const attributes = flattenAttributes(__spreadValues({ channel }, detail));
152
160
  otelLogger.emit({
@@ -154,6 +162,7 @@ function emitToPostHog(level, channel, event, detail) {
154
162
  body: event,
155
163
  attributes
156
164
  });
165
+ return true;
157
166
  }
158
167
  function emit(level, channel, event, detail, options) {
159
168
  var _a;
@@ -162,7 +171,10 @@ function emit(level, channel, event, detail, options) {
162
171
  emitConsole(level, channel, event, detail);
163
172
  }
164
173
  if (shouldShip) {
165
- emitToPostHog(level, channel, event, detail);
174
+ const shipped = emitToPostHog(level, channel, event, detail);
175
+ if (!shipped) {
176
+ enqueuePendingPostHogLog({ level, channel, event, detail });
177
+ }
166
178
  }
167
179
  }
168
180
  function log(channel, event, detail = {}, options) {