@launchdarkly/js-client-sdk 0.12.0 → 0.13.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/dist/index.d.cts CHANGED
@@ -1,7 +1,247 @@
1
- import { LDContext } from '@launchdarkly/js-client-sdk-common';
2
- export { AutoEnvAttributes, BasicLogger, BasicLoggerOptions, EvaluationSeriesContext, EvaluationSeriesData, Hook, HookMetadata, IdentifySeriesContext, IdentifySeriesData, IdentifySeriesResult, IdentifySeriesStatus, LDContext, LDContextCommon, LDContextMeta, LDDebugOverride, LDEvaluationDetail, LDEvaluationDetailTyped, LDEvaluationReason, LDFlagSet, LDFlagValue, LDIdentifyError, LDIdentifyResult, LDIdentifyShed, LDIdentifySuccess, LDIdentifyTimeout, LDInspection, LDLogLevel, LDLogger, LDMultiKindContext, LDPluginApplicationMetadata, LDPluginBase, LDPluginEnvironmentMetadata, LDPluginMetadata, LDPluginSdkMetadata, LDSingleKindContext, LDTimeoutError, LDWaitForInitializationComplete, LDWaitForInitializationFailed, LDWaitForInitializationOptions, LDWaitForInitializationResult, LDWaitForInitializationTimeout, TrackSeriesContext } from '@launchdarkly/js-client-sdk-common';
3
- import { B as BrowserOptions, L as LDClient } from './common-B4wKbl6r.cjs';
4
- export { b as LDIdentifyOptions, a as LDPlugin, c as basicLogger } from './common-B4wKbl6r.cjs';
1
+ import { LDIdentifyOptions, LDClient as LDClient$1, LDContext, LDIdentifyResult, LDWaitForInitializationOptions, LDWaitForInitializationResult, LDPluginBase, Hook, LDOptions, BasicLoggerOptions, LDLogger } from '@launchdarkly/js-client-sdk-common';
2
+ export { AutoEnvAttributes, BasicLogger, BasicLoggerOptions, EvaluationSeriesContext, EvaluationSeriesData, Hook, HookMetadata, IdentifySeriesContext, IdentifySeriesData, IdentifySeriesResult, IdentifySeriesStatus, LDContext, LDContextCommon, LDContextMeta, LDContextStrict, LDDebugOverride, LDEvaluationDetail, LDEvaluationDetailTyped, LDEvaluationReason, LDFlagSet, LDFlagValue, LDIdentifyError, LDIdentifyResult, LDIdentifyShed, LDIdentifySuccess, LDIdentifyTimeout, LDInspection, LDLogLevel, LDLogger, LDMultiKindContext, LDPluginApplicationMetadata, LDPluginBase, LDPluginEnvironmentMetadata, LDPluginMetadata, LDPluginSdkMetadata, LDSingleKindContext, LDTimeoutError, LDWaitForInitializationComplete, LDWaitForInitializationFailed, LDWaitForInitializationOptions, LDWaitForInitializationResult, LDWaitForInitializationTimeout, TrackSeriesContext } from '@launchdarkly/js-client-sdk-common';
3
+
4
+ /**
5
+ * @property sheddable - If true, the identify operation will be sheddable. This means that if multiple identify operations are done, without
6
+ * waiting for the previous one to complete, then intermediate results will be discarded. When false, identify
7
+ * operations will be queued and completed sequentially.
8
+ *
9
+ * Defaults to true.
10
+ */
11
+ interface BrowserIdentifyOptions extends Omit<LDIdentifyOptions, 'waitForNetworkResults'> {
12
+ /**
13
+ * The signed context key if you are using [Secure Mode]
14
+ * (https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk).
15
+ */
16
+ hash?: string;
17
+ /**
18
+ * The initial set of flags to use until the remote set is retrieved.
19
+ *
20
+ * Bootstrap data can be generated by server SDKs. When bootstrap data is provided the SDK the
21
+ * identification operation will complete without waiting for any values from LaunchDarkly and
22
+ * the variation calls can be used immediately.
23
+ *
24
+ * If streaming is activated, either it is configured to always be used, or is activated
25
+ * via setStreaming, or via the addition of change handlers, then a streaming connection will
26
+ * subsequently be established.
27
+ *
28
+ * For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/features/bootstrapping#javascript).
29
+ */
30
+ bootstrap?: unknown;
31
+ }
32
+
33
+ interface LDStartOptions extends LDWaitForInitializationOptions {
34
+ /**
35
+ * Optional bootstrap data to use for the identify operation. If {@link LDIdentifyOptions.bootstrap} is provided, it will be ignored.
36
+ */
37
+ bootstrap?: unknown;
38
+ /**
39
+ * Optional identify options to use for the identify operation. See {@link LDIdentifyOptions} for more information.
40
+ *
41
+ * @remarks
42
+ * Since the first identify option should never be sheddable, we omit the sheddable option from the interface to avoid confusion.
43
+ */
44
+ identifyOptions?: Omit<BrowserIdentifyOptions, 'sheddable'>;
45
+ }
46
+ /**
47
+ *
48
+ * The LaunchDarkly SDK client object.
49
+ *
50
+ * Applications should configure the client at page load time and reuse the same instance.
51
+ *
52
+ * For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/client-side/javascript).
53
+ */
54
+ type LDClient = Omit<LDClient$1, 'setConnectionMode' | 'getConnectionMode' | 'getOffline' | 'identify'> & {
55
+ /**
56
+ * @ignore
57
+ * Implementation Note: We are not supporting dynamically setting the connection mode on the LDClient.
58
+ * Implementation Note: The SDK does not support offline mode. Instead bootstrap data can be used.
59
+ * Implementation Note: The browser SDK has different identify options, so omits the base implementation
60
+ * from the interface.
61
+ */
62
+ /**
63
+ * Specifies whether or not to open a streaming connection to LaunchDarkly for live flag updates.
64
+ *
65
+ * If this is true, the client will always attempt to maintain a streaming connection; if false,
66
+ * it never will. If you leave the value undefined (the default), the client will open a streaming
67
+ * connection if you subscribe to `"change"` or `"change:flag-key"` events (see {@link LDClient.on}).
68
+ *
69
+ * This can also be set as the `streaming` property of {@link LDOptions}.
70
+ */
71
+ setStreaming(streaming?: boolean): void;
72
+ /**
73
+ * Identifies a context to LaunchDarkly and returns a promise which resolves to an object containing the result of
74
+ * the identify operation.
75
+ *
76
+ * Unlike the server-side SDKs, the client-side JavaScript SDKs maintain a current context state,
77
+ * which is set when you call `identify()`.
78
+ *
79
+ * Changing the current context also causes all feature flag values to be reloaded. Until that has
80
+ * finished, calls to {@link variation} will still return flag values for the previous context. You can
81
+ * await the Promise to determine when the new flag values are available.
82
+ *
83
+ * If used with the `sheddable` option set to true, then the identify operation will be sheddable. This means that if
84
+ * multiple identify operations are done, without waiting for the previous one to complete, then intermediate
85
+ * operations may be discarded.
86
+ *
87
+ * @param context
88
+ * The LDContext object.
89
+ * @param identifyOptions
90
+ * Optional configuration. Please see {@link LDIdentifyOptions}.
91
+ * @returns
92
+ * A promise which resolves to an object containing the result of the identify operation.
93
+ * The promise returned from this method will not be rejected.
94
+ *
95
+ * @ignore Implementation Note: Browser implementation has different options.
96
+ */
97
+ identify(pristineContext: LDContext, identifyOptions?: BrowserIdentifyOptions): Promise<LDIdentifyResult>;
98
+ /**
99
+ * Returns a Promise that tracks the client's initialization state.
100
+ *
101
+ * The Promise will be resolved to a {@link LDWaitForInitializationResult} object containing the
102
+ * status of the waitForInitialization operation.
103
+ *
104
+ * @example
105
+ * This example shows use of async/await syntax for specifying handlers:
106
+ * ```
107
+ * const result = await client.waitForInitialization({ timeout: 5 });
108
+ *
109
+ * if (result.status === 'complete') {
110
+ * doSomethingWithSuccessfullyInitializedClient();
111
+ * } else if (result.status === 'failed') {
112
+ * doSomethingForFailedStartup(result.error);
113
+ * } else if (result.status === 'timeout') {
114
+ * doSomethingForTimedOutStartup();
115
+ * }
116
+ * ```
117
+ *
118
+ * @remarks
119
+ * You can also use event listeners ({@link on}) for the same purpose: the event `"initialized"`
120
+ * indicates success, and `"error"` indicates an error.
121
+ *
122
+ * @param options
123
+ * Optional configuration. Please see {@link LDWaitForInitializationOptions}.
124
+ *
125
+ * @returns
126
+ * A Promise that will be resolved to a {@link LDWaitForInitializationResult} object containing the
127
+ * status of the waitForInitialization operation.
128
+ */
129
+ waitForInitialization(options?: LDWaitForInitializationOptions): Promise<LDWaitForInitializationResult>;
130
+ /**
131
+ * Starts the client and returns a promise that resolves to the initialization result.
132
+ *
133
+ * The promise will resolve to a {@link LDWaitForInitializationResult} object containing the
134
+ * status of the waitForInitialization operation.
135
+ *
136
+ * @param options Optional configuration. Please see {@link LDStartOptions}.
137
+ */
138
+ start(options?: LDStartOptions): Promise<LDWaitForInitializationResult>;
139
+ };
140
+
141
+ /**
142
+ * Interface for plugins to the LaunchDarkly SDK.
143
+ */
144
+ interface LDPlugin extends LDPluginBase<LDClient, Hook> {
145
+ }
146
+
147
+ /**
148
+ * Initialization options for the LaunchDarkly browser SDK.
149
+ */
150
+ interface BrowserOptions extends Omit<LDOptions, 'initialConnectionMode'> {
151
+ /**
152
+ * Whether the client should make a request to LaunchDarkly for Experimentation metrics (goals).
153
+ *
154
+ * This is true by default, meaning that this request will be made on every page load.
155
+ * Set it to false if you are not using Experimentation and want to skip the request.
156
+ */
157
+ fetchGoals?: boolean;
158
+ /**
159
+ * A function which, if present, can change the URL in analytics events to something other
160
+ * than the actual browser URL. It will be called with the current browser URL as a parameter,
161
+ * and returns the value that should be stored in the event's `url` property.
162
+ *
163
+ * It may be useful to customize the `url` to provide specific meaning, incorporate
164
+ * client-side routing concerns, or redact tokens or other info.
165
+ */
166
+ eventUrlTransformer?: (url: string) => string;
167
+ /**
168
+ * Whether or not to open a streaming connection to LaunchDarkly for live flag updates.
169
+ *
170
+ * If this is true, the client will always attempt to maintain a streaming connection; if false,
171
+ * it never will. If you leave the value undefined (the default), the client will open a streaming
172
+ * connection if you subscribe to `"change"` or `"change:flag-key"` events.
173
+ *
174
+ * This is equivalent to calling `client.setStreaming()` with the same value.
175
+ */
176
+ streaming?: boolean;
177
+ /**
178
+ * Determines if the SDK responds to entering different visibility states, such as foreground and background.
179
+ * An example is flushing buffered events when going to the background.
180
+ *
181
+ * This is true by default. Generally speaking the SDK will be able to most reliably deliver
182
+ * events with this setting on.
183
+ *
184
+ * It may be useful to disable for environments where not all window/document objects are
185
+ * available, such as when running the SDK in a browser extension.
186
+ */
187
+ automaticBackgroundHandling?: boolean;
188
+ /**
189
+ * A list of plugins to be used with the SDK.
190
+ *
191
+ * Plugin support is currently experimental and subject to change.
192
+ */
193
+ plugins?: LDPlugin[];
194
+ }
195
+
196
+ /**
197
+ * Provides a basic {@link LDLogger} implementation.
198
+ *
199
+ * This logging implementation uses a basic format that includes only the log level
200
+ * and the message text. By default this uses log level 'info' and the output is
201
+ * written to `console.error`.
202
+ *
203
+ * To use the logger created by this function, put it into {@link LDOptions.logger}. If
204
+ * you do not set {@link LDOptions.logger} to anything, the SDK uses a default logger
205
+ * that will log "info" level and higher priorty messages and it will log messages to
206
+ * console.info, console.warn, and console.error.
207
+ *
208
+ * @param options Configuration for the logger. If no options are specified, the
209
+ * logger uses `{ level: 'info' }`.
210
+ *
211
+ * @example
212
+ * This example shows how to use `basicLogger` in your SDK options to enable console
213
+ * logging only at `warn` and `error` levels.
214
+ * ```javascript
215
+ * const ldOptions = {
216
+ * logger: basicLogger({ level: 'warn' }),
217
+ * };
218
+ * ```
219
+ *
220
+ * @example
221
+ * This example shows how to use `basicLogger` in your SDK options to cause all
222
+ * log output to go to `console.log`
223
+ * ```javascript
224
+ * const ldOptions = {
225
+ * logger: basicLogger({ destination: console.log }),
226
+ * };
227
+ * ```
228
+ *
229
+ * * @example
230
+ * The configuration also allows you to control the destination for each log level.
231
+ * ```javascript
232
+ * const ldOptions = {
233
+ * logger: basicLogger({
234
+ * destination: {
235
+ * debug: console.debug,
236
+ * info: console.info,
237
+ * warn: console.warn,
238
+ * error:console.error
239
+ * }
240
+ * }),
241
+ * };
242
+ * ```
243
+ */
244
+ declare function basicLogger(options: BasicLoggerOptions): LDLogger;
5
245
 
6
246
  /**
7
247
  * This is the API reference for the LaunchDarkly Client-Side SDK for JavaScript.
@@ -46,4 +286,4 @@ export { b as LDIdentifyOptions, a as LDPlugin, c as basicLogger } from './commo
46
286
  */
47
287
  declare function createClient(clientSideId: string, pristineContext: LDContext, options?: BrowserOptions): LDClient;
48
288
 
49
- export { LDClient, BrowserOptions as LDOptions, createClient };
289
+ export { type LDClient, type BrowserIdentifyOptions as LDIdentifyOptions, type BrowserOptions as LDOptions, type LDPlugin, type LDStartOptions, basicLogger, createClient };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,247 @@
1
- import { LDContext } from '@launchdarkly/js-client-sdk-common';
2
- export { AutoEnvAttributes, BasicLogger, BasicLoggerOptions, EvaluationSeriesContext, EvaluationSeriesData, Hook, HookMetadata, IdentifySeriesContext, IdentifySeriesData, IdentifySeriesResult, IdentifySeriesStatus, LDContext, LDContextCommon, LDContextMeta, LDDebugOverride, LDEvaluationDetail, LDEvaluationDetailTyped, LDEvaluationReason, LDFlagSet, LDFlagValue, LDIdentifyError, LDIdentifyResult, LDIdentifyShed, LDIdentifySuccess, LDIdentifyTimeout, LDInspection, LDLogLevel, LDLogger, LDMultiKindContext, LDPluginApplicationMetadata, LDPluginBase, LDPluginEnvironmentMetadata, LDPluginMetadata, LDPluginSdkMetadata, LDSingleKindContext, LDTimeoutError, LDWaitForInitializationComplete, LDWaitForInitializationFailed, LDWaitForInitializationOptions, LDWaitForInitializationResult, LDWaitForInitializationTimeout, TrackSeriesContext } from '@launchdarkly/js-client-sdk-common';
3
- import { B as BrowserOptions, L as LDClient } from './common-B4wKbl6r.js';
4
- export { b as LDIdentifyOptions, a as LDPlugin, c as basicLogger } from './common-B4wKbl6r.js';
1
+ import { LDIdentifyOptions, LDClient as LDClient$1, LDContext, LDIdentifyResult, LDWaitForInitializationOptions, LDWaitForInitializationResult, LDPluginBase, Hook, LDOptions, BasicLoggerOptions, LDLogger } from '@launchdarkly/js-client-sdk-common';
2
+ export { AutoEnvAttributes, BasicLogger, BasicLoggerOptions, EvaluationSeriesContext, EvaluationSeriesData, Hook, HookMetadata, IdentifySeriesContext, IdentifySeriesData, IdentifySeriesResult, IdentifySeriesStatus, LDContext, LDContextCommon, LDContextMeta, LDContextStrict, LDDebugOverride, LDEvaluationDetail, LDEvaluationDetailTyped, LDEvaluationReason, LDFlagSet, LDFlagValue, LDIdentifyError, LDIdentifyResult, LDIdentifyShed, LDIdentifySuccess, LDIdentifyTimeout, LDInspection, LDLogLevel, LDLogger, LDMultiKindContext, LDPluginApplicationMetadata, LDPluginBase, LDPluginEnvironmentMetadata, LDPluginMetadata, LDPluginSdkMetadata, LDSingleKindContext, LDTimeoutError, LDWaitForInitializationComplete, LDWaitForInitializationFailed, LDWaitForInitializationOptions, LDWaitForInitializationResult, LDWaitForInitializationTimeout, TrackSeriesContext } from '@launchdarkly/js-client-sdk-common';
3
+
4
+ /**
5
+ * @property sheddable - If true, the identify operation will be sheddable. This means that if multiple identify operations are done, without
6
+ * waiting for the previous one to complete, then intermediate results will be discarded. When false, identify
7
+ * operations will be queued and completed sequentially.
8
+ *
9
+ * Defaults to true.
10
+ */
11
+ interface BrowserIdentifyOptions extends Omit<LDIdentifyOptions, 'waitForNetworkResults'> {
12
+ /**
13
+ * The signed context key if you are using [Secure Mode]
14
+ * (https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk).
15
+ */
16
+ hash?: string;
17
+ /**
18
+ * The initial set of flags to use until the remote set is retrieved.
19
+ *
20
+ * Bootstrap data can be generated by server SDKs. When bootstrap data is provided the SDK the
21
+ * identification operation will complete without waiting for any values from LaunchDarkly and
22
+ * the variation calls can be used immediately.
23
+ *
24
+ * If streaming is activated, either it is configured to always be used, or is activated
25
+ * via setStreaming, or via the addition of change handlers, then a streaming connection will
26
+ * subsequently be established.
27
+ *
28
+ * For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/features/bootstrapping#javascript).
29
+ */
30
+ bootstrap?: unknown;
31
+ }
32
+
33
+ interface LDStartOptions extends LDWaitForInitializationOptions {
34
+ /**
35
+ * Optional bootstrap data to use for the identify operation. If {@link LDIdentifyOptions.bootstrap} is provided, it will be ignored.
36
+ */
37
+ bootstrap?: unknown;
38
+ /**
39
+ * Optional identify options to use for the identify operation. See {@link LDIdentifyOptions} for more information.
40
+ *
41
+ * @remarks
42
+ * Since the first identify option should never be sheddable, we omit the sheddable option from the interface to avoid confusion.
43
+ */
44
+ identifyOptions?: Omit<BrowserIdentifyOptions, 'sheddable'>;
45
+ }
46
+ /**
47
+ *
48
+ * The LaunchDarkly SDK client object.
49
+ *
50
+ * Applications should configure the client at page load time and reuse the same instance.
51
+ *
52
+ * For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/client-side/javascript).
53
+ */
54
+ type LDClient = Omit<LDClient$1, 'setConnectionMode' | 'getConnectionMode' | 'getOffline' | 'identify'> & {
55
+ /**
56
+ * @ignore
57
+ * Implementation Note: We are not supporting dynamically setting the connection mode on the LDClient.
58
+ * Implementation Note: The SDK does not support offline mode. Instead bootstrap data can be used.
59
+ * Implementation Note: The browser SDK has different identify options, so omits the base implementation
60
+ * from the interface.
61
+ */
62
+ /**
63
+ * Specifies whether or not to open a streaming connection to LaunchDarkly for live flag updates.
64
+ *
65
+ * If this is true, the client will always attempt to maintain a streaming connection; if false,
66
+ * it never will. If you leave the value undefined (the default), the client will open a streaming
67
+ * connection if you subscribe to `"change"` or `"change:flag-key"` events (see {@link LDClient.on}).
68
+ *
69
+ * This can also be set as the `streaming` property of {@link LDOptions}.
70
+ */
71
+ setStreaming(streaming?: boolean): void;
72
+ /**
73
+ * Identifies a context to LaunchDarkly and returns a promise which resolves to an object containing the result of
74
+ * the identify operation.
75
+ *
76
+ * Unlike the server-side SDKs, the client-side JavaScript SDKs maintain a current context state,
77
+ * which is set when you call `identify()`.
78
+ *
79
+ * Changing the current context also causes all feature flag values to be reloaded. Until that has
80
+ * finished, calls to {@link variation} will still return flag values for the previous context. You can
81
+ * await the Promise to determine when the new flag values are available.
82
+ *
83
+ * If used with the `sheddable` option set to true, then the identify operation will be sheddable. This means that if
84
+ * multiple identify operations are done, without waiting for the previous one to complete, then intermediate
85
+ * operations may be discarded.
86
+ *
87
+ * @param context
88
+ * The LDContext object.
89
+ * @param identifyOptions
90
+ * Optional configuration. Please see {@link LDIdentifyOptions}.
91
+ * @returns
92
+ * A promise which resolves to an object containing the result of the identify operation.
93
+ * The promise returned from this method will not be rejected.
94
+ *
95
+ * @ignore Implementation Note: Browser implementation has different options.
96
+ */
97
+ identify(pristineContext: LDContext, identifyOptions?: BrowserIdentifyOptions): Promise<LDIdentifyResult>;
98
+ /**
99
+ * Returns a Promise that tracks the client's initialization state.
100
+ *
101
+ * The Promise will be resolved to a {@link LDWaitForInitializationResult} object containing the
102
+ * status of the waitForInitialization operation.
103
+ *
104
+ * @example
105
+ * This example shows use of async/await syntax for specifying handlers:
106
+ * ```
107
+ * const result = await client.waitForInitialization({ timeout: 5 });
108
+ *
109
+ * if (result.status === 'complete') {
110
+ * doSomethingWithSuccessfullyInitializedClient();
111
+ * } else if (result.status === 'failed') {
112
+ * doSomethingForFailedStartup(result.error);
113
+ * } else if (result.status === 'timeout') {
114
+ * doSomethingForTimedOutStartup();
115
+ * }
116
+ * ```
117
+ *
118
+ * @remarks
119
+ * You can also use event listeners ({@link on}) for the same purpose: the event `"initialized"`
120
+ * indicates success, and `"error"` indicates an error.
121
+ *
122
+ * @param options
123
+ * Optional configuration. Please see {@link LDWaitForInitializationOptions}.
124
+ *
125
+ * @returns
126
+ * A Promise that will be resolved to a {@link LDWaitForInitializationResult} object containing the
127
+ * status of the waitForInitialization operation.
128
+ */
129
+ waitForInitialization(options?: LDWaitForInitializationOptions): Promise<LDWaitForInitializationResult>;
130
+ /**
131
+ * Starts the client and returns a promise that resolves to the initialization result.
132
+ *
133
+ * The promise will resolve to a {@link LDWaitForInitializationResult} object containing the
134
+ * status of the waitForInitialization operation.
135
+ *
136
+ * @param options Optional configuration. Please see {@link LDStartOptions}.
137
+ */
138
+ start(options?: LDStartOptions): Promise<LDWaitForInitializationResult>;
139
+ };
140
+
141
+ /**
142
+ * Interface for plugins to the LaunchDarkly SDK.
143
+ */
144
+ interface LDPlugin extends LDPluginBase<LDClient, Hook> {
145
+ }
146
+
147
+ /**
148
+ * Initialization options for the LaunchDarkly browser SDK.
149
+ */
150
+ interface BrowserOptions extends Omit<LDOptions, 'initialConnectionMode'> {
151
+ /**
152
+ * Whether the client should make a request to LaunchDarkly for Experimentation metrics (goals).
153
+ *
154
+ * This is true by default, meaning that this request will be made on every page load.
155
+ * Set it to false if you are not using Experimentation and want to skip the request.
156
+ */
157
+ fetchGoals?: boolean;
158
+ /**
159
+ * A function which, if present, can change the URL in analytics events to something other
160
+ * than the actual browser URL. It will be called with the current browser URL as a parameter,
161
+ * and returns the value that should be stored in the event's `url` property.
162
+ *
163
+ * It may be useful to customize the `url` to provide specific meaning, incorporate
164
+ * client-side routing concerns, or redact tokens or other info.
165
+ */
166
+ eventUrlTransformer?: (url: string) => string;
167
+ /**
168
+ * Whether or not to open a streaming connection to LaunchDarkly for live flag updates.
169
+ *
170
+ * If this is true, the client will always attempt to maintain a streaming connection; if false,
171
+ * it never will. If you leave the value undefined (the default), the client will open a streaming
172
+ * connection if you subscribe to `"change"` or `"change:flag-key"` events.
173
+ *
174
+ * This is equivalent to calling `client.setStreaming()` with the same value.
175
+ */
176
+ streaming?: boolean;
177
+ /**
178
+ * Determines if the SDK responds to entering different visibility states, such as foreground and background.
179
+ * An example is flushing buffered events when going to the background.
180
+ *
181
+ * This is true by default. Generally speaking the SDK will be able to most reliably deliver
182
+ * events with this setting on.
183
+ *
184
+ * It may be useful to disable for environments where not all window/document objects are
185
+ * available, such as when running the SDK in a browser extension.
186
+ */
187
+ automaticBackgroundHandling?: boolean;
188
+ /**
189
+ * A list of plugins to be used with the SDK.
190
+ *
191
+ * Plugin support is currently experimental and subject to change.
192
+ */
193
+ plugins?: LDPlugin[];
194
+ }
195
+
196
+ /**
197
+ * Provides a basic {@link LDLogger} implementation.
198
+ *
199
+ * This logging implementation uses a basic format that includes only the log level
200
+ * and the message text. By default this uses log level 'info' and the output is
201
+ * written to `console.error`.
202
+ *
203
+ * To use the logger created by this function, put it into {@link LDOptions.logger}. If
204
+ * you do not set {@link LDOptions.logger} to anything, the SDK uses a default logger
205
+ * that will log "info" level and higher priorty messages and it will log messages to
206
+ * console.info, console.warn, and console.error.
207
+ *
208
+ * @param options Configuration for the logger. If no options are specified, the
209
+ * logger uses `{ level: 'info' }`.
210
+ *
211
+ * @example
212
+ * This example shows how to use `basicLogger` in your SDK options to enable console
213
+ * logging only at `warn` and `error` levels.
214
+ * ```javascript
215
+ * const ldOptions = {
216
+ * logger: basicLogger({ level: 'warn' }),
217
+ * };
218
+ * ```
219
+ *
220
+ * @example
221
+ * This example shows how to use `basicLogger` in your SDK options to cause all
222
+ * log output to go to `console.log`
223
+ * ```javascript
224
+ * const ldOptions = {
225
+ * logger: basicLogger({ destination: console.log }),
226
+ * };
227
+ * ```
228
+ *
229
+ * * @example
230
+ * The configuration also allows you to control the destination for each log level.
231
+ * ```javascript
232
+ * const ldOptions = {
233
+ * logger: basicLogger({
234
+ * destination: {
235
+ * debug: console.debug,
236
+ * info: console.info,
237
+ * warn: console.warn,
238
+ * error:console.error
239
+ * }
240
+ * }),
241
+ * };
242
+ * ```
243
+ */
244
+ declare function basicLogger(options: BasicLoggerOptions): LDLogger;
5
245
 
6
246
  /**
7
247
  * This is the API reference for the LaunchDarkly Client-Side SDK for JavaScript.
@@ -46,4 +286,4 @@ export { b as LDIdentifyOptions, a as LDPlugin, c as basicLogger } from './commo
46
286
  */
47
287
  declare function createClient(clientSideId: string, pristineContext: LDContext, options?: BrowserOptions): LDClient;
48
288
 
49
- export { LDClient, BrowserOptions as LDOptions, createClient };
289
+ export { type LDClient, type BrowserIdentifyOptions as LDIdentifyOptions, type BrowserOptions as LDOptions, type LDPlugin, type LDStartOptions, basicLogger, createClient };