@avsbhq/vue 1.0.2 → 1.1.1

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,95 +1,89 @@
1
1
  import * as vue from 'vue';
2
2
  import { PropType, Plugin, InjectionKey, Ref, ComputedRef } from 'vue';
3
- import { InitResult, EvalContext, Flag, TrackPayload, ClientEventName, ClientEventMap } from '@avsbhq/core';
4
- export { ClientEventMap, ClientEventName, DecideOption, EvalContext, EvaluationSource, Flag, FlagDatafile, FlagDatafileAudience, FlagDatafileEntry, FlagDatafileOverride, FlagDatafileRule, FlagDatafileVariation, InitResult, Logger, MultiContext, SingleContext, TrackPayload } from '@avsbhq/core';
3
+ import { EvalContext, FlagDatafile, AvsbFlagKey, Flag, TrackPayload } from '@avsbhq/core';
4
+ export { ClientEventMap, ClientEventName, DecideOption, EvalContext, EvaluationSource, Flag, FlagDatafile, FlagDatafileAudience, FlagDatafileEntry, FlagDatafileOverride, FlagDatafileRule, FlagDatafileVariation, InitResult, Logger, MultiContext, RuleType, SingleContext, TrackPayload } from '@avsbhq/core';
5
+ import { V as VueAvsbClient } from './clientInterface-BMlQ7Uhe.cjs';
6
+ import { b as AvsbProviderOptions, d as AvsbStatus } from './types-DECMgjjk.cjs';
7
+ export { A as AvsbProviderModeAProps, a as AvsbProviderModeBProps, c as AvsbProviderProps } from './types-DECMgjjk.cjs';
5
8
  import { AvsbClientOptions } from '@avsbhq/browser';
6
- export { AvsbClientOptions } from '@avsbhq/browser';
7
- import * as pinia from 'pinia';
8
-
9
- /**
10
- * The surface of AvsbClient that @avsbhq/vue depends on.
11
- *
12
- * This interface describes the new browser SDK surface being added in
13
- * CoW 3 (sdk-launch-readiness). Until @avsbhq/browser ships the full
14
- * implementation, the Vue package compiles against this interface rather
15
- * than the concrete class, avoiding cross-package coupling during the
16
- * in-progress reshape.
17
- *
18
- * When the browser SDK reshape lands, AvsbClient will satisfy this
19
- * interface structurally — no cast required. Until then, any runtime
20
- * use of these methods is guarded with `typeof client.method === 'function'`
21
- * checks in each composable.
22
- */
23
-
24
- interface VueAvsbClient {
25
- onReady(): Promise<InitResult>;
26
- close(): Promise<void>;
27
- flush(): Promise<void>;
28
- identify(ctx: EvalContext): void;
29
- updateAttributes(partial: Record<string, unknown>, kind?: string): void;
30
- alias(prev: EvalContext, next: EvalContext): Promise<void>;
31
- getContext(): EvalContext;
32
- reset(): void;
33
- getFlag<T>(key: string, defaultValue: T): Flag<T>;
34
- getBoolFlag(key: string, defaultValue: boolean): Flag<boolean>;
35
- getStringFlag(key: string, defaultValue: string): Flag<string>;
36
- getNumberFlag(key: string, defaultValue: number): Flag<number>;
37
- getJsonFlag<T>(key: string, defaultValue: T): Flag<T>;
38
- getAllFlags(options?: {
39
- fireExposures?: boolean;
40
- }): Record<string, Flag>;
41
- /** Subscribe to changes for a specific flagKey; returns unsubscribe. */
42
- subscribe(flagKey: string, listener: () => void): () => void;
43
- /** Return a stable Flag<T> snapshot without firing an exposure event. */
44
- getSnapshot<T>(flagKey: string, defaultValue: T): Flag<T>;
45
- track(eventKey: string, payload?: TrackPayload): void;
46
- on<E extends ClientEventName>(event: E, cb: ClientEventMap[E]): () => void;
47
- setOverrideForUser(flagKey: string, contextKey: string, variationKey: string, contextKind?: string): void;
48
- setGlobalOverride(flagKey: string, variationKey: string): void;
49
- clearOverrideForUser(flagKey: string, contextKey: string, contextKind?: string): void;
50
- clearGlobalOverride(flagKey: string): void;
51
- clearAllOverrides(): void;
52
- }
9
+ export { AvsbClientOptions, GetAllFlagsOptions, GetFlagOptions } from '@avsbhq/browser';
53
10
 
54
11
  declare const AvsbProvider: vue.DefineComponent<vue.ExtractPropTypes<{
12
+ /** Mode B: a client you built and own. */
55
13
  client: {
56
14
  type: PropType<VueAvsbClient>;
57
15
  default: undefined;
58
16
  };
17
+ /** Mode A: the environment's SDK key. */
59
18
  sdkKey: {
60
19
  type: StringConstructor;
61
20
  default: undefined;
62
21
  };
22
+ /** Mode A: evaluation context. Omit for an anonymous visitor. */
23
+ context: {
24
+ type: PropType<EvalContext>;
25
+ default: undefined;
26
+ };
27
+ /** Mode A: a datafile fetched on the server, for a real first paint. */
28
+ bootstrap: {
29
+ type: PropType<FlagDatafile>;
30
+ default: undefined;
31
+ };
32
+ /** Mode A: everything else AvsbClient accepts. */
33
+ options: {
34
+ type: PropType<AvsbProviderOptions>;
35
+ default: undefined;
36
+ };
63
37
  }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
64
38
  [key: string]: any;
65
39
  }>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
40
+ /** Mode B: a client you built and own. */
66
41
  client: {
67
42
  type: PropType<VueAvsbClient>;
68
43
  default: undefined;
69
44
  };
45
+ /** Mode A: the environment's SDK key. */
70
46
  sdkKey: {
71
47
  type: StringConstructor;
72
48
  default: undefined;
73
49
  };
50
+ /** Mode A: evaluation context. Omit for an anonymous visitor. */
51
+ context: {
52
+ type: PropType<EvalContext>;
53
+ default: undefined;
54
+ };
55
+ /** Mode A: a datafile fetched on the server, for a real first paint. */
56
+ bootstrap: {
57
+ type: PropType<FlagDatafile>;
58
+ default: undefined;
59
+ };
60
+ /** Mode A: everything else AvsbClient accepts. */
61
+ options: {
62
+ type: PropType<AvsbProviderOptions>;
63
+ default: undefined;
64
+ };
74
65
  }>> & Readonly<{}>, {
75
- client: VueAvsbClient;
76
66
  sdkKey: string;
67
+ context: EvalContext;
68
+ bootstrap: FlagDatafile;
69
+ options: AvsbProviderOptions;
70
+ client: VueAvsbClient;
77
71
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
78
72
 
79
73
  /**
80
- * AvsbPlugin: Vue plugin alternative to mounting <AvsbProvider>.
74
+ * AvsbPlugin: the `app.use()` form of <AvsbProvider>.
81
75
  *
82
- * Usage:
83
- * // Mode A: SDK creates and owns the client
84
- * app.use(AvsbPlugin, { sdkKey: 'sdk-xxx', attributes: { userId: 'u_1' } })
76
+ * // Mode A: the plugin builds and owns the client
77
+ * app.use(AvsbPlugin, {
78
+ * sdkKey: 'sdk_production_...',
79
+ * context: { kind: 'user', key: userId },
80
+ * })
85
81
  *
86
- * // Mode B: pass a pre-built client
87
- * app.use(AvsbPlugin, { client: myClient })
82
+ * // Mode B: you built the client, you own it
83
+ * app.use(AvsbPlugin, { client })
88
84
  *
89
- * The plugin installs AvsbProvider semantics at the app level via
90
- * app.provide(). It is equivalent to wrapping the root component in
91
- * <AvsbProvider>, but works better with apps that prefer the plugin
92
- * pattern over SFC wrapper components.
85
+ * Identical semantics to the component, provided at app level instead of at
86
+ * a subtree, which is what you want when the whole app reads flags.
93
87
  */
94
88
 
95
89
  type AvsbPluginOptions = (AvsbClientOptions & {
@@ -100,180 +94,216 @@ type AvsbPluginOptions = (AvsbClientOptions & {
100
94
  declare const AvsbPlugin: Plugin<AvsbPluginOptions>;
101
95
 
102
96
  interface AvsbContextValue {
103
- client: VueAvsbClient | null;
104
- status: 'loading' | 'ready' | 'error';
105
- error?: Error;
97
+ client: VueAvsbClient;
98
+ status: AvsbStatus;
99
+ /**
100
+ * The last error the SDK reported. Present while `status` is `'error'`,
101
+ * and also present with `status: 'ready'` when a refresh failed while
102
+ * cached flags are still being served (`degraded`).
103
+ */
104
+ error: Error | undefined;
105
+ /** Serving a stale bootstrap or cached datafile after a failed refresh. */
106
+ degraded: boolean;
106
107
  }
107
108
  declare const AvsbInjectionKey: InjectionKey<AvsbContextValue>;
108
109
 
110
+ /** A flag key, or a ref holding one. */
111
+ type FlagKeyInput = AvsbFlagKey | Ref<AvsbFlagKey> | ComputedRef<AvsbFlagKey>;
112
+
109
113
  /**
110
- * §5.13 + §5.14: Subscribe to a single flag.
114
+ * Read one flag and re-render when it changes.
111
115
  *
112
- * Returns `ComputedRef<Flag<T>>` (not raw `T`). The computed re-evaluates
113
- * only when the value of `flagKey` changes via the subscribe callback.
116
+ * Returns `ComputedRef<Flag<T>>`, so in `<script setup>` the value is
117
+ * `flag.value.value`: the outer `.value` unwraps Vue's ref, the inner one is
118
+ * the flag's value. Templates unwrap the ref for you, so there it is
119
+ * `flag.value`. See the README section "Why .value.value".
114
120
  *
115
- * When flagKey is a Ref or ComputedRef, the subscription updates reactively
116
- * when the key changes (watchEffect re-subscribes).
121
+ * `flagKey` may be a string or a ref; a ref re-subscribes when it changes.
117
122
  *
118
- * For a plain `T` shortcut, use `useFlagValue()`.
123
+ * The read is render-safe: the same frozen object comes back until the value
124
+ * actually changes, and no exposure is recorded. Use `useExposure` where the
125
+ * decision is really shown to the visitor.
119
126
  */
120
- declare function useFlag<T>(flagKey: string | Ref<string> | ComputedRef<string>, defaultValue: T): ComputedRef<Flag<T>>;
127
+ declare function useFlag<T>(flagKey: FlagKeyInput, defaultValue: T): ComputedRef<Flag<T>>;
121
128
 
122
129
  /**
123
- * §5.16: Convenience shortcut that returns the flag's raw value `T`
124
- * instead of the full `Flag<T>` object.
130
+ * The flag's value on its own, with no `Flag<T>` wrapper: one `.value` in
131
+ * script, and none in a template.
125
132
  *
126
- * Use `useFlag()` when you need `variationKey`, `source`, `reasons`, or
127
- * other evaluation metadata. Use this composable when you only care about
128
- * the value itself.
133
+ * Use `useFlag` when you also want `variationKey`, `source`, or `reasons`.
129
134
  */
130
- declare function useFlagValue<T>(flagKey: string | Ref<string> | ComputedRef<string>, defaultValue: T): ComputedRef<T>;
135
+ declare function useFlagValue<T>(flagKey: FlagKeyInput, defaultValue: T): ComputedRef<T>;
131
136
 
132
137
  /**
133
- * §5.16: Typed boolean flag composable.
138
+ * Read a boolean flag, type-checked against the type the platform declared
139
+ * for it.
134
140
  *
135
- * Calls `client.getBoolFlag` under the hood, which performs a runtime
136
- * type check against the datafile's declared flag type and logs a warning
137
- * on mismatch before returning the default.
141
+ * On a mismatch nothing throws: the SDK logs one warning naming the flag and
142
+ * the getter, and you get your `defaultValue` back with
143
+ * `source: 'not_found'`.
138
144
  *
139
- * Returns `ComputedRef<Flag<boolean>>`.
145
+ * Render-safe: no exposure is recorded (see `useExposure`).
140
146
  */
141
- declare function useBoolFlag(flagKey: string, defaultValue: boolean): ComputedRef<Flag<boolean>>;
147
+ declare function useBoolFlag(flagKey: FlagKeyInput, defaultValue: boolean): ComputedRef<Flag<boolean>>;
142
148
 
143
149
  /**
144
- * §5.16: Typed string flag composable.
145
- *
146
- * Calls `client.getStringFlag` under the hood, which performs a runtime
147
- * type check against the datafile's declared flag type and logs a warning
148
- * on mismatch before returning the default.
150
+ * Read a string flag, type-checked against the type the platform declared
151
+ * for it. A mismatch logs one warning and returns your `defaultValue`.
149
152
  *
150
- * Returns `ComputedRef<Flag<string>>`.
153
+ * Render-safe: no exposure is recorded (see `useExposure`).
151
154
  */
152
- declare function useStringFlag(flagKey: string, defaultValue: string): ComputedRef<Flag<string>>;
155
+ declare function useStringFlag(flagKey: FlagKeyInput, defaultValue: string): ComputedRef<Flag<string>>;
153
156
 
154
157
  /**
155
- * §5.16: Typed number flag composable.
158
+ * Read a number flag, type-checked against the type the platform declared
159
+ * for it. A mismatch logs one warning and returns your `defaultValue`.
156
160
  *
157
- * Calls `client.getNumberFlag` under the hood, which performs a runtime
158
- * type check against the datafile's declared flag type and logs a warning
159
- * on mismatch before returning the default.
160
- *
161
- * Returns `ComputedRef<Flag<number>>`.
161
+ * Render-safe: no exposure is recorded (see `useExposure`).
162
162
  */
163
- declare function useNumberFlag(flagKey: string, defaultValue: number): ComputedRef<Flag<number>>;
163
+ declare function useNumberFlag(flagKey: FlagKeyInput, defaultValue: number): ComputedRef<Flag<number>>;
164
164
 
165
165
  /**
166
- * §5.16: Typed JSON flag composable.
166
+ * Read a JSON flag as `Flag<T>`.
167
167
  *
168
- * Calls `client.getJsonFlag` under the hood, which performs a runtime
169
- * type check against the datafile's declared flag type and logs a warning
170
- * on mismatch before returning the default.
168
+ * The runtime check is that the platform declared this flag as JSON; the
169
+ * shape of `T` is not validated. Validate the payload yourself (zod, a type
170
+ * guard) if it crosses a trust boundary.
171
171
  *
172
- * Returns `ComputedRef<Flag<T>>` where `T` is your expected JSON shape.
172
+ * Render-safe: no exposure is recorded (see `useExposure`).
173
173
  */
174
- declare function useJsonFlag<T>(flagKey: string, defaultValue: T): ComputedRef<Flag<T>>;
174
+ declare function useJsonFlag<T>(flagKey: FlagKeyInput, defaultValue: T): ComputedRef<Flag<T>>;
175
175
 
176
176
  /**
177
- * §5.16: Returns `ComputedRef<Record<string, Flag>>` containing all
178
- * evaluated flags.
177
+ * Every flag in the environment, keyed by flag key.
179
178
  *
180
- * Subscribes to the global `'flagChange'` event bus rather than per-flag
181
- * subscriptions. Any flag change causes re-evaluation of all flags.
179
+ * Re-computes on any flag change, so prefer `useFlag` in components that
180
+ * read one flag. This is for debug panels and admin views.
182
181
  *
183
- * Use this composable for dashboards or debug panels that display the full
184
- * flag state. For individual flag reads, prefer `useFlag()` which only
185
- * re-renders on changes to that specific flag.
182
+ * Exposures are suppressed, and the SDK returns the same object between
183
+ * changes, so this is safe to read on every render. Before the SDK is ready
184
+ * it is `{}` and the SDK logs one line saying why, rather than looking like
185
+ * a project with no flags.
186
186
  */
187
187
  declare function useAllFlags(): ComputedRef<Record<string, Flag>>;
188
188
 
189
189
  /**
190
- * §5.15: Returns `ComputedRef<boolean>` that is `true` once the
191
- * Provider's client is ready.
190
+ * `true` once flags are readable.
192
191
  *
193
- * Simple boolean alternative to reading status directly for components
194
- * that only need to gate rendering on readiness.
192
+ * A degraded client (serving a cached datafile after a failed refresh) is
193
+ * ready: flags answer, they may be stale. Use `useAvsbStatus` when you need
194
+ * to tell those two apart, or to show the error.
195
195
  */
196
196
  declare function useFlagReady(): ComputedRef<boolean>;
197
197
 
198
+ interface UseAvsbStatusResult {
199
+ /** `'loading'` | `'ready'` | `'error'`. */
200
+ status: ComputedRef<AvsbStatus>;
201
+ /**
202
+ * The last error the SDK reported, if any. Present with `status: 'error'`,
203
+ * and also with `status: 'ready'` when `degraded` is true.
204
+ */
205
+ error: ComputedRef<Error | undefined>;
206
+ /**
207
+ * `true` when flags are being served from a bootstrap or the cache after a
208
+ * refresh failed. Values still answer; they may be stale.
209
+ */
210
+ degraded: ComputedRef<boolean>;
211
+ }
212
+ /**
213
+ * The provider's status, error, and staleness, as refs.
214
+ *
215
+ * const { status, error, degraded } = useAvsbStatus()
216
+ *
217
+ * `status.value === 'error'` means nothing loaded and every flag is
218
+ * returning the default you passed; `error.value.message` names the HTTP
219
+ * status, the URL tried, and the fix.
220
+ */
221
+ declare function useAvsbStatus(): UseAvsbStatusResult;
222
+
198
223
  /**
199
- * Returns the underlying `AvsbClient` instance (or `null` while loading).
224
+ * The underlying client, for the things composables do not cover: runtime
225
+ * overrides, `flush()`, `refresh()`, `updateAttributes()`.
200
226
  *
201
- * The type is `VueAvsbClient`, the interface declaring the surface this
202
- * package uses. Once @avsbhq/browser ships the full reshape, `AvsbClient`
203
- * satisfies this interface structurally.
227
+ * Never null: a provider either has a client or throws at setup.
204
228
  *
205
- * Prefer typed flag composables (`useFlag`, `useBoolFlag`, etc.) for feature
206
- * flag reads. Use this composable when you need low-level SDK access (e.g.
207
- * manual `flush()`, direct `track()`).
229
+ * Prefer `useFlag` and friends for reading flags; a direct `client.getFlag`
230
+ * in a component body fires an exposure on every render.
208
231
  */
209
- declare function useAvsbClient(): VueAvsbClient | null;
232
+ declare function useAvsbClient(): VueAvsbClient;
210
233
 
211
234
  /**
212
- * §5.16: Returns a stable `identify` function.
235
+ * Replace the evaluation context, typically after sign-in.
236
+ *
237
+ * Every flag is re-evaluated, changed flags notify their subscribers, and
238
+ * bucketing rehashes immediately.
213
239
  *
214
- * Calling `identify(ctx)` replaces the client's current evaluation context.
215
- * All subsequent flag evaluations and exposure events use the new context.
216
- * Triggers re-evaluation for any `useFlag` subscribers whose values changed.
240
+ * The returned function is created once per component, so it is safe to pass
241
+ * straight to an event handler.
242
+ */
243
+ declare function useIdentify(): (context: EvalContext) => void;
244
+
245
+ /**
246
+ * Record that an anonymous visitor and a signed-in user are the same person,
247
+ * so results can stitch the two sessions together.
217
248
  *
218
- * @returns `(ctx: EvalContext) => void`
249
+ * Synchronous: it queues one `avsb_alias` event and returns. There is
250
+ * nothing to await, and it does not rewrite assignments already made. To
251
+ * carry bucketing across a login, evaluate with the same context key on both
252
+ * sides.
219
253
  */
220
- declare function useIdentify(): (ctx: EvalContext) => void;
254
+ declare function useAlias(): (previousContext: EvalContext, newContext: EvalContext) => void;
221
255
 
222
256
  /**
223
- * §5.16: Returns a stable `alias` function.
257
+ * Return to a new anonymous identity and clear runtime overrides. Call this
258
+ * on sign-out.
224
259
  *
225
- * Calling `alias(prev, next)` records that two contexts represent the
226
- * same user identity (e.g. anonymous visitor → identified user after
227
- * sign-in). Used by the analytics backend to stitch sessions.
260
+ * The persisted visitor id is rotated, so the next anonymous session is
261
+ * genuinely a different visitor rather than the person who just signed out.
228
262
  *
229
- * @returns `(prev: EvalContext, next: EvalContext) => Promise<void>`
263
+ * One caveat when the A vs B web snippet is on the same page: the snippet
264
+ * owns the visitor cookie and this SDK only reads it, so the next page load
265
+ * adopts the snippet's id again unless the client was built with
266
+ * `adoptSnippetVisitorId: false`.
230
267
  */
231
- declare function useAlias(): (prev: EvalContext, next: EvalContext) => Promise<void>;
268
+ declare function useReset(): () => void;
232
269
 
233
270
  /**
234
- * §5.16: Returns a stable `track` function that survives the
235
- * loading → ready transition without changing its reference.
271
+ * Send a conversion or metric event.
236
272
  *
237
- * The function delegates to `client.track()` via a ref so that callers
238
- * do not need to call `useTrack` again when the client becomes ready.
273
+ * const track = useTrack()
274
+ * track('checkout_started', { value: 99, properties: { step: 'cart' } })
239
275
  *
240
- * @returns `(eventKey: string, payload?: TrackPayload) => void`
276
+ * Events tracked before the SDK is ready are held (bounded) and flushed as
277
+ * soon as it is. The returned function is created once per component, so it
278
+ * is safe to use directly as an event handler.
241
279
  */
242
280
  declare function useTrack(): (eventKey: string, payload?: TrackPayload) => void;
243
281
 
244
- declare const useAvsbStore: pinia.StoreDefinition<"avsb", Pick<{
245
- client: vue.ComputedRef<VueAvsbClient | null>;
246
- status: vue.ComputedRef<"ready" | "error" | "loading">;
247
- error: vue.ComputedRef<Error | undefined>;
248
- setClient: (c: VueAvsbClient | null) => void;
249
- identify: (ctx: EvalContext) => void;
250
- track: (eventKey: string, payload?: TrackPayload) => void;
251
- alias: (prev: EvalContext, next: EvalContext) => Promise<void>;
252
- reset: () => void;
253
- }, never>, Pick<{
254
- client: vue.ComputedRef<VueAvsbClient | null>;
255
- status: vue.ComputedRef<"ready" | "error" | "loading">;
256
- error: vue.ComputedRef<Error | undefined>;
257
- setClient: (c: VueAvsbClient | null) => void;
258
- identify: (ctx: EvalContext) => void;
259
- track: (eventKey: string, payload?: TrackPayload) => void;
260
- alias: (prev: EvalContext, next: EvalContext) => Promise<void>;
261
- reset: () => void;
262
- }, "error" | "client" | "status">, Pick<{
263
- client: vue.ComputedRef<VueAvsbClient | null>;
264
- status: vue.ComputedRef<"ready" | "error" | "loading">;
265
- error: vue.ComputedRef<Error | undefined>;
266
- setClient: (c: VueAvsbClient | null) => void;
267
- identify: (ctx: EvalContext) => void;
268
- track: (eventKey: string, payload?: TrackPayload) => void;
269
- alias: (prev: EvalContext, next: EvalContext) => Promise<void>;
270
- reset: () => void;
271
- }, "track" | "identify" | "alias" | "reset" | "setClient">>;
282
+ /**
283
+ * Record that this visitor has been shown a flag's decision.
284
+ *
285
+ * Reading a flag during render never records an exposure, which is what
286
+ * keeps a re-render from inflating your results. Call this once, in the
287
+ * component that actually shows the variation, or when the value came from
288
+ * the server as a prop.
289
+ *
290
+ * It fires on mount (never during render or during SSR), or as soon as the
291
+ * SDK becomes ready if it is not yet. A reactive key exposes the new flag
292
+ * when the key changes.
293
+ */
294
+ declare function useExposure(flagKey: FlagKeyInput): void;
272
295
 
273
- type AvsbProviderProps = (AvsbClientOptions & {
274
- client?: never;
275
- }) | {
276
- client: VueAvsbClient;
277
- };
296
+ /**
297
+ * Run a side effect when one flag changes, without re-rendering.
298
+ *
299
+ * The callback also runs once when the first datafile lands, so a component
300
+ * mounted before the SDK was ready still hears about the real value. Use
301
+ * `useFlag` when the value drives what you render; use this for analytics,
302
+ * logging, or imperative work.
303
+ *
304
+ * The flag handed to the callback is a render-safe read: it records no
305
+ * exposure.
306
+ */
307
+ declare function useFlagSubscription(flagKey: FlagKeyInput, callback: (flag: Flag) => void): void;
278
308
 
279
- export { type AvsbContextValue, AvsbInjectionKey, AvsbPlugin, type AvsbPluginOptions, AvsbProvider, type AvsbProviderProps, type VueAvsbClient, useAlias, useAllFlags, useAvsbClient, useAvsbStore, useBoolFlag, useFlag, useFlagReady, useFlagValue, useIdentify, useJsonFlag, useNumberFlag, useStringFlag, useTrack };
309
+ export { type AvsbContextValue, AvsbInjectionKey, AvsbPlugin, type AvsbPluginOptions, AvsbProvider, AvsbProviderOptions, AvsbStatus, type FlagKeyInput, type UseAvsbStatusResult, VueAvsbClient, useAlias, useAllFlags, useAvsbClient, useAvsbStatus, useBoolFlag, useExposure, useFlag, useFlagReady, useFlagSubscription, useFlagValue, useIdentify, useJsonFlag, useNumberFlag, useReset, useStringFlag, useTrack };