keystone-design-bootstrap 1.0.97 → 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.
- package/dist/contexts/index.js +134 -1
- package/dist/contexts/index.js.map +1 -1
- package/dist/design_system/components/DynamicFormFields.js +130 -3
- package/dist/design_system/components/DynamicFormFields.js.map +1 -1
- package/dist/design_system/elements/index.js +130 -3
- package/dist/design_system/elements/index.js.map +1 -1
- package/dist/design_system/sections/index.js +150 -9
- package/dist/design_system/sections/index.js.map +1 -1
- package/dist/index.js +184 -21
- package/dist/index.js.map +1 -1
- package/dist/lib/server-api.js +49 -2
- package/dist/lib/server-api.js.map +1 -1
- package/dist/tracking/index.js +212 -185
- package/dist/tracking/index.js.map +1 -1
- package/package.json +1 -1
- package/src/contexts/ThemeContext.tsx +2 -1
- package/src/design_system/chat/useRealtimeReplyOrchestrator.ts +24 -5
- package/src/design_system/components/ChatWidget.tsx +10 -3
- package/src/design_system/elements/map/GoogleMap.tsx +9 -2
- package/src/design_system/sections/blog-post.tsx +13 -3
- package/src/design_system/sections/home-hero-component.tsx +4 -1
- package/src/lib/server-api.ts +6 -2
- package/src/lib/server-log.ts +39 -0
- package/src/next/routes/chat.ts +3 -2
- package/src/next/routes/form.ts +2 -1
- package/src/tracking/MetaPixel.tsx +10 -1
- package/src/tracking/firePixelEvent.ts +7 -2
- package/src/tracking/logging.ts +39 -6
|
@@ -58,6 +58,127 @@ 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 MAX_PENDING_POSTHOG_LOGS = 500;
|
|
70
|
+
var otelLogger = null;
|
|
71
|
+
var pendingPostHogLogs = [];
|
|
72
|
+
var browserConsole = globalThis == null ? void 0 : globalThis["console"];
|
|
73
|
+
var CHANNEL_COLORS = {
|
|
74
|
+
// Shared diagnostics
|
|
75
|
+
"global-client": "#d2a8ff",
|
|
76
|
+
// Section pins (desktop)
|
|
77
|
+
"every-channel-pin": "#9febd7",
|
|
78
|
+
"hero-pin": "#6ecc8b",
|
|
79
|
+
"pricing-pin": "#399587",
|
|
80
|
+
"product-screens-pin": "#4fafa0",
|
|
81
|
+
"social-proof-pin": "#ffbb8a",
|
|
82
|
+
"value-props-pin": "#e0a733",
|
|
83
|
+
"work-pin": "#f57e56",
|
|
84
|
+
// Section pins (mobile)
|
|
85
|
+
"mobile-every-channel-pin": "#7ed9c6",
|
|
86
|
+
"mobile-hero-pin": "#f0eee6",
|
|
87
|
+
"mobile-pricing-pin": "#80d4ff",
|
|
88
|
+
"mobile-product-screens-pin": "#3a9085",
|
|
89
|
+
"mobile-social-proof-pin": "#ffd580",
|
|
90
|
+
"mobile-value-props-pin": "#4fafa0"
|
|
91
|
+
};
|
|
92
|
+
function flattenAttributes(input, prefix = "") {
|
|
93
|
+
const output = {};
|
|
94
|
+
for (const [key, value] of Object.entries(input)) {
|
|
95
|
+
const nextKey = prefix ? `${prefix}.${key}` : key;
|
|
96
|
+
if (value === null || value === void 0) continue;
|
|
97
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
98
|
+
output[nextKey] = value;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
output[nextKey] = JSON.stringify(value);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (typeof value === "object") {
|
|
106
|
+
Object.assign(output, flattenAttributes(value, nextKey));
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
output[nextKey] = String(value);
|
|
110
|
+
}
|
|
111
|
+
return output;
|
|
112
|
+
}
|
|
113
|
+
function enqueuePendingPostHogLog(entry) {
|
|
114
|
+
if (pendingPostHogLogs.length >= MAX_PENDING_POSTHOG_LOGS) {
|
|
115
|
+
pendingPostHogLogs.shift();
|
|
116
|
+
}
|
|
117
|
+
pendingPostHogLogs.push(entry);
|
|
118
|
+
}
|
|
119
|
+
function isConsoleEnabled() {
|
|
120
|
+
if (BUILD_CONSOLE_DISABLED) return false;
|
|
121
|
+
if (typeof window === "undefined") return true;
|
|
122
|
+
return window.__loggingDisabled !== true;
|
|
123
|
+
}
|
|
124
|
+
function isPostHogShippingEnabled() {
|
|
125
|
+
if (BUILD_POSTHOG_DISABLED) return false;
|
|
126
|
+
if (typeof window === "undefined") return false;
|
|
127
|
+
return window.__posthogLoggingDisabled !== true;
|
|
128
|
+
}
|
|
129
|
+
function formatDetail(detail) {
|
|
130
|
+
return Object.entries(detail).map(([k, v]) => `${k}=${typeof v === "number" ? v.toFixed(4) : String(v)}`).join(" ");
|
|
131
|
+
}
|
|
132
|
+
function emitConsole(level, channel, event, detail) {
|
|
133
|
+
var _a, _b, _c, _d;
|
|
134
|
+
const color = (_a = CHANNEL_COLORS[channel]) != null ? _a : "#aaa";
|
|
135
|
+
const detailStr = formatDetail(detail);
|
|
136
|
+
const message = `%c[${channel}] %c${event}%c ${detailStr}`;
|
|
137
|
+
const channelStyle = `color:${color}; font-weight:bold`;
|
|
138
|
+
const eventStyle = level === "error" ? "color:#e94e4e; font-weight:bold" : level === "warn" ? "color:#f5a623; font-weight:bold" : "color:#fff; font-weight:bold";
|
|
139
|
+
const detailStyle = "color:#999; font-weight:normal";
|
|
140
|
+
if (level === "error") {
|
|
141
|
+
(_b = browserConsole == null ? void 0 : browserConsole.error) == null ? void 0 : _b.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (level === "warn") {
|
|
145
|
+
(_c = browserConsole == null ? void 0 : browserConsole.warn) == null ? void 0 : _c.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
(_d = browserConsole == null ? void 0 : browserConsole.log) == null ? void 0 : _d.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
|
|
149
|
+
}
|
|
150
|
+
function emitToPostHog(level, channel, event, detail) {
|
|
151
|
+
if (!otelLogger) return false;
|
|
152
|
+
const severityText = level === "warn" ? "WARNING" : level === "error" ? "ERROR" : "INFO";
|
|
153
|
+
const attributes = flattenAttributes(__spreadValues({ channel }, detail));
|
|
154
|
+
otelLogger.emit({
|
|
155
|
+
severityText,
|
|
156
|
+
body: event,
|
|
157
|
+
attributes
|
|
158
|
+
});
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
function emit(level, channel, event, detail, options) {
|
|
162
|
+
var _a;
|
|
163
|
+
const shouldShip = ((_a = options == null ? void 0 : options.shipToPostHog) != null ? _a : level !== "info") && isPostHogShippingEnabled();
|
|
164
|
+
if (level !== "info" || isConsoleEnabled()) {
|
|
165
|
+
emitConsole(level, channel, event, detail);
|
|
166
|
+
}
|
|
167
|
+
if (shouldShip) {
|
|
168
|
+
const shipped = emitToPostHog(level, channel, event, detail);
|
|
169
|
+
if (!shipped) {
|
|
170
|
+
enqueuePendingPostHogLog({ level, channel, event, detail });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function warn(channel, event, detail = {}, options) {
|
|
175
|
+
emit("warn", channel, event, detail, options);
|
|
176
|
+
}
|
|
177
|
+
function error(channel, event, detail = {}, options) {
|
|
178
|
+
emit("error", channel, event, detail, options);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// src/contexts/ThemeContext.tsx
|
|
61
182
|
var ThemeContext = createContext({ theme: "classic" });
|
|
62
183
|
function useTheme() {
|
|
63
184
|
return useContext(ThemeContext);
|
|
@@ -2394,7 +2515,9 @@ function GoogleMap({ address, locationName, className = "" }) {
|
|
|
2394
2515
|
return;
|
|
2395
2516
|
}
|
|
2396
2517
|
if (!window.google.maps.Geocoder) {
|
|
2397
|
-
|
|
2518
|
+
warn("google-map", "GEOCODER_NOT_READY_RETRYING", {
|
|
2519
|
+
address
|
|
2520
|
+
});
|
|
2398
2521
|
setTimeout(() => {
|
|
2399
2522
|
var _a, _b;
|
|
2400
2523
|
if (mapRef.current && ((_b = (_a = window.google) == null ? void 0 : _a.maps) == null ? void 0 : _b.Geocoder) && initMapRef.current) {
|
|
@@ -2452,8 +2575,12 @@ function GoogleMap({ address, locationName, className = "" }) {
|
|
|
2452
2575
|
}
|
|
2453
2576
|
isInitializingRef.current = false;
|
|
2454
2577
|
});
|
|
2455
|
-
} catch (
|
|
2456
|
-
|
|
2578
|
+
} catch (error2) {
|
|
2579
|
+
error("google-map", "MAP_INITIALIZATION_FAILED", {
|
|
2580
|
+
address,
|
|
2581
|
+
message: error2 instanceof Error ? error2.message : String(error2),
|
|
2582
|
+
stack: error2 instanceof Error ? error2.stack || "" : ""
|
|
2583
|
+
});
|
|
2457
2584
|
setMapError("Error loading map. Please try again later.");
|
|
2458
2585
|
isInitializingRef.current = false;
|
|
2459
2586
|
}
|