keystone-design-bootstrap 1.0.69 → 1.0.71

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.
@@ -14,6 +14,12 @@ export type PostHogProviderProps = {
14
14
  accountId?: number;
15
15
  /** Keystone account name (company_name) — attached to every event as a super property. */
16
16
  accountName?: string;
17
+ /**
18
+ * Environment identifier from KEYSTONE_ENV on the Rails server (e.g. "production", "staging",
19
+ * "development"). Registered as a super property so events can be filtered by environment
20
+ * in PostHog and the sync job only imports data for the matching environment.
21
+ */
22
+ environment?: string;
17
23
  children: React.ReactNode;
18
24
  };
19
25
 
@@ -102,7 +108,7 @@ function PostHogPageviewTracker() {
102
108
  * Mount once in the root layout body. One project key covers all customer
103
109
  * sites — filter by account_name or site_domain in the PostHog dashboard.
104
110
  */
105
- export function PostHogProvider({ apiKey, apiHost, accountId, accountName, children }: PostHogProviderProps) {
111
+ export function PostHogProvider({ apiKey, apiHost, accountId, accountName, environment, children }: PostHogProviderProps) {
106
112
  useEffect(() => {
107
113
  posthog.init(apiKey, {
108
114
  api_host: apiHost ?? DEFAULT_HOST,
@@ -113,9 +119,10 @@ export function PostHogProvider({ apiKey, apiHost, accountId, accountName, child
113
119
  posthog.register({
114
120
  ...(accountId !== undefined && { account_id: accountId }),
115
121
  ...(accountName && { account_name: accountName }),
122
+ ...(environment && { environment }),
116
123
  site_domain: window.location.hostname,
117
124
  });
118
- }, [apiKey, apiHost, accountId, accountName]);
125
+ }, [apiKey, apiHost, accountId, accountName, environment]);
119
126
 
120
127
  return (
121
128
  <PHProvider client={posthog}>