keystone-design-bootstrap 1.0.96 → 1.0.98

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.
@@ -58,6 +58,115 @@ function getThemedComponent(componentName, theme = "classic") {
58
58
 
59
59
  // src/contexts/ThemeContext.tsx
60
60
  import { createContext, useContext } from "react";
61
+
62
+ // src/tracking/logging.ts
63
+ import { logs } from "@opentelemetry/api-logs";
64
+ import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
65
+ import { resourceFromAttributes } from "@opentelemetry/resources";
66
+ import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
67
+ var BUILD_CONSOLE_DISABLED = process.env.NEXT_PUBLIC_LOGGING_DISABLED === "1";
68
+ var BUILD_POSTHOG_DISABLED = process.env.NEXT_PUBLIC_POSTHOG_LOGGING_DISABLED === "1";
69
+ var otelLogger = null;
70
+ var browserConsole = globalThis == null ? void 0 : globalThis["console"];
71
+ var CHANNEL_COLORS = {
72
+ // Shared diagnostics
73
+ "global-client": "#d2a8ff",
74
+ // Section pins (desktop)
75
+ "every-channel-pin": "#9febd7",
76
+ "hero-pin": "#6ecc8b",
77
+ "pricing-pin": "#399587",
78
+ "product-screens-pin": "#4fafa0",
79
+ "social-proof-pin": "#ffbb8a",
80
+ "value-props-pin": "#e0a733",
81
+ "work-pin": "#f57e56",
82
+ // Section pins (mobile)
83
+ "mobile-every-channel-pin": "#7ed9c6",
84
+ "mobile-hero-pin": "#f0eee6",
85
+ "mobile-pricing-pin": "#80d4ff",
86
+ "mobile-product-screens-pin": "#3a9085",
87
+ "mobile-social-proof-pin": "#ffd580",
88
+ "mobile-value-props-pin": "#4fafa0"
89
+ };
90
+ function flattenAttributes(input, prefix = "") {
91
+ const output = {};
92
+ for (const [key, value] of Object.entries(input)) {
93
+ const nextKey = prefix ? `${prefix}.${key}` : key;
94
+ if (value === null || value === void 0) continue;
95
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
96
+ output[nextKey] = value;
97
+ continue;
98
+ }
99
+ if (Array.isArray(value)) {
100
+ output[nextKey] = JSON.stringify(value);
101
+ continue;
102
+ }
103
+ if (typeof value === "object") {
104
+ Object.assign(output, flattenAttributes(value, nextKey));
105
+ continue;
106
+ }
107
+ output[nextKey] = String(value);
108
+ }
109
+ return output;
110
+ }
111
+ function isConsoleEnabled() {
112
+ if (BUILD_CONSOLE_DISABLED) return false;
113
+ if (typeof window === "undefined") return true;
114
+ return window.__loggingDisabled !== true;
115
+ }
116
+ function isPostHogShippingEnabled() {
117
+ if (BUILD_POSTHOG_DISABLED) return false;
118
+ if (typeof window === "undefined") return false;
119
+ return window.__posthogLoggingDisabled !== true;
120
+ }
121
+ function formatDetail(detail) {
122
+ return Object.entries(detail).map(([k, v]) => `${k}=${typeof v === "number" ? v.toFixed(4) : String(v)}`).join(" ");
123
+ }
124
+ function emitConsole(level, channel, event, detail) {
125
+ var _a, _b, _c, _d;
126
+ const color = (_a = CHANNEL_COLORS[channel]) != null ? _a : "#aaa";
127
+ const detailStr = formatDetail(detail);
128
+ const message = `%c[${channel}] %c${event}%c ${detailStr}`;
129
+ const channelStyle = `color:${color}; font-weight:bold`;
130
+ const eventStyle = level === "error" ? "color:#e94e4e; font-weight:bold" : level === "warn" ? "color:#f5a623; font-weight:bold" : "color:#fff; font-weight:bold";
131
+ const detailStyle = "color:#999; font-weight:normal";
132
+ if (level === "error") {
133
+ (_b = browserConsole == null ? void 0 : browserConsole.error) == null ? void 0 : _b.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
134
+ return;
135
+ }
136
+ if (level === "warn") {
137
+ (_c = browserConsole == null ? void 0 : browserConsole.warn) == null ? void 0 : _c.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
138
+ return;
139
+ }
140
+ (_d = browserConsole == null ? void 0 : browserConsole.log) == null ? void 0 : _d.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
141
+ }
142
+ function emitToPostHog(level, channel, event, detail) {
143
+ if (!otelLogger) return;
144
+ const severityText = level === "warn" ? "WARNING" : level === "error" ? "ERROR" : "INFO";
145
+ const attributes = flattenAttributes(__spreadValues({ channel }, detail));
146
+ otelLogger.emit({
147
+ severityText,
148
+ body: event,
149
+ attributes
150
+ });
151
+ }
152
+ function emit(level, channel, event, detail, options) {
153
+ var _a;
154
+ const shouldShip = ((_a = options == null ? void 0 : options.shipToPostHog) != null ? _a : level !== "info") && isPostHogShippingEnabled();
155
+ if (level !== "info" || isConsoleEnabled()) {
156
+ emitConsole(level, channel, event, detail);
157
+ }
158
+ if (shouldShip) {
159
+ emitToPostHog(level, channel, event, detail);
160
+ }
161
+ }
162
+ function warn(channel, event, detail = {}, options) {
163
+ emit("warn", channel, event, detail, options);
164
+ }
165
+ function error(channel, event, detail = {}, options) {
166
+ emit("error", channel, event, detail, options);
167
+ }
168
+
169
+ // src/contexts/ThemeContext.tsx
61
170
  var ThemeContext = createContext({ theme: "classic" });
62
171
  function useTheme() {
63
172
  return useContext(ThemeContext);
@@ -2394,7 +2503,9 @@ function GoogleMap({ address, locationName, className = "" }) {
2394
2503
  return;
2395
2504
  }
2396
2505
  if (!window.google.maps.Geocoder) {
2397
- console.warn("Google Maps Geocoder not yet available, retrying...");
2506
+ warn("google-map", "GEOCODER_NOT_READY_RETRYING", {
2507
+ address
2508
+ });
2398
2509
  setTimeout(() => {
2399
2510
  var _a, _b;
2400
2511
  if (mapRef.current && ((_b = (_a = window.google) == null ? void 0 : _a.maps) == null ? void 0 : _b.Geocoder) && initMapRef.current) {
@@ -2452,8 +2563,12 @@ function GoogleMap({ address, locationName, className = "" }) {
2452
2563
  }
2453
2564
  isInitializingRef.current = false;
2454
2565
  });
2455
- } catch (error) {
2456
- console.error("Error initializing map:", error);
2566
+ } catch (error2) {
2567
+ error("google-map", "MAP_INITIALIZATION_FAILED", {
2568
+ address,
2569
+ message: error2 instanceof Error ? error2.message : String(error2),
2570
+ stack: error2 instanceof Error ? error2.stack || "" : ""
2571
+ });
2457
2572
  setMapError("Error loading map. Please try again later.");
2458
2573
  isInitializingRef.current = false;
2459
2574
  }