keystone-design-bootstrap 1.0.102 → 1.0.104
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/README.md +4 -4
- package/dist/blog-post-vWzW8yFb.d.ts +50 -0
- package/dist/contexts/index.d.ts +13 -0
- package/dist/contexts/index.js +173 -0
- package/dist/contexts/index.js.map +1 -0
- package/dist/design_system/components/DynamicFormFields.d.ts +15 -0
- package/dist/design_system/components/DynamicFormFields.js +5176 -0
- package/dist/design_system/components/DynamicFormFields.js.map +1 -0
- package/dist/design_system/elements/index.d.ts +383 -0
- package/dist/design_system/elements/index.js +4007 -0
- package/dist/design_system/elements/index.js.map +1 -0
- package/dist/design_system/logo/keystone-logo.d.ts +6 -0
- package/dist/design_system/logo/keystone-logo.js +145 -0
- package/dist/design_system/logo/keystone-logo.js.map +1 -0
- package/dist/design_system/sections/index.d.ts +233 -0
- package/dist/design_system/sections/index.js +20048 -0
- package/dist/design_system/sections/index.js.map +1 -0
- package/dist/form-C94A_PX_.d.ts +36 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +20608 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/component-registry.d.ts +13 -0
- package/dist/lib/component-registry.js +36 -0
- package/dist/lib/component-registry.js.map +1 -0
- package/dist/lib/hooks/index.d.ts +83 -0
- package/dist/lib/hooks/index.js +182 -0
- package/dist/lib/hooks/index.js.map +1 -0
- package/dist/lib/server-api.d.ts +67 -0
- package/dist/lib/server-api.js +195 -0
- package/dist/lib/server-api.js.map +1 -0
- package/dist/package-DeHKpQp7.d.ts +121 -0
- package/dist/photos-CmBdWiuZ.d.ts +27 -0
- package/dist/themes/index.d.ts +17 -0
- package/dist/themes/index.js +29 -0
- package/dist/themes/index.js.map +1 -0
- package/dist/tracking/index.d.ts +254 -0
- package/dist/tracking/index.js +587 -0
- package/dist/tracking/index.js.map +1 -0
- package/dist/types/index.d.ts +313 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cx.d.ts +15 -0
- package/dist/utils/cx.js +18 -0
- package/dist/utils/cx.js.map +1 -0
- package/dist/utils/gradient-placeholder.d.ts +7 -0
- package/dist/utils/gradient-placeholder.js +59 -0
- package/dist/utils/gradient-placeholder.js.map +1 -0
- package/dist/utils/is-react-component.d.ts +21 -0
- package/dist/utils/is-react-component.js +20 -0
- package/dist/utils/is-react-component.js.map +1 -0
- package/dist/utils/markdown-toc.d.ts +14 -0
- package/dist/utils/markdown-toc.js +29 -0
- package/dist/utils/markdown-toc.js.map +1 -0
- package/dist/utils/phone-helpers.d.ts +24 -0
- package/dist/utils/phone-helpers.js +26 -0
- package/dist/utils/phone-helpers.js.map +1 -0
- package/dist/utils/photo-helpers.d.ts +38 -0
- package/dist/utils/photo-helpers.js +41 -0
- package/dist/utils/photo-helpers.js.map +1 -0
- package/dist/website-photos-Cl1YqAno.d.ts +21 -0
- package/package.json +1 -1
- package/src/lib/consumer-session.ts +3 -1
- package/src/next/routes/consumer-auth.ts +47 -39
package/README.md
CHANGED
|
@@ -27,9 +27,10 @@ The shared design system and runtime package powering all Keystone customer webs
|
|
|
27
27
|
# .env.local
|
|
28
28
|
API_URL=http://localhost:3000/api/v1
|
|
29
29
|
API_KEY=your-api-key-here
|
|
30
|
-
|
|
31
|
-
#
|
|
32
|
-
|
|
30
|
+
|
|
31
|
+
# Optional: point consumer auth/session endpoints at a dedicated auth service
|
|
32
|
+
# (e.g. Heimdal) when they don't live on API_URL. Same API_KEY is used.
|
|
33
|
+
# AUTH_API_URL=https://auth.localkeystone.com/api/v1
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
### 2. Config
|
|
@@ -195,7 +196,6 @@ Data fetching works the same as any other site. All functions are server-only (u
|
|
|
195
196
|
```
|
|
196
197
|
API_URL=http://localhost:3000/api/v1
|
|
197
198
|
API_KEY=your-api-key-here
|
|
198
|
-
CONSUMER_AUTH_URL=https://www.keystone.app/api/consumer
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
**Fetch data for a page — always use `Promise.all` to avoid waterfall requests:**
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { P as PhotoAttachment } from './photos-CmBdWiuZ.js';
|
|
2
|
+
|
|
3
|
+
interface BlogPost {
|
|
4
|
+
id: number;
|
|
5
|
+
title: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
status: string;
|
|
8
|
+
published_at?: string;
|
|
9
|
+
excerpt_markdown?: string;
|
|
10
|
+
content_markdown: string;
|
|
11
|
+
featured: boolean;
|
|
12
|
+
seo_title?: string;
|
|
13
|
+
seo_description?: string;
|
|
14
|
+
seo_keywords?: string;
|
|
15
|
+
created_at: string;
|
|
16
|
+
updated_at: string;
|
|
17
|
+
photo_attachments?: PhotoAttachment[];
|
|
18
|
+
blog_post_authors?: BlogPostAuthor[];
|
|
19
|
+
blog_post_tags?: BlogPostTag[];
|
|
20
|
+
}
|
|
21
|
+
interface BlogPostParams {
|
|
22
|
+
status?: string;
|
|
23
|
+
author_id?: number;
|
|
24
|
+
tag_id?: number;
|
|
25
|
+
q?: string;
|
|
26
|
+
page?: number;
|
|
27
|
+
per_page?: number;
|
|
28
|
+
featured?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type BlogPostResponse = BlogPost[];
|
|
31
|
+
interface BlogPostAuthor {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
bio_markdown?: string;
|
|
36
|
+
active: boolean;
|
|
37
|
+
created_at: string;
|
|
38
|
+
updated_at: string;
|
|
39
|
+
photo_attachments?: PhotoAttachment[];
|
|
40
|
+
}
|
|
41
|
+
interface BlogPostTag {
|
|
42
|
+
id: number;
|
|
43
|
+
name: string;
|
|
44
|
+
slug: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
created_at: string;
|
|
47
|
+
updated_at: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type { BlogPost as B, BlogPostAuthor as a, BlogPostParams as b, BlogPostResponse as c, BlogPostTag as d };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { Theme } from '../themes/index.js';
|
|
3
|
+
|
|
4
|
+
interface ThemeContextValue {
|
|
5
|
+
theme: Theme;
|
|
6
|
+
}
|
|
7
|
+
declare function ThemeProvider({ theme, children }: {
|
|
8
|
+
theme: Theme;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): React$1.JSX.Element;
|
|
11
|
+
declare function useTheme(): ThemeContextValue;
|
|
12
|
+
|
|
13
|
+
export { ThemeProvider, useTheme };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/contexts/ThemeContext.tsx
|
|
19
|
+
import { createContext, useContext } from "react";
|
|
20
|
+
|
|
21
|
+
// src/themes/index.ts
|
|
22
|
+
var THEME_CONFIG = {
|
|
23
|
+
classic: "",
|
|
24
|
+
// Base files with no suffix (hero-home.tsx)
|
|
25
|
+
aman: ".aman",
|
|
26
|
+
// Aman Hotels variant files (hero-home.aman.tsx)
|
|
27
|
+
barelux: ".barelux",
|
|
28
|
+
// Bare Lux Studio variant files (hero-home.barelux.tsx)
|
|
29
|
+
balance: ".balance",
|
|
30
|
+
// Balance Aesthetics variant files (hero-home.balance.tsx)
|
|
31
|
+
custom: ""
|
|
32
|
+
// Fully custom sites — no design-system CSS loaded, all styling built in the site itself
|
|
33
|
+
};
|
|
34
|
+
function isValidTheme(theme) {
|
|
35
|
+
return theme in THEME_CONFIG;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/tracking/logging.ts
|
|
39
|
+
import { logs } from "@opentelemetry/api-logs";
|
|
40
|
+
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
|
41
|
+
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
42
|
+
import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
43
|
+
var BUILD_CONSOLE_DISABLED = process.env.NEXT_PUBLIC_LOGGING_DISABLED === "1";
|
|
44
|
+
var BUILD_POSTHOG_DISABLED = process.env.NEXT_PUBLIC_POSTHOG_LOGGING_DISABLED === "1";
|
|
45
|
+
var MAX_PENDING_POSTHOG_LOGS = 500;
|
|
46
|
+
var otelLogger = null;
|
|
47
|
+
var pendingPostHogLogs = [];
|
|
48
|
+
var browserConsole = globalThis == null ? void 0 : globalThis["console"];
|
|
49
|
+
var CHANNEL_COLORS = {
|
|
50
|
+
// Shared diagnostics
|
|
51
|
+
"global-client": "#d2a8ff",
|
|
52
|
+
// Section pins (desktop)
|
|
53
|
+
"every-channel-pin": "#9febd7",
|
|
54
|
+
"hero-pin": "#6ecc8b",
|
|
55
|
+
"pricing-pin": "#399587",
|
|
56
|
+
"product-screens-pin": "#4fafa0",
|
|
57
|
+
"social-proof-pin": "#ffbb8a",
|
|
58
|
+
"value-props-pin": "#e0a733",
|
|
59
|
+
"work-pin": "#f57e56",
|
|
60
|
+
// Section pins (mobile)
|
|
61
|
+
"mobile-every-channel-pin": "#7ed9c6",
|
|
62
|
+
"mobile-hero-pin": "#f0eee6",
|
|
63
|
+
"mobile-pricing-pin": "#80d4ff",
|
|
64
|
+
"mobile-product-screens-pin": "#3a9085",
|
|
65
|
+
"mobile-social-proof-pin": "#ffd580",
|
|
66
|
+
"mobile-value-props-pin": "#4fafa0"
|
|
67
|
+
};
|
|
68
|
+
function flattenAttributes(input, prefix = "") {
|
|
69
|
+
const output = {};
|
|
70
|
+
for (const [key, value] of Object.entries(input)) {
|
|
71
|
+
const nextKey = prefix ? `${prefix}.${key}` : key;
|
|
72
|
+
if (value === null || value === void 0) continue;
|
|
73
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
74
|
+
output[nextKey] = value;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(value)) {
|
|
78
|
+
output[nextKey] = JSON.stringify(value);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (typeof value === "object") {
|
|
82
|
+
Object.assign(output, flattenAttributes(value, nextKey));
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
output[nextKey] = String(value);
|
|
86
|
+
}
|
|
87
|
+
return output;
|
|
88
|
+
}
|
|
89
|
+
function enqueuePendingPostHogLog(entry) {
|
|
90
|
+
if (pendingPostHogLogs.length >= MAX_PENDING_POSTHOG_LOGS) {
|
|
91
|
+
pendingPostHogLogs.shift();
|
|
92
|
+
}
|
|
93
|
+
pendingPostHogLogs.push(entry);
|
|
94
|
+
}
|
|
95
|
+
function isConsoleEnabled() {
|
|
96
|
+
if (BUILD_CONSOLE_DISABLED) return false;
|
|
97
|
+
if (typeof window === "undefined") return true;
|
|
98
|
+
return window.__loggingDisabled !== true;
|
|
99
|
+
}
|
|
100
|
+
function isPostHogShippingEnabled() {
|
|
101
|
+
if (BUILD_POSTHOG_DISABLED) return false;
|
|
102
|
+
if (typeof window === "undefined") return false;
|
|
103
|
+
return window.__posthogLoggingDisabled !== true;
|
|
104
|
+
}
|
|
105
|
+
function formatDetail(detail) {
|
|
106
|
+
return Object.entries(detail).map(([k, v]) => `${k}=${typeof v === "number" ? v.toFixed(4) : String(v)}`).join(" ");
|
|
107
|
+
}
|
|
108
|
+
function emitConsole(level, channel, event, detail) {
|
|
109
|
+
var _a, _b, _c, _d;
|
|
110
|
+
const color = (_a = CHANNEL_COLORS[channel]) != null ? _a : "#aaa";
|
|
111
|
+
const detailStr = formatDetail(detail);
|
|
112
|
+
const message = `%c[${channel}] %c${event}%c ${detailStr}`;
|
|
113
|
+
const channelStyle = `color:${color}; font-weight:bold`;
|
|
114
|
+
const eventStyle = level === "error" ? "color:#e94e4e; font-weight:bold" : level === "warn" ? "color:#f5a623; font-weight:bold" : "color:#fff; font-weight:bold";
|
|
115
|
+
const detailStyle = "color:#999; font-weight:normal";
|
|
116
|
+
if (level === "error") {
|
|
117
|
+
(_b = browserConsole == null ? void 0 : browserConsole.error) == null ? void 0 : _b.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (level === "warn") {
|
|
121
|
+
(_c = browserConsole == null ? void 0 : browserConsole.warn) == null ? void 0 : _c.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
(_d = browserConsole == null ? void 0 : browserConsole.log) == null ? void 0 : _d.call(browserConsole, message, channelStyle, eventStyle, detailStyle);
|
|
125
|
+
}
|
|
126
|
+
function emitToPostHog(level, channel, event, detail) {
|
|
127
|
+
if (!otelLogger) return false;
|
|
128
|
+
const severityText = level === "warn" ? "WARNING" : level === "error" ? "ERROR" : "INFO";
|
|
129
|
+
const attributes = flattenAttributes(__spreadValues({ channel }, detail));
|
|
130
|
+
otelLogger.emit({
|
|
131
|
+
severityText,
|
|
132
|
+
body: event,
|
|
133
|
+
attributes
|
|
134
|
+
});
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
function emit(level, channel, event, detail, options) {
|
|
138
|
+
var _a;
|
|
139
|
+
const shouldShip = ((_a = options == null ? void 0 : options.shipToPostHog) != null ? _a : level !== "info") && isPostHogShippingEnabled();
|
|
140
|
+
if (level !== "info" || isConsoleEnabled()) {
|
|
141
|
+
emitConsole(level, channel, event, detail);
|
|
142
|
+
}
|
|
143
|
+
if (shouldShip) {
|
|
144
|
+
const shipped = emitToPostHog(level, channel, event, detail);
|
|
145
|
+
if (!shipped) {
|
|
146
|
+
enqueuePendingPostHogLog({ level, channel, event, detail });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function warn(channel, event, detail = {}, options) {
|
|
151
|
+
emit("warn", channel, event, detail, options);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/contexts/ThemeContext.tsx
|
|
155
|
+
var ThemeContext = createContext({ theme: "classic" });
|
|
156
|
+
function ThemeProvider({
|
|
157
|
+
theme,
|
|
158
|
+
children
|
|
159
|
+
}) {
|
|
160
|
+
if (!isValidTheme(theme)) {
|
|
161
|
+
warn("theme", "INVALID_THEME_FALLBACK", { theme });
|
|
162
|
+
theme = "classic";
|
|
163
|
+
}
|
|
164
|
+
return /* @__PURE__ */ React.createElement(ThemeContext.Provider, { value: { theme } }, children);
|
|
165
|
+
}
|
|
166
|
+
function useTheme() {
|
|
167
|
+
return useContext(ThemeContext);
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
ThemeProvider,
|
|
171
|
+
useTheme
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/ThemeContext.tsx","../../src/themes/index.ts","../../src/tracking/logging.ts"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport { Theme, isValidTheme } from '../themes';\nimport { warn } from '../tracking/logging';\n\ninterface ThemeContextValue {\n theme: Theme;\n}\n\nconst ThemeContext = createContext<ThemeContextValue>({ theme: 'classic' });\n\nexport function ThemeProvider({ \n theme, \n children \n}: { \n theme: Theme; \n children: React.ReactNode;\n}) {\n // Validate theme at runtime\n if (!isValidTheme(theme)) {\n warn('theme', 'INVALID_THEME_FALLBACK', { theme });\n theme = 'classic';\n }\n \n return (\n <ThemeContext.Provider value={{ theme }}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n","/**\n * Theme Configuration\n * Single source of truth for all themes\n */\n\nexport const THEME_CONFIG = {\n classic: '', // Base files with no suffix (hero-home.tsx)\n aman: '.aman', // Aman Hotels variant files (hero-home.aman.tsx)\n barelux: '.barelux', // Bare Lux Studio variant files (hero-home.barelux.tsx)\n balance: '.balance', // Balance Aesthetics variant files (hero-home.balance.tsx)\n custom: '', // Fully custom sites — no design-system CSS loaded, all styling built in the site itself\n} as const;\n\nexport type Theme = keyof typeof THEME_CONFIG;\n\nexport function getAvailableThemes(): Theme[] {\n return Object.keys(THEME_CONFIG) as Theme[];\n}\n\nexport function getThemeSuffix(theme: Theme): string {\n return THEME_CONFIG[theme] || '';\n}\n\nexport function isValidTheme(theme: string): theme is Theme {\n return theme in THEME_CONFIG;\n}\n","'use client';\n\nimport { logs } from '@opentelemetry/api-logs';\nimport { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';\nimport { resourceFromAttributes } from '@opentelemetry/resources';\nimport { BatchLogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs';\n\nconst BUILD_CONSOLE_DISABLED = process.env.NEXT_PUBLIC_LOGGING_DISABLED === '1';\nconst BUILD_POSTHOG_DISABLED = process.env.NEXT_PUBLIC_POSTHOG_LOGGING_DISABLED === '1';\ninterface LoggingWindow extends Window {\n __loggingDisabled?: boolean;\n __posthogLoggingDisabled?: boolean;\n}\n\nexport type LogLevel = 'info' | 'warn' | 'error';\n\nexport type LogOptions = {\n /** Send this log payload to PostHog Logs product. */\n shipToPostHog?: boolean;\n};\n\ntype OTelInitOptions = {\n apiKey: string;\n apiHost?: string;\n serviceName?: string;\n environment?: string;\n accountId?: number;\n accountName?: string;\n};\n\ntype PendingShipLog = {\n level: LogLevel;\n channel: string;\n event: string;\n detail: Record<string, unknown>;\n};\n\nconst MAX_PENDING_POSTHOG_LOGS = 500;\nlet otelProvider: LoggerProvider | null = null;\nlet otelLogger: ReturnType<typeof logs.getLogger> | null = null;\nlet otelInitFingerprint = '';\nconst pendingPostHogLogs: PendingShipLog[] = [];\nconst browserConsole = globalThis?.['console'];\n\n/**\n * Channel → accent colour. Unregistered channels fall through to gray.\n */\nexport const CHANNEL_COLORS: Record<string, string> = {\n // Shared diagnostics\n 'global-client': '#d2a8ff',\n\n // Section pins (desktop)\n 'every-channel-pin': '#9febd7',\n 'hero-pin': '#6ecc8b',\n 'pricing-pin': '#399587',\n 'product-screens-pin': '#4fafa0',\n 'social-proof-pin': '#ffbb8a',\n 'value-props-pin': '#e0a733',\n 'work-pin': '#f57e56',\n\n // Section pins (mobile)\n 'mobile-every-channel-pin': '#7ed9c6',\n 'mobile-hero-pin': '#f0eee6',\n 'mobile-pricing-pin': '#80d4ff',\n 'mobile-product-screens-pin': '#3a9085',\n 'mobile-social-proof-pin': '#ffd580',\n 'mobile-value-props-pin': '#4fafa0',\n};\n\nfunction flattenAttributes(input: Record<string, unknown>, prefix = ''): Record<string, string | number | boolean> {\n const output: Record<string, string | number | boolean> = {};\n\n for (const [key, value] of Object.entries(input)) {\n const nextKey = prefix ? `${prefix}.${key}` : key;\n if (value === null || value === undefined) continue;\n\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n output[nextKey] = value;\n continue;\n }\n\n if (Array.isArray(value)) {\n output[nextKey] = JSON.stringify(value);\n continue;\n }\n\n if (typeof value === 'object') {\n Object.assign(output, flattenAttributes(value as Record<string, unknown>, nextKey));\n continue;\n }\n\n output[nextKey] = String(value);\n }\n\n return output;\n}\n\nfunction stripTrailingSlash(host: string): string {\n return host.replace(/\\/+$/, '');\n}\n\nfunction enqueuePendingPostHogLog(entry: PendingShipLog): void {\n if (pendingPostHogLogs.length >= MAX_PENDING_POSTHOG_LOGS) {\n pendingPostHogLogs.shift();\n }\n pendingPostHogLogs.push(entry);\n}\n\nfunction flushPendingPostHogLogs(): void {\n if (!otelLogger || pendingPostHogLogs.length === 0) return;\n\n while (pendingPostHogLogs.length > 0) {\n const entry = pendingPostHogLogs.shift();\n if (!entry) break;\n emitToPostHog(entry.level, entry.channel, entry.event, entry.detail);\n }\n}\n\nexport function initializePostHogLogging(options: OTelInitOptions): void {\n if (typeof window === 'undefined') return;\n if (!options.apiKey?.trim()) return;\n\n const apiHost = stripTrailingSlash(options.apiHost?.trim() || 'https://us.i.posthog.com');\n const serviceName = options.serviceName?.trim() || 'keystone-customer-site';\n const environment = options.environment?.trim() || 'production';\n const fingerprint = `${apiHost}|${options.apiKey}|${serviceName}|${environment}|${options.accountId ?? ''}|${options.accountName ?? ''}`;\n if (otelLogger && otelInitFingerprint === fingerprint) return;\n\n if (otelProvider) {\n // Cleanly replace logger provider when config changes.\n void otelProvider.shutdown().catch(() => {});\n otelProvider = null;\n otelLogger = null;\n }\n\n const baseAttributes: Record<string, string | number | boolean> = {\n 'service.name': serviceName,\n environment,\n site_domain: window.location.hostname,\n };\n if (options.accountId !== undefined) baseAttributes.account_id = options.accountId;\n if (options.accountName) baseAttributes.account_name = options.accountName;\n\n const exporter = new OTLPLogExporter({\n url: `${apiHost}/i/v1/logs?token=${encodeURIComponent(options.apiKey)}`,\n headers: {\n // Keep request \"simple\" to avoid CORS preflight in browser.\n 'Content-Type': 'text/plain',\n },\n });\n\n otelProvider = new LoggerProvider({\n resource: resourceFromAttributes(baseAttributes),\n processors: [new BatchLogRecordProcessor(exporter)],\n });\n\n logs.setGlobalLoggerProvider(otelProvider);\n otelLogger = logs.getLogger(serviceName);\n otelInitFingerprint = fingerprint;\n flushPendingPostHogLogs();\n}\n\nfunction isConsoleEnabled(): boolean {\n if (BUILD_CONSOLE_DISABLED) return false;\n if (typeof window === 'undefined') return true;\n return (window as LoggingWindow).__loggingDisabled !== true;\n}\n\nfunction isPostHogShippingEnabled(): boolean {\n if (BUILD_POSTHOG_DISABLED) return false;\n if (typeof window === 'undefined') return false;\n return (window as LoggingWindow).__posthogLoggingDisabled !== true;\n}\n\nfunction formatDetail(detail: Record<string, unknown>): string {\n return Object.entries(detail)\n .map(([k, v]) => `${k}=${typeof v === 'number' ? v.toFixed(4) : String(v)}`)\n .join(' ');\n}\n\nfunction emitConsole(\n level: LogLevel,\n channel: string,\n event: string,\n detail: Record<string, unknown>,\n): void {\n const color = CHANNEL_COLORS[channel] ?? '#aaa';\n const detailStr = formatDetail(detail);\n const message = `%c[${channel}] %c${event}%c ${detailStr}`;\n const channelStyle = `color:${color}; font-weight:bold`;\n const eventStyle = level === 'error'\n ? 'color:#e94e4e; font-weight:bold'\n : level === 'warn'\n ? 'color:#f5a623; font-weight:bold'\n : 'color:#fff; font-weight:bold';\n const detailStyle = 'color:#999; font-weight:normal';\n\n if (level === 'error') {\n browserConsole?.error?.(message, channelStyle, eventStyle, detailStyle);\n return;\n }\n if (level === 'warn') {\n browserConsole?.warn?.(message, channelStyle, eventStyle, detailStyle);\n return;\n }\n browserConsole?.log?.(message, channelStyle, eventStyle, detailStyle);\n}\n\nfunction emitToPostHog(level: LogLevel, channel: string, event: string, detail: Record<string, unknown>): boolean {\n if (!otelLogger) return false;\n\n const severityText = level === 'warn' ? 'WARNING' : level === 'error' ? 'ERROR' : 'INFO';\n const attributes = flattenAttributes({ channel, ...detail });\n\n otelLogger.emit({\n severityText,\n body: event,\n attributes,\n });\n return true;\n}\n\nfunction emit(level: LogLevel, channel: string, event: string, detail: Record<string, unknown>, options?: LogOptions): void {\n const shouldShip = (options?.shipToPostHog ?? level !== 'info') && isPostHogShippingEnabled();\n // Keep warn/error visible even when regular logs are muted.\n if (level !== 'info' || isConsoleEnabled()) {\n emitConsole(level, channel, event, detail);\n }\n if (shouldShip) {\n const shipped = emitToPostHog(level, channel, event, detail);\n if (!shipped) {\n enqueuePendingPostHogLog({ level, channel, event, detail });\n }\n }\n}\n\nexport function log(channel: string, event: string, detail: Record<string, unknown> = {}, options?: LogOptions): void {\n emit('info', channel, event, detail, options);\n}\n\nexport function warn(channel: string, event: string, detail: Record<string, unknown> = {}, options?: LogOptions): void {\n emit('warn', channel, event, detail, options);\n}\n\nexport function error(channel: string, event: string, detail: Record<string, unknown> = {}, options?: LogOptions): void {\n emit('error', channel, event, detail, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAS,eAAe,kBAAkB;;;ACGnC,IAAM,eAAe;AAAA,EAC1B,SAAS;AAAA;AAAA,EACT,MAAM;AAAA;AAAA,EACN,SAAS;AAAA;AAAA,EACT,SAAS;AAAA;AAAA,EACT,QAAQ;AAAA;AACV;AAYO,SAAS,aAAa,OAA+B;AAC1D,SAAO,SAAS;AAClB;;;ACvBA,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB,sBAAsB;AAExD,IAAM,yBAAyB,QAAQ,IAAI,iCAAiC;AAC5E,IAAM,yBAAyB,QAAQ,IAAI,yCAAyC;AA6BpF,IAAM,2BAA2B;AAEjC,IAAI,aAAuD;AAE3D,IAAM,qBAAuC,CAAC;AAC9C,IAAM,iBAAiB,yCAAa;AAK7B,IAAM,iBAAyC;AAAA;AAAA,EAEpD,iBAAiB;AAAA;AAAA,EAGjB,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,YAAY;AAAA;AAAA,EAGZ,4BAA4B;AAAA,EAC5B,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,8BAA8B;AAAA,EAC9B,2BAA2B;AAAA,EAC3B,0BAA0B;AAC5B;AAEA,SAAS,kBAAkB,OAAgC,SAAS,IAA+C;AACjH,QAAM,SAAoD,CAAC;AAE3D,aAAW,CAAC,K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AED,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,SAAK,SAAS,0BAA0B,EAAE,MAAM,CAAC;AACjD,YAAQ;AAAA,EACV;AAEA,SACE,oCAAC,aAAa,UAAb,EAAsB,OAAO,EAAE,MAAM,KACnC,QACH;AAEJ;AAEO,SAAS,WAAW;AACzB,SAAO,WAAW,YAAY;AAChC;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { F as FormDefinition } from '../../form-C94A_PX_.js';
|
|
3
|
+
|
|
4
|
+
interface DynamicFormFieldsProps {
|
|
5
|
+
/** Form definition from API (fields array + optional settings). */
|
|
6
|
+
form: FormDefinition;
|
|
7
|
+
/** For job_application forms: add hidden jobSlug input. */
|
|
8
|
+
jobSlug?: string;
|
|
9
|
+
/** Optional URLs for ToS/Privacy links in consent checkbox label. */
|
|
10
|
+
privacyPolicyUrl?: string;
|
|
11
|
+
termsOfServiceUrl?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function DynamicFormFields({ form, jobSlug, privacyPolicyUrl, termsOfServiceUrl }: DynamicFormFieldsProps): React__default.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { DynamicFormFields, type DynamicFormFieldsProps };
|