@splithub/core 0.1.5 → 0.1.7

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/index.d.cts CHANGED
@@ -1,257 +1,5 @@
1
- /**
2
- * SplitHub configuration types. `splithub.config.ts` is the single source of
3
- * truth for experiments: the SDK, the CLI, the self-hosted handler and the
4
- * cloud all read the same object.
5
- */
6
- type ExperimentStatus = 'draft' | 'running' | 'paused' | 'finished';
7
- type ExperimentKind = 'component' | 'value' | 'redirect' | 'mvt';
8
- /** Weight shorthand (`{ control: 50, bold: 50 }`) or a full variant object. */
9
- type ComponentVariantInput = number | {
10
- weight: number;
11
- };
12
- type ValueVariantInput = {
13
- weight: number;
14
- value: unknown;
15
- };
16
- type RedirectVariantInput = {
17
- weight: number;
18
- to: string;
19
- };
20
- type TargetField = 'country' | 'region' | 'city' | 'device' | 'browser' | 'os' | 'language' | 'referrer' | 'url' | 'path' | 'query' | 'utm_source' | 'utm_medium' | 'utm_campaign' | 'utm_term' | 'utm_content' | 'cookie' | 'visitor' | 'hour' | 'weekday';
21
- type TargetOp = 'is' | 'is_not' | 'contains' | 'not_contains' | 'starts_with' | 'in' | 'not_in' | 'matches' | 'exists' | 'not_exists';
22
- interface TargetCondition {
23
- field: TargetField;
24
- op: TargetOp;
25
- /** Parameter / cookie name for `query` and `cookie`. */
26
- key?: string;
27
- /** Comparison value; comma-separated list for `in` / `not_in`; regex for `matches`. */
28
- value?: string;
29
- }
30
- type FlowNode = {
31
- type: 'condition';
32
- conditions: TargetCondition[];
33
- match?: 'all' | 'any';
34
- then: string;
35
- else?: string | null;
36
- } | {
37
- type: 'split';
38
- outputs: Array<{
39
- weight: number;
40
- to: string;
41
- }>;
42
- } | {
43
- type: 'variant';
44
- variant: string;
45
- } | {
46
- type: 'skip';
47
- };
48
- /** Node graph edited in the dashboard: start -> conditions / splits -> variant or skip. */
49
- interface Flow {
50
- start: string;
51
- nodes: Record<string, FlowNode>;
52
- /** Editor positions, ignored by the SDK. */
53
- layout?: Record<string, {
54
- x: number;
55
- y: number;
56
- }>;
57
- }
58
- /** What the SDK knows about the visitor when assigning. Everything is optional. */
59
- interface TargetingContext {
60
- country?: string;
61
- region?: string;
62
- city?: string;
63
- device?: string;
64
- browser?: string;
65
- os?: string;
66
- /** Accept-Language / navigator.language. */
67
- language?: string;
68
- referrer?: string;
69
- /** Full URL (query included) of the current page / request. */
70
- url?: string;
71
- cookies?: Record<string, string>;
72
- /** `new` on the visit that created the visitor id, `returning` afterwards. */
73
- visitor?: 'new' | 'returning';
74
- /** Clock for `hour` / `weekday`, defaults to now. */
75
- now?: number;
76
- }
77
- interface ExperimentBase {
78
- status: ExperimentStatus;
79
- /** Targeting / branching graph. Omit to use plain weights for everyone. */
80
- flow?: Flow;
81
- /** Share of visitors entering the experiment, 0..1. Defaults to 1. The rest see the control without an exposure. */
82
- traffic?: number;
83
- /** Stop accepting new visitors after this many exposures (the cloud finishes the experiment). */
84
- maxExposures?: number;
85
- /** Only run between these moments (ISO 8601). Outside the window the experiment behaves as not running. */
86
- schedule?: {
87
- startAt?: string;
88
- endAt?: string;
89
- };
90
- /** Goal key from `goals`. Used as the primary metric for the verdict. */
91
- goal?: string;
92
- /** Hash seed. Change it to reshuffle every visitor. Defaults to the experiment key. */
93
- seed?: string;
94
- /** Free-form note shown in the dashboard and CLI. */
95
- description?: string;
96
- }
97
- interface ComponentExperimentInput extends ExperimentBase {
98
- kind: 'component';
99
- variants: Record<string, ComponentVariantInput>;
100
- }
101
- interface ValueExperimentInput extends ExperimentBase {
102
- kind: 'value';
103
- variants: Record<string, ValueVariantInput>;
104
- }
105
- interface RedirectExperimentInput extends ExperimentBase {
106
- kind: 'redirect';
107
- /** Path (or path prefix with trailing `*`) the redirect applies to. */
108
- match: string;
109
- variants: Record<string, RedirectVariantInput>;
110
- }
111
- /**
112
- * Multivariate: several factors change at once and every combination is a
113
- * variant. `{ headline: { old: 'Old', new: 'New' }, button: { red: '#f00', green: '#0f0' } }`
114
- * gives four variants; the first level of every factor is the control. Besides
115
- * the verdict over combinations, each factor is read on its own (main effects).
116
- * Keep it small: at most 4 factors, 4 levels each, 16 combinations.
117
- */
118
- interface MvtExperimentInput extends ExperimentBase {
119
- kind: 'mvt';
120
- factors: Record<string, Record<string, unknown>>;
121
- }
122
- type ExperimentInput = ComponentExperimentInput | ValueExperimentInput | RedirectExperimentInput | MvtExperimentInput;
123
- type GoalInput = {
124
- type: 'event';
125
- revenue?: boolean;
126
- description?: string;
127
- } | {
128
- type: 'pageview';
129
- path: string;
130
- description?: string;
131
- }
132
- /** Counted when a visitor clicks an element matching the CSS selector (auto-tracked by the SDK and the drop-in script). */
133
- | {
134
- type: 'click';
135
- selector: string;
136
- description?: string;
137
- };
138
- type StorageInput = {
139
- mode: 'cloud';
140
- /** Public project key (`pk_...`). Safe to ship to the browser. */
141
- key?: string;
142
- /** Override the cloud ingest URL (staging, self-hosted cloud). */
143
- endpoint?: string;
144
- } | {
145
- mode: 'self';
146
- /** URL of your own ingest route, e.g. `/api/splithub`. */
147
- endpoint: string;
148
- };
149
- interface SplitHubConfigInput {
150
- project: string;
151
- storage: StorageInput;
152
- goals?: Record<string, GoalInput>;
153
- experiments: Record<string, ExperimentInput>;
154
- /** Cookie / localStorage key for the visitor id. Defaults to `sh_vid`. */
155
- visitorKey?: string;
156
- /**
157
- * Treat `status: 'draft'` experiments as running while the app runs in
158
- * development (`NODE_ENV === 'development'`: `next dev`, `vite`). Lets you
159
- * see a test before you start it. Production builds ignore drafts as usual.
160
- */
161
- runDraftsInDev?: boolean;
162
- }
163
- interface Variant {
164
- key: string;
165
- /** Weight normalized to a share in 0..1. */
166
- weight: number;
167
- value?: unknown;
168
- to?: string;
169
- /** Multivariate: which level of each factor this combination uses. */
170
- levels?: Record<string, string>;
171
- }
172
- /** Multivariate factor: its levels in declared order (the first is the control level). */
173
- interface Factor {
174
- key: string;
175
- levels: string[];
176
- }
177
- interface Experiment {
178
- key: string;
179
- kind: ExperimentKind;
180
- status: ExperimentStatus;
181
- traffic: number;
182
- /** Exposure cap; null = unlimited. */
183
- maxExposures?: number | null;
184
- /** Run window; null = always. */
185
- schedule?: {
186
- startAt?: string | null;
187
- endAt?: string | null;
188
- } | null;
189
- goal: string | null;
190
- seed: string;
191
- description: string | null;
192
- match: string | null;
193
- /** Ordered: the first variant is the control. */
194
- variants: Variant[];
195
- /** Where the experiment was defined: the config file (default) or the cloud dashboard. */
196
- origin?: 'config' | 'dashboard';
197
- /** Targeting / branching graph; null or absent = plain weights. */
198
- flow?: Flow | null;
199
- /** Multivariate: the factors whose combinations the variants are. */
200
- factors?: Factor[];
201
- }
202
- interface Goal {
203
- key: string;
204
- type: 'event' | 'pageview' | 'click';
205
- path: string | null;
206
- /** CSS selector for click goals. */
207
- selector?: string | null;
208
- revenue: boolean;
209
- description: string | null;
210
- }
211
- interface SplitHubConfig {
212
- project: string;
213
- storage: StorageInput;
214
- visitorKey: string;
215
- runDraftsInDev: boolean;
216
- goals: Goal[];
217
- experiments: Experiment[];
218
- /** Branded marker so plain objects are rejected by the SDK. */
219
- readonly __splithub: 2;
220
- }
221
- interface ExposureEvent {
222
- id: string;
223
- type: 'exposure';
224
- exp: string;
225
- var: string;
226
- vid: string;
227
- sid: string;
228
- /** Unix ms. */
229
- ts: number;
230
- url?: string;
231
- }
232
- interface GoalEvent {
233
- id: string;
234
- type: 'goal';
235
- goal: string;
236
- vid: string;
237
- sid: string;
238
- ts: number;
239
- url?: string;
240
- props?: Record<string, unknown>;
241
- }
242
- type SplitHubEvent = ExposureEvent | GoalEvent;
243
- interface EventBatch {
244
- project: string;
245
- sdk: string;
246
- events: SplitHubEvent[];
247
- }
248
- interface Assignment {
249
- experiment: string;
250
- /** Null when the visitor is outside the traffic share or the experiment is not running. */
251
- variant: Variant | null;
252
- /** Why the variant was (not) assigned. Useful for `splithub doctor`. `dev`: a draft served because of `runDraftsInDev`. */
253
- reason: 'assigned' | 'dev' | 'not_running' | 'outside_traffic' | 'unknown_experiment' | 'override' | 'targeting';
254
- }
1
+ import { S as SplitHubConfigInput, a as SplitHubConfig, E as Experiment, V as Variant, F as Factor, T as TargetingContext, A as Assignment, b as Flow, c as TargetCondition, d as TargetField, e as TargetOp, f as EventBatch, g as SplitHubEvent, h as ExperimentStatus, G as Goal } from './types-V-RgA0yG.cjs';
2
+ export { m as ComponentExperimentInput, C as ComponentVariantInput, l as ExperimentBase, p as ExperimentInput, i as ExperimentKind, s as ExposureEvent, k as FlowNode, t as GoalEvent, q as GoalInput, M as MvtExperimentInput, o as RedirectExperimentInput, R as RedirectVariantInput, r as StorageInput, n as ValueExperimentInput, j as ValueVariantInput } from './types-V-RgA0yG.cjs';
255
3
 
256
4
  declare class ConfigError extends Error {
257
5
  constructor(message: string);
@@ -311,6 +59,13 @@ declare function controlVariant(experiment: Experiment): Variant;
311
59
  /** Parse `?sh_force=hero-cta:bold,pricing-title:urgency` into overrides. */
312
60
  declare function parseForceParam(search: string): Record<string, string>;
313
61
 
62
+ /** Print `message` once per `key` for this page or server process, in development only. */
63
+ declare function devNote(key: string, message: string): void;
64
+ /** Forget what was printed (tests). */
65
+ declare function resetDevNotes(): void;
66
+ /** Explain an assignment that may surprise a developer: a draft, a paused test, a test outside its dates. */
67
+ declare function explainAssignment(experiment: Experiment | undefined, a: Assignment): void;
68
+
314
69
  /**
315
70
  * MurmurHash3 (32-bit, x86). Deterministic across browser, Node and edge
316
71
  * runtimes, with a uniform distribution suitable for bucketing.
@@ -519,4 +274,4 @@ declare function debugLog(kind: DebugKind, message: string, data?: Record<string
519
274
  /** Subscribe to debug entries (the devtools panel). Returns an unsubscribe function. */
520
275
  declare function onDebug(listener: (e: DebugEntry) => void): () => void;
521
276
 
522
- export { type AssignOptions, type Assignment, CLOUD_ENDPOINT, type ClientOptions, type ComponentExperimentInput, type ComponentVariantInput, ConfigError, type DebugEntry, type DebugKind, EMPTY_OVERRIDES, type EventBatch, EventQueue, type EventQueueOptions, type Experiment, type ExperimentBase, type ExperimentInput, type ExperimentKind, type ExperimentOverride, type ExperimentStatus, type ExposureEvent, type Factor, type Flow, type FlowNode, type FlowOutcome, type Goal, type GoalEvent, type GoalInput, KEYED_FIELDS, MVT_MAX_COMBINATIONS, MVT_MAX_FACTORS, MVT_MAX_LEVELS, type MvtExperimentInput, REMOTE_TTL_MS, type RedirectExperimentInput, type RedirectVariantInput, type RemoteOverrides, SDK_VERSION, type SplitHubClient, type SplitHubConfig, type SplitHubConfigInput, type SplitHubEvent, type StorageInput, TARGET_FIELDS, TARGET_OPS, type TargetCondition, type TargetField, type TargetOp, type TargetingContext, type Transport, type TransportOptions, type ValueExperimentInput, type ValueVariantInput, type Variant, applyRemoteOverrides, assign, browserContext, contextValue, controlVariant, createClient, createFetchTransport, debugLog, debugMode, defineConfig, evaluateCondition, fetchRemoteOverrides, getExperiment, getOrCreateSessionId, getOrCreateVisitorId, hasVisitorId, hashToUnit, inSchedule, isActive, isBrowser, isDebug, isDevDraft, isDevEnvironment, isRemoteOverrides, isSplitHubConfig, matchConditions, murmur3, mvtVariants, newId, newSessionId, newVisitorId, onDebug, parseCookies, parseForceParam, parseUserAgent, pickVariant, readRemoteCache, resolveOverridesUrl, runFlow, validateFlow, writeRemoteCache };
277
+ export { type AssignOptions, Assignment, CLOUD_ENDPOINT, type ClientOptions, ConfigError, type DebugEntry, type DebugKind, EMPTY_OVERRIDES, EventBatch, EventQueue, type EventQueueOptions, Experiment, type ExperimentOverride, ExperimentStatus, Factor, Flow, type FlowOutcome, Goal, KEYED_FIELDS, MVT_MAX_COMBINATIONS, MVT_MAX_FACTORS, MVT_MAX_LEVELS, REMOTE_TTL_MS, type RemoteOverrides, SDK_VERSION, type SplitHubClient, SplitHubConfig, SplitHubConfigInput, SplitHubEvent, TARGET_FIELDS, TARGET_OPS, TargetCondition, TargetField, TargetOp, TargetingContext, type Transport, type TransportOptions, Variant, applyRemoteOverrides, assign, browserContext, contextValue, controlVariant, createClient, createFetchTransport, debugLog, debugMode, defineConfig, devNote, evaluateCondition, explainAssignment, fetchRemoteOverrides, getExperiment, getOrCreateSessionId, getOrCreateVisitorId, hasVisitorId, hashToUnit, inSchedule, isActive, isBrowser, isDebug, isDevDraft, isDevEnvironment, isRemoteOverrides, isSplitHubConfig, matchConditions, murmur3, mvtVariants, newId, newSessionId, newVisitorId, onDebug, parseCookies, parseForceParam, parseUserAgent, pickVariant, readRemoteCache, resetDevNotes, resolveOverridesUrl, runFlow, validateFlow, writeRemoteCache };
package/dist/index.d.ts CHANGED
@@ -1,257 +1,5 @@
1
- /**
2
- * SplitHub configuration types. `splithub.config.ts` is the single source of
3
- * truth for experiments: the SDK, the CLI, the self-hosted handler and the
4
- * cloud all read the same object.
5
- */
6
- type ExperimentStatus = 'draft' | 'running' | 'paused' | 'finished';
7
- type ExperimentKind = 'component' | 'value' | 'redirect' | 'mvt';
8
- /** Weight shorthand (`{ control: 50, bold: 50 }`) or a full variant object. */
9
- type ComponentVariantInput = number | {
10
- weight: number;
11
- };
12
- type ValueVariantInput = {
13
- weight: number;
14
- value: unknown;
15
- };
16
- type RedirectVariantInput = {
17
- weight: number;
18
- to: string;
19
- };
20
- type TargetField = 'country' | 'region' | 'city' | 'device' | 'browser' | 'os' | 'language' | 'referrer' | 'url' | 'path' | 'query' | 'utm_source' | 'utm_medium' | 'utm_campaign' | 'utm_term' | 'utm_content' | 'cookie' | 'visitor' | 'hour' | 'weekday';
21
- type TargetOp = 'is' | 'is_not' | 'contains' | 'not_contains' | 'starts_with' | 'in' | 'not_in' | 'matches' | 'exists' | 'not_exists';
22
- interface TargetCondition {
23
- field: TargetField;
24
- op: TargetOp;
25
- /** Parameter / cookie name for `query` and `cookie`. */
26
- key?: string;
27
- /** Comparison value; comma-separated list for `in` / `not_in`; regex for `matches`. */
28
- value?: string;
29
- }
30
- type FlowNode = {
31
- type: 'condition';
32
- conditions: TargetCondition[];
33
- match?: 'all' | 'any';
34
- then: string;
35
- else?: string | null;
36
- } | {
37
- type: 'split';
38
- outputs: Array<{
39
- weight: number;
40
- to: string;
41
- }>;
42
- } | {
43
- type: 'variant';
44
- variant: string;
45
- } | {
46
- type: 'skip';
47
- };
48
- /** Node graph edited in the dashboard: start -> conditions / splits -> variant or skip. */
49
- interface Flow {
50
- start: string;
51
- nodes: Record<string, FlowNode>;
52
- /** Editor positions, ignored by the SDK. */
53
- layout?: Record<string, {
54
- x: number;
55
- y: number;
56
- }>;
57
- }
58
- /** What the SDK knows about the visitor when assigning. Everything is optional. */
59
- interface TargetingContext {
60
- country?: string;
61
- region?: string;
62
- city?: string;
63
- device?: string;
64
- browser?: string;
65
- os?: string;
66
- /** Accept-Language / navigator.language. */
67
- language?: string;
68
- referrer?: string;
69
- /** Full URL (query included) of the current page / request. */
70
- url?: string;
71
- cookies?: Record<string, string>;
72
- /** `new` on the visit that created the visitor id, `returning` afterwards. */
73
- visitor?: 'new' | 'returning';
74
- /** Clock for `hour` / `weekday`, defaults to now. */
75
- now?: number;
76
- }
77
- interface ExperimentBase {
78
- status: ExperimentStatus;
79
- /** Targeting / branching graph. Omit to use plain weights for everyone. */
80
- flow?: Flow;
81
- /** Share of visitors entering the experiment, 0..1. Defaults to 1. The rest see the control without an exposure. */
82
- traffic?: number;
83
- /** Stop accepting new visitors after this many exposures (the cloud finishes the experiment). */
84
- maxExposures?: number;
85
- /** Only run between these moments (ISO 8601). Outside the window the experiment behaves as not running. */
86
- schedule?: {
87
- startAt?: string;
88
- endAt?: string;
89
- };
90
- /** Goal key from `goals`. Used as the primary metric for the verdict. */
91
- goal?: string;
92
- /** Hash seed. Change it to reshuffle every visitor. Defaults to the experiment key. */
93
- seed?: string;
94
- /** Free-form note shown in the dashboard and CLI. */
95
- description?: string;
96
- }
97
- interface ComponentExperimentInput extends ExperimentBase {
98
- kind: 'component';
99
- variants: Record<string, ComponentVariantInput>;
100
- }
101
- interface ValueExperimentInput extends ExperimentBase {
102
- kind: 'value';
103
- variants: Record<string, ValueVariantInput>;
104
- }
105
- interface RedirectExperimentInput extends ExperimentBase {
106
- kind: 'redirect';
107
- /** Path (or path prefix with trailing `*`) the redirect applies to. */
108
- match: string;
109
- variants: Record<string, RedirectVariantInput>;
110
- }
111
- /**
112
- * Multivariate: several factors change at once and every combination is a
113
- * variant. `{ headline: { old: 'Old', new: 'New' }, button: { red: '#f00', green: '#0f0' } }`
114
- * gives four variants; the first level of every factor is the control. Besides
115
- * the verdict over combinations, each factor is read on its own (main effects).
116
- * Keep it small: at most 4 factors, 4 levels each, 16 combinations.
117
- */
118
- interface MvtExperimentInput extends ExperimentBase {
119
- kind: 'mvt';
120
- factors: Record<string, Record<string, unknown>>;
121
- }
122
- type ExperimentInput = ComponentExperimentInput | ValueExperimentInput | RedirectExperimentInput | MvtExperimentInput;
123
- type GoalInput = {
124
- type: 'event';
125
- revenue?: boolean;
126
- description?: string;
127
- } | {
128
- type: 'pageview';
129
- path: string;
130
- description?: string;
131
- }
132
- /** Counted when a visitor clicks an element matching the CSS selector (auto-tracked by the SDK and the drop-in script). */
133
- | {
134
- type: 'click';
135
- selector: string;
136
- description?: string;
137
- };
138
- type StorageInput = {
139
- mode: 'cloud';
140
- /** Public project key (`pk_...`). Safe to ship to the browser. */
141
- key?: string;
142
- /** Override the cloud ingest URL (staging, self-hosted cloud). */
143
- endpoint?: string;
144
- } | {
145
- mode: 'self';
146
- /** URL of your own ingest route, e.g. `/api/splithub`. */
147
- endpoint: string;
148
- };
149
- interface SplitHubConfigInput {
150
- project: string;
151
- storage: StorageInput;
152
- goals?: Record<string, GoalInput>;
153
- experiments: Record<string, ExperimentInput>;
154
- /** Cookie / localStorage key for the visitor id. Defaults to `sh_vid`. */
155
- visitorKey?: string;
156
- /**
157
- * Treat `status: 'draft'` experiments as running while the app runs in
158
- * development (`NODE_ENV === 'development'`: `next dev`, `vite`). Lets you
159
- * see a test before you start it. Production builds ignore drafts as usual.
160
- */
161
- runDraftsInDev?: boolean;
162
- }
163
- interface Variant {
164
- key: string;
165
- /** Weight normalized to a share in 0..1. */
166
- weight: number;
167
- value?: unknown;
168
- to?: string;
169
- /** Multivariate: which level of each factor this combination uses. */
170
- levels?: Record<string, string>;
171
- }
172
- /** Multivariate factor: its levels in declared order (the first is the control level). */
173
- interface Factor {
174
- key: string;
175
- levels: string[];
176
- }
177
- interface Experiment {
178
- key: string;
179
- kind: ExperimentKind;
180
- status: ExperimentStatus;
181
- traffic: number;
182
- /** Exposure cap; null = unlimited. */
183
- maxExposures?: number | null;
184
- /** Run window; null = always. */
185
- schedule?: {
186
- startAt?: string | null;
187
- endAt?: string | null;
188
- } | null;
189
- goal: string | null;
190
- seed: string;
191
- description: string | null;
192
- match: string | null;
193
- /** Ordered: the first variant is the control. */
194
- variants: Variant[];
195
- /** Where the experiment was defined: the config file (default) or the cloud dashboard. */
196
- origin?: 'config' | 'dashboard';
197
- /** Targeting / branching graph; null or absent = plain weights. */
198
- flow?: Flow | null;
199
- /** Multivariate: the factors whose combinations the variants are. */
200
- factors?: Factor[];
201
- }
202
- interface Goal {
203
- key: string;
204
- type: 'event' | 'pageview' | 'click';
205
- path: string | null;
206
- /** CSS selector for click goals. */
207
- selector?: string | null;
208
- revenue: boolean;
209
- description: string | null;
210
- }
211
- interface SplitHubConfig {
212
- project: string;
213
- storage: StorageInput;
214
- visitorKey: string;
215
- runDraftsInDev: boolean;
216
- goals: Goal[];
217
- experiments: Experiment[];
218
- /** Branded marker so plain objects are rejected by the SDK. */
219
- readonly __splithub: 2;
220
- }
221
- interface ExposureEvent {
222
- id: string;
223
- type: 'exposure';
224
- exp: string;
225
- var: string;
226
- vid: string;
227
- sid: string;
228
- /** Unix ms. */
229
- ts: number;
230
- url?: string;
231
- }
232
- interface GoalEvent {
233
- id: string;
234
- type: 'goal';
235
- goal: string;
236
- vid: string;
237
- sid: string;
238
- ts: number;
239
- url?: string;
240
- props?: Record<string, unknown>;
241
- }
242
- type SplitHubEvent = ExposureEvent | GoalEvent;
243
- interface EventBatch {
244
- project: string;
245
- sdk: string;
246
- events: SplitHubEvent[];
247
- }
248
- interface Assignment {
249
- experiment: string;
250
- /** Null when the visitor is outside the traffic share or the experiment is not running. */
251
- variant: Variant | null;
252
- /** Why the variant was (not) assigned. Useful for `splithub doctor`. `dev`: a draft served because of `runDraftsInDev`. */
253
- reason: 'assigned' | 'dev' | 'not_running' | 'outside_traffic' | 'unknown_experiment' | 'override' | 'targeting';
254
- }
1
+ import { S as SplitHubConfigInput, a as SplitHubConfig, E as Experiment, V as Variant, F as Factor, T as TargetingContext, A as Assignment, b as Flow, c as TargetCondition, d as TargetField, e as TargetOp, f as EventBatch, g as SplitHubEvent, h as ExperimentStatus, G as Goal } from './types-V-RgA0yG.js';
2
+ export { m as ComponentExperimentInput, C as ComponentVariantInput, l as ExperimentBase, p as ExperimentInput, i as ExperimentKind, s as ExposureEvent, k as FlowNode, t as GoalEvent, q as GoalInput, M as MvtExperimentInput, o as RedirectExperimentInput, R as RedirectVariantInput, r as StorageInput, n as ValueExperimentInput, j as ValueVariantInput } from './types-V-RgA0yG.js';
255
3
 
256
4
  declare class ConfigError extends Error {
257
5
  constructor(message: string);
@@ -311,6 +59,13 @@ declare function controlVariant(experiment: Experiment): Variant;
311
59
  /** Parse `?sh_force=hero-cta:bold,pricing-title:urgency` into overrides. */
312
60
  declare function parseForceParam(search: string): Record<string, string>;
313
61
 
62
+ /** Print `message` once per `key` for this page or server process, in development only. */
63
+ declare function devNote(key: string, message: string): void;
64
+ /** Forget what was printed (tests). */
65
+ declare function resetDevNotes(): void;
66
+ /** Explain an assignment that may surprise a developer: a draft, a paused test, a test outside its dates. */
67
+ declare function explainAssignment(experiment: Experiment | undefined, a: Assignment): void;
68
+
314
69
  /**
315
70
  * MurmurHash3 (32-bit, x86). Deterministic across browser, Node and edge
316
71
  * runtimes, with a uniform distribution suitable for bucketing.
@@ -519,4 +274,4 @@ declare function debugLog(kind: DebugKind, message: string, data?: Record<string
519
274
  /** Subscribe to debug entries (the devtools panel). Returns an unsubscribe function. */
520
275
  declare function onDebug(listener: (e: DebugEntry) => void): () => void;
521
276
 
522
- export { type AssignOptions, type Assignment, CLOUD_ENDPOINT, type ClientOptions, type ComponentExperimentInput, type ComponentVariantInput, ConfigError, type DebugEntry, type DebugKind, EMPTY_OVERRIDES, type EventBatch, EventQueue, type EventQueueOptions, type Experiment, type ExperimentBase, type ExperimentInput, type ExperimentKind, type ExperimentOverride, type ExperimentStatus, type ExposureEvent, type Factor, type Flow, type FlowNode, type FlowOutcome, type Goal, type GoalEvent, type GoalInput, KEYED_FIELDS, MVT_MAX_COMBINATIONS, MVT_MAX_FACTORS, MVT_MAX_LEVELS, type MvtExperimentInput, REMOTE_TTL_MS, type RedirectExperimentInput, type RedirectVariantInput, type RemoteOverrides, SDK_VERSION, type SplitHubClient, type SplitHubConfig, type SplitHubConfigInput, type SplitHubEvent, type StorageInput, TARGET_FIELDS, TARGET_OPS, type TargetCondition, type TargetField, type TargetOp, type TargetingContext, type Transport, type TransportOptions, type ValueExperimentInput, type ValueVariantInput, type Variant, applyRemoteOverrides, assign, browserContext, contextValue, controlVariant, createClient, createFetchTransport, debugLog, debugMode, defineConfig, evaluateCondition, fetchRemoteOverrides, getExperiment, getOrCreateSessionId, getOrCreateVisitorId, hasVisitorId, hashToUnit, inSchedule, isActive, isBrowser, isDebug, isDevDraft, isDevEnvironment, isRemoteOverrides, isSplitHubConfig, matchConditions, murmur3, mvtVariants, newId, newSessionId, newVisitorId, onDebug, parseCookies, parseForceParam, parseUserAgent, pickVariant, readRemoteCache, resolveOverridesUrl, runFlow, validateFlow, writeRemoteCache };
277
+ export { type AssignOptions, Assignment, CLOUD_ENDPOINT, type ClientOptions, ConfigError, type DebugEntry, type DebugKind, EMPTY_OVERRIDES, EventBatch, EventQueue, type EventQueueOptions, Experiment, type ExperimentOverride, ExperimentStatus, Factor, Flow, type FlowOutcome, Goal, KEYED_FIELDS, MVT_MAX_COMBINATIONS, MVT_MAX_FACTORS, MVT_MAX_LEVELS, REMOTE_TTL_MS, type RemoteOverrides, SDK_VERSION, type SplitHubClient, SplitHubConfig, SplitHubConfigInput, SplitHubEvent, TARGET_FIELDS, TARGET_OPS, TargetCondition, TargetField, TargetOp, TargetingContext, type Transport, type TransportOptions, Variant, applyRemoteOverrides, assign, browserContext, contextValue, controlVariant, createClient, createFetchTransport, debugLog, debugMode, defineConfig, devNote, evaluateCondition, explainAssignment, fetchRemoteOverrides, getExperiment, getOrCreateSessionId, getOrCreateVisitorId, hasVisitorId, hashToUnit, inSchedule, isActive, isBrowser, isDebug, isDevDraft, isDevEnvironment, isRemoteOverrides, isSplitHubConfig, matchConditions, murmur3, mvtVariants, newId, newSessionId, newVisitorId, onDebug, parseCookies, parseForceParam, parseUserAgent, pickVariant, readRemoteCache, resetDevNotes, resolveOverridesUrl, runFlow, validateFlow, writeRemoteCache };