keystone-design-bootstrap 1.0.103 → 1.0.105-dev.0
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 +86 -0
- package/dist/index.js +20646 -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/design_system/components/ChatWidget.tsx +66 -10
- package/src/design_system/portal/LoginForm.tsx +1 -24
- package/src/lib/chat-backend.ts +36 -0
- package/src/lib/consumer-session.ts +3 -1
- package/src/next/layouts/root-layout.tsx +5 -0
- package/src/next/routes/chat.ts +215 -18
- package/src/next/routes/consumer-auth.ts +49 -124
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { P as PhotoAttachment, a as Photo } from './photos-CmBdWiuZ.js';
|
|
2
|
+
|
|
3
|
+
/** Nested under `service_items[].offers` and `packages[].offers` in public API. */
|
|
4
|
+
interface OfferPublic {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
value_terms: string | null;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
expires_at?: string | null;
|
|
11
|
+
expired?: boolean;
|
|
12
|
+
photo_attachments?: PhotoAttachment[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Service {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
description_markdown: string;
|
|
20
|
+
summary?: string;
|
|
21
|
+
pricing_info?: string;
|
|
22
|
+
features_markdown?: string;
|
|
23
|
+
featured: boolean;
|
|
24
|
+
sort_order: number;
|
|
25
|
+
photo_attachments?: PhotoAttachment[];
|
|
26
|
+
service_items?: ServiceItem[];
|
|
27
|
+
created_at: string;
|
|
28
|
+
updated_at: string;
|
|
29
|
+
}
|
|
30
|
+
interface ServiceItem {
|
|
31
|
+
id: number;
|
|
32
|
+
name: string;
|
|
33
|
+
slug: string;
|
|
34
|
+
summary?: string | null;
|
|
35
|
+
description_markdown?: string | null;
|
|
36
|
+
pricing_info?: string | null;
|
|
37
|
+
price_cents?: number | null;
|
|
38
|
+
duration_minutes?: number | null;
|
|
39
|
+
sort_order: number;
|
|
40
|
+
service_id?: number;
|
|
41
|
+
photo_attachments?: PhotoAttachment[];
|
|
42
|
+
offers?: OfferPublic[];
|
|
43
|
+
}
|
|
44
|
+
interface ServiceParams {
|
|
45
|
+
featured?: boolean;
|
|
46
|
+
q?: string;
|
|
47
|
+
page?: number;
|
|
48
|
+
per_page?: number;
|
|
49
|
+
}
|
|
50
|
+
type ServiceResponse = Service[];
|
|
51
|
+
|
|
52
|
+
interface CompanyInformation {
|
|
53
|
+
id: number;
|
|
54
|
+
company_name: string;
|
|
55
|
+
tagline: string;
|
|
56
|
+
mission_statement_markdown?: string;
|
|
57
|
+
about_text_markdown?: string;
|
|
58
|
+
description_markdown?: string;
|
|
59
|
+
values_markdown?: string;
|
|
60
|
+
stats_markdown?: string;
|
|
61
|
+
founded_year?: number;
|
|
62
|
+
logo_photo?: Photo;
|
|
63
|
+
favicon_url?: string;
|
|
64
|
+
facebook_url?: string;
|
|
65
|
+
instagram_url?: string;
|
|
66
|
+
tiktok_url?: string;
|
|
67
|
+
linkedin_url?: string;
|
|
68
|
+
twitter_url?: string;
|
|
69
|
+
youtube_url?: string;
|
|
70
|
+
pinterest_url?: string;
|
|
71
|
+
google_my_business_url?: string;
|
|
72
|
+
yelp_url?: string;
|
|
73
|
+
tripadvisor_url?: string;
|
|
74
|
+
google_reviews_url?: string;
|
|
75
|
+
primary_phone?: string;
|
|
76
|
+
primary_email?: string;
|
|
77
|
+
primary_address_line_1?: string;
|
|
78
|
+
primary_address_line_2?: string;
|
|
79
|
+
primary_city?: string;
|
|
80
|
+
primary_state?: string;
|
|
81
|
+
primary_zip_code?: string;
|
|
82
|
+
primary_country?: string;
|
|
83
|
+
support_email?: string;
|
|
84
|
+
sales_email?: string;
|
|
85
|
+
business_hours?: string;
|
|
86
|
+
external_management_url?: string;
|
|
87
|
+
/** Member portal URL for this account. When set, used as the primary CTA instead of external_management_url. */
|
|
88
|
+
portal_url?: string | null;
|
|
89
|
+
terms_of_service_markdown?: string;
|
|
90
|
+
privacy_policy_markdown?: string;
|
|
91
|
+
created_at: string;
|
|
92
|
+
updated_at: string;
|
|
93
|
+
photo_attachments?: PhotoAttachment[];
|
|
94
|
+
account_status?: string;
|
|
95
|
+
chat_enabled?: boolean;
|
|
96
|
+
}
|
|
97
|
+
type CompanyInformationResponse = CompanyInformation | null;
|
|
98
|
+
|
|
99
|
+
interface PackageItem {
|
|
100
|
+
quantity: number;
|
|
101
|
+
service_item?: {
|
|
102
|
+
id: number;
|
|
103
|
+
name: string;
|
|
104
|
+
slug: string;
|
|
105
|
+
summary?: string | null;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface Package {
|
|
109
|
+
id: number;
|
|
110
|
+
name: string;
|
|
111
|
+
slug: string;
|
|
112
|
+
summary?: string | null;
|
|
113
|
+
description_markdown?: string | null;
|
|
114
|
+
pricing_info?: string | null;
|
|
115
|
+
price_cents?: number | null;
|
|
116
|
+
photo_attachments?: PhotoAttachment[];
|
|
117
|
+
package_items?: PackageItem[];
|
|
118
|
+
offers?: OfferPublic[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type { CompanyInformation as C, OfferPublic as O, Package as P, Service as S, CompanyInformationResponse as a, PackageItem as b, ServiceItem as c, ServiceParams as d, ServiceResponse as e };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photo and PhotoAttachment type definitions
|
|
3
|
+
*/
|
|
4
|
+
interface Photo {
|
|
5
|
+
id?: number;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
alt_text?: string;
|
|
9
|
+
thumbnail_url?: string;
|
|
10
|
+
medium_url?: string;
|
|
11
|
+
large_url?: string;
|
|
12
|
+
original_url?: string;
|
|
13
|
+
generated?: boolean;
|
|
14
|
+
created_at?: string;
|
|
15
|
+
updated_at?: string;
|
|
16
|
+
}
|
|
17
|
+
interface PhotoAttachment {
|
|
18
|
+
id: number;
|
|
19
|
+
/** May be omitted in some API responses. */
|
|
20
|
+
photo?: Photo;
|
|
21
|
+
featured?: boolean;
|
|
22
|
+
sort_order?: number;
|
|
23
|
+
created_at?: string;
|
|
24
|
+
updated_at?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type { PhotoAttachment as P, Photo as a };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Configuration
|
|
3
|
+
* Single source of truth for all themes
|
|
4
|
+
*/
|
|
5
|
+
declare const THEME_CONFIG: {
|
|
6
|
+
readonly classic: "";
|
|
7
|
+
readonly aman: ".aman";
|
|
8
|
+
readonly barelux: ".barelux";
|
|
9
|
+
readonly balance: ".balance";
|
|
10
|
+
readonly custom: "";
|
|
11
|
+
};
|
|
12
|
+
type Theme = keyof typeof THEME_CONFIG;
|
|
13
|
+
declare function getAvailableThemes(): Theme[];
|
|
14
|
+
declare function getThemeSuffix(theme: Theme): string;
|
|
15
|
+
declare function isValidTheme(theme: string): theme is Theme;
|
|
16
|
+
|
|
17
|
+
export { THEME_CONFIG, type Theme, getAvailableThemes, getThemeSuffix, isValidTheme };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/themes/index.ts
|
|
2
|
+
var THEME_CONFIG = {
|
|
3
|
+
classic: "",
|
|
4
|
+
// Base files with no suffix (hero-home.tsx)
|
|
5
|
+
aman: ".aman",
|
|
6
|
+
// Aman Hotels variant files (hero-home.aman.tsx)
|
|
7
|
+
barelux: ".barelux",
|
|
8
|
+
// Bare Lux Studio variant files (hero-home.barelux.tsx)
|
|
9
|
+
balance: ".balance",
|
|
10
|
+
// Balance Aesthetics variant files (hero-home.balance.tsx)
|
|
11
|
+
custom: ""
|
|
12
|
+
// Fully custom sites — no design-system CSS loaded, all styling built in the site itself
|
|
13
|
+
};
|
|
14
|
+
function getAvailableThemes() {
|
|
15
|
+
return Object.keys(THEME_CONFIG);
|
|
16
|
+
}
|
|
17
|
+
function getThemeSuffix(theme) {
|
|
18
|
+
return THEME_CONFIG[theme] || "";
|
|
19
|
+
}
|
|
20
|
+
function isValidTheme(theme) {
|
|
21
|
+
return theme in THEME_CONFIG;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
THEME_CONFIG,
|
|
25
|
+
getAvailableThemes,
|
|
26
|
+
getThemeSuffix,
|
|
27
|
+
isValidTheme
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/themes/index.ts"],"sourcesContent":["/**\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"],"mappings":";AAKO,IAAM,eAAe;AAAA,EAC1B,SAAS;AAAA;AAAA,EACT,MAAM;AAAA;AAAA,EACN,SAAS;AAAA;AAAA,EACT,SAAS;AAAA;AAAA,EACT,QAAQ;AAAA;AACV;AAIO,SAAS,qBAA8B;AAC5C,SAAO,OAAO,KAAK,YAAY;AACjC;AAEO,SAAS,eAAe,OAAsB;AACnD,SAAO,aAAa,KAAK,KAAK;AAChC;AAEO,SAAS,aAAa,OAA+B;AAC1D,SAAO,SAAS;AAClB;","names":[]}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
|
|
3
|
+
type MetaPixelProps = {
|
|
4
|
+
/** Meta Pixel ID. When null/undefined, nothing is rendered. */
|
|
5
|
+
pixelId: string | null | undefined;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Renders the Meta (Facebook) Pixel base code: loads fbevents.js, initializes
|
|
9
|
+
* the pixel, and tracks PageView. Use in the root layout when ads config
|
|
10
|
+
* provides a meta_pixel_id.
|
|
11
|
+
*/
|
|
12
|
+
declare function MetaPixel({ pixelId }: MetaPixelProps): React$1.JSX.Element | null;
|
|
13
|
+
|
|
14
|
+
type Props$1 = {
|
|
15
|
+
/** External booking URL. When set, fires InitiateCheckout on any click targeting that URL. */
|
|
16
|
+
bookingUrl?: string | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Single client-side tracker placed once in KeystoneRootLayout.
|
|
20
|
+
* - Fires ViewContent on every route change for known page patterns.
|
|
21
|
+
* - Fires InitiateCheckout whenever a visitor clicks a link to the external booking URL.
|
|
22
|
+
*
|
|
23
|
+
* Portal booking tab tracking is handled directly inside PortalPage via PortalTabTracker
|
|
24
|
+
* since intent is only established when the Booking tab is explicitly opened.
|
|
25
|
+
*/
|
|
26
|
+
declare function MetaPixelTracker({ bookingUrl }: Props$1): null;
|
|
27
|
+
|
|
28
|
+
type PixelEvent = 'PageView' | 'ViewContent' | 'InitiateCheckout' | 'Lead';
|
|
29
|
+
interface PixelEventParams {
|
|
30
|
+
contentName?: string;
|
|
31
|
+
contentCategory?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Raw (unhashed) user identifiers for advanced matching. */
|
|
34
|
+
interface PixelUserData {
|
|
35
|
+
email?: string | null;
|
|
36
|
+
phone?: string | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Hash and store user identifiers so they are automatically included in all
|
|
40
|
+
* subsequent pixel events for this browser session. Call this as soon as
|
|
41
|
+
* identity is known (e.g. contact form submission, portal login step 1).
|
|
42
|
+
*/
|
|
43
|
+
declare function setPixelUserData(userData: PixelUserData): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Single entry point for all client-side Meta Pixel event fires.
|
|
46
|
+
* Automatically applies any stored user identity before firing so that Meta
|
|
47
|
+
* can match events to known users across the entire session.
|
|
48
|
+
* Silently no-ops if fbq is not loaded (pixel not configured for this site).
|
|
49
|
+
*
|
|
50
|
+
* @param eventId - Optional server-side event ID for browser/server deduplication.
|
|
51
|
+
* Pass the `eventId` returned by the form submission API so Meta can match and
|
|
52
|
+
* deduplicate the browser Lead event against the server-side CAPI Lead event.
|
|
53
|
+
* Format: fbq('track', event, params, { eventID: eventId })
|
|
54
|
+
*/
|
|
55
|
+
declare function firePixelEvent(event: PixelEvent, params?: PixelEventParams, eventId?: string): void;
|
|
56
|
+
|
|
57
|
+
type PostHogProviderProps = {
|
|
58
|
+
apiKey: string;
|
|
59
|
+
apiHost?: string;
|
|
60
|
+
/** Keystone account ID — attached to every event as a super property. */
|
|
61
|
+
accountId?: number;
|
|
62
|
+
/** Keystone account name (company_name) — attached to every event as a super property. */
|
|
63
|
+
accountName?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Environment identifier from KEYSTONE_ENV on the Rails server (e.g. "production", "staging",
|
|
66
|
+
* "development"). Registered as a super property so events can be filtered by environment
|
|
67
|
+
* in PostHog and the sync job only imports data for the matching environment.
|
|
68
|
+
*/
|
|
69
|
+
environment?: string;
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Initialises PostHog, registers account-level super properties, and fires
|
|
74
|
+
* an enriched `$pageview` on every App Router navigation.
|
|
75
|
+
*
|
|
76
|
+
* Super properties attached to every event automatically:
|
|
77
|
+
* - account_id (Keystone account ID)
|
|
78
|
+
* - account_name (company_name)
|
|
79
|
+
* - site_domain (window.location.hostname)
|
|
80
|
+
* - environment (KEYSTONE_ENV — e.g. "production", "staging", "local_rahuljaswa")
|
|
81
|
+
*
|
|
82
|
+
* Mount once in the root layout body. One project key covers all customer
|
|
83
|
+
* sites — filter by account_name or site_domain in the PostHog dashboard.
|
|
84
|
+
*/
|
|
85
|
+
declare function PostHogProvider({ apiKey, apiHost, accountId, accountName, environment, children }: PostHogProviderProps): React$1.JSX.Element;
|
|
86
|
+
|
|
87
|
+
type Props = {
|
|
88
|
+
/** External booking / portal URL. When set, fires booking_cta_clicked on any click to that URL. */
|
|
89
|
+
bookingUrl?: string | null;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Page-level PostHog event tracker. Mount once inside PostHogProvider in
|
|
93
|
+
* KeystoneRootLayout alongside MetaPixelTracker.
|
|
94
|
+
*
|
|
95
|
+
* Responsibilities:
|
|
96
|
+
* - booking_cta_clicked: fires when any link to the booking URL is clicked,
|
|
97
|
+
* capturing the page the visitor was on when they clicked.
|
|
98
|
+
*/
|
|
99
|
+
declare function KeystoneAnalyticsTracker({ bookingUrl }: Props): null;
|
|
100
|
+
|
|
101
|
+
type GoogleTagManagerProps = {
|
|
102
|
+
/** GTM container public ID (e.g. GTM-ABC123). */
|
|
103
|
+
containerId: string | null | undefined;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Renders Google Tag Manager script + noscript fallback.
|
|
107
|
+
* Mount once at root layout level when a container is provisioned.
|
|
108
|
+
*/
|
|
109
|
+
declare function GoogleTagManager({ containerId }: GoogleTagManagerProps): React$1.JSX.Element | null;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* PostHog event capture — Keystone customer sites.
|
|
113
|
+
*
|
|
114
|
+
* ## Naming convention
|
|
115
|
+
* All events use snake_case `object_action` format.
|
|
116
|
+
* Properties use snake_case as well.
|
|
117
|
+
*
|
|
118
|
+
* ## Event taxonomy
|
|
119
|
+
* Add new events here: define the name in `KsEventName` and its required
|
|
120
|
+
* properties in `KsEventProperties`. Every callsite is then type-checked.
|
|
121
|
+
*
|
|
122
|
+
* ## Usage
|
|
123
|
+
*
|
|
124
|
+
* import { captureEvent } from 'keystone-design-bootstrap/tracking';
|
|
125
|
+
*
|
|
126
|
+
* captureEvent('form_submitted', { form_type: 'lead' });
|
|
127
|
+
* captureEvent('booking_cta_clicked', { source_path: '/services/massage', booking_url: url });
|
|
128
|
+
*
|
|
129
|
+
* All calls are safe no-ops when PostHog has not been initialised (e.g. no
|
|
130
|
+
* POSTHOG_API_KEY configured on the server).
|
|
131
|
+
*
|
|
132
|
+
* ## Super properties
|
|
133
|
+
* account_id, account_name, and site_domain are registered as super properties
|
|
134
|
+
* by PostHogProvider and are automatically attached to every event — you do not
|
|
135
|
+
* need to include them in individual captureEvent calls.
|
|
136
|
+
*/
|
|
137
|
+
type KsEventName = 'booking_cta_clicked' | 'form_submitted' | 'form_failed' | 'chat_opened' | 'chat_message_sent' | 'chat_message_failed' | 'portal_tab_viewed' | 'portal_login_started' | 'portal_login_step_viewed' | 'portal_login_step_submitted' | 'portal_login_step_advanced' | 'portal_login_back_clicked' | 'portal_login_identified' | 'portal_login_completed' | 'portal_login_failed';
|
|
138
|
+
type KsEventProperties = {
|
|
139
|
+
/** Fired when a visitor clicks any CTA that links to the external booking URL. */
|
|
140
|
+
booking_cta_clicked: {
|
|
141
|
+
source_path: string;
|
|
142
|
+
booking_url: string;
|
|
143
|
+
};
|
|
144
|
+
/** Fired when a Keystone form is successfully submitted. */
|
|
145
|
+
form_submitted: {
|
|
146
|
+
/** One of: lead | job_application | marketing_list_signup */
|
|
147
|
+
form_type: string;
|
|
148
|
+
/** Server-generated event ID for CAPI deduplication (when present). */
|
|
149
|
+
event_id?: string;
|
|
150
|
+
};
|
|
151
|
+
/** Fired when a form submission fails (validation error or network error). */
|
|
152
|
+
form_failed: {
|
|
153
|
+
form_type: string;
|
|
154
|
+
error: string;
|
|
155
|
+
};
|
|
156
|
+
/** Fired when the chat widget is first opened by the visitor. */
|
|
157
|
+
chat_opened: Record<string, never>;
|
|
158
|
+
/** Fired when a chat message is successfully sent. */
|
|
159
|
+
chat_message_sent: {
|
|
160
|
+
/** Whether the visitor is authenticated (contactId present). */
|
|
161
|
+
is_authenticated: boolean;
|
|
162
|
+
};
|
|
163
|
+
/** Fired when a chat message fails to send. */
|
|
164
|
+
chat_message_failed: {
|
|
165
|
+
error: string;
|
|
166
|
+
};
|
|
167
|
+
/** Fired when a member portal tab is opened. */
|
|
168
|
+
portal_tab_viewed: {
|
|
169
|
+
tab: string;
|
|
170
|
+
};
|
|
171
|
+
/** Fired when the portal login modal is opened / login flow starts. */
|
|
172
|
+
portal_login_started: Record<string, never>;
|
|
173
|
+
/** Fired whenever a login step becomes visible to the user. */
|
|
174
|
+
portal_login_step_viewed: {
|
|
175
|
+
step: 'identifier' | 'signin' | 'signup';
|
|
176
|
+
};
|
|
177
|
+
/** Fired when the user submits a specific login step. */
|
|
178
|
+
portal_login_step_submitted: {
|
|
179
|
+
step: 'identifier' | 'signin' | 'signup';
|
|
180
|
+
};
|
|
181
|
+
/** Fired when the flow transitions from one step to another state. */
|
|
182
|
+
portal_login_step_advanced: {
|
|
183
|
+
from_step: 'identifier' | 'signin' | 'signup';
|
|
184
|
+
to_step: 'signin' | 'signup' | 'authenticated';
|
|
185
|
+
reason: string;
|
|
186
|
+
};
|
|
187
|
+
/** Fired when the user explicitly navigates back to the identifier step. */
|
|
188
|
+
portal_login_back_clicked: {
|
|
189
|
+
from_step: 'signin' | 'signup';
|
|
190
|
+
to_step: 'identifier';
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Fired after the identifier step resolves — we know whether the user
|
|
194
|
+
* already has an account.
|
|
195
|
+
*/
|
|
196
|
+
portal_login_identified: {
|
|
197
|
+
method: 'email' | 'phone' | 'email_and_phone';
|
|
198
|
+
user_exists: boolean;
|
|
199
|
+
};
|
|
200
|
+
/** Fired after the user successfully signs in or creates an account. */
|
|
201
|
+
portal_login_completed: {
|
|
202
|
+
flow: 'signin' | 'signup';
|
|
203
|
+
};
|
|
204
|
+
/** Fired when any step of the login flow returns an error. */
|
|
205
|
+
portal_login_failed: {
|
|
206
|
+
step: 'identifier' | 'signin' | 'signup';
|
|
207
|
+
reason: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Captures a typed Keystone analytics event via PostHog.
|
|
212
|
+
* Safe no-op when PostHog has not been initialised.
|
|
213
|
+
*/
|
|
214
|
+
declare function captureEvent<E extends KsEventName>(event: E, ...args: KsEventProperties[E] extends Record<string, never> ? [] : [properties: KsEventProperties[E]]): void;
|
|
215
|
+
/**
|
|
216
|
+
* Captures an app-specific ("custom") analytics event via PostHog.
|
|
217
|
+
*
|
|
218
|
+
* Unlike `captureEvent` — which is restricted to the shared, type-checked
|
|
219
|
+
* Keystone taxonomy (`KsEventName`) — this is a thin, open-ended escape hatch
|
|
220
|
+
* for product-specific funnels that don't belong in the shared taxonomy
|
|
221
|
+
* (e.g. the Grader's `grader_scan_started`, or any one-off consumer app event).
|
|
222
|
+
* It keeps those events out of the shared union while still flowing through the
|
|
223
|
+
* same initialised PostHog instance, so account super properties and config are
|
|
224
|
+
* applied identically.
|
|
225
|
+
*
|
|
226
|
+
* Conventions (not enforced, but please follow):
|
|
227
|
+
* - snake_case `object_action` names, prefixed with your app/feature so events
|
|
228
|
+
* are easy to group and never collide with the shared taxonomy
|
|
229
|
+
* (e.g. `grader_scan_started`; `portal_*`, `form_*`, `chat_*`, `booking_*`
|
|
230
|
+
* are reserved by `captureEvent`).
|
|
231
|
+
* - snake_case property keys.
|
|
232
|
+
*
|
|
233
|
+
* `account_id` / `account_name` / `site_domain` super properties are attached
|
|
234
|
+
* automatically by PostHogProvider. Safe no-op when PostHog isn't initialised.
|
|
235
|
+
*
|
|
236
|
+
* For events that are reused across multiple sites, promote them into the typed
|
|
237
|
+
* `KsEventName` taxonomy above and use `captureEvent` instead.
|
|
238
|
+
*/
|
|
239
|
+
declare function captureCustomEvent(event: string, properties?: Record<string, unknown>): void;
|
|
240
|
+
|
|
241
|
+
type LogLevel = 'info' | 'warn' | 'error';
|
|
242
|
+
type LogOptions = {
|
|
243
|
+
/** Send this log payload to PostHog Logs product. */
|
|
244
|
+
shipToPostHog?: boolean;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Channel → accent colour. Unregistered channels fall through to gray.
|
|
248
|
+
*/
|
|
249
|
+
declare const CHANNEL_COLORS: Record<string, string>;
|
|
250
|
+
declare function log(channel: string, event: string, detail?: Record<string, unknown>, options?: LogOptions): void;
|
|
251
|
+
declare function warn(channel: string, event: string, detail?: Record<string, unknown>, options?: LogOptions): void;
|
|
252
|
+
declare function error(channel: string, event: string, detail?: Record<string, unknown>, options?: LogOptions): void;
|
|
253
|
+
|
|
254
|
+
export { CHANNEL_COLORS, GoogleTagManager, type GoogleTagManagerProps, KeystoneAnalyticsTracker, type KsEventName, type KsEventProperties, type LogLevel, type LogOptions, MetaPixel, type MetaPixelProps, MetaPixelTracker, type PixelEvent, type PixelEventParams, type PixelUserData, PostHogProvider, type PostHogProviderProps, captureCustomEvent, captureEvent, error, firePixelEvent, log, setPixelUserData, warn };
|