launchdarkly-js-sdk-common 3.3.0-beta1 → 3.3.3
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/CHANGELOG.md +23 -0
- package/README.md +2 -3
- package/dist/ldclient-common.cjs.js +1 -1
- package/dist/ldclient-common.cjs.js.map +1 -1
- package/dist/ldclient-common.es.js +1 -1
- package/dist/ldclient-common.es.js.map +1 -1
- package/dist/ldclient-common.min.js +1 -1
- package/dist/ldclient-common.min.js.map +1 -1
- package/package.json +2 -2
- package/typings.d.ts +37 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "launchdarkly-js-sdk-common",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "LaunchDarkly SDK for JavaScript - common code",
|
|
5
5
|
"author": "LaunchDarkly <team@launchdarkly.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"base64-js": "^1.3.0",
|
|
75
75
|
"fast-deep-equal": "^2.0.1",
|
|
76
|
-
"uuid": "^
|
|
76
|
+
"uuid": "^8.0.0"
|
|
77
77
|
},
|
|
78
78
|
"repository": {
|
|
79
79
|
"type": "git",
|
package/typings.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
80
80
|
* immediately after calling `initialize()` (normally they would not be available until the
|
|
81
81
|
* client signals that it is ready).
|
|
82
82
|
*
|
|
83
|
-
* For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/
|
|
83
|
+
* For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/features/bootstrapping#javascript).
|
|
84
84
|
*/
|
|
85
85
|
bootstrap?: 'localStorage' | LDFlagSet;
|
|
86
86
|
|
|
@@ -153,7 +153,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
153
153
|
* Whether to send analytics events back to LaunchDarkly. By default, this is true.
|
|
154
154
|
*/
|
|
155
155
|
sendEvents?: boolean;
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
/**
|
|
158
158
|
* Whether all user attributes (except the user key) should be marked as private, and
|
|
159
159
|
* not sent to LaunchDarkly in analytics events.
|
|
@@ -169,6 +169,14 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
169
169
|
*/
|
|
170
170
|
privateAttributeNames?: Array<string>;
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Whether to include full user details in every analytics event.
|
|
174
|
+
*
|
|
175
|
+
* The default is `false`: events will only include the user key, except for one "index" event
|
|
176
|
+
* that provides the full details for the user.
|
|
177
|
+
*/
|
|
178
|
+
inlineUsersInEvents?: boolean;
|
|
179
|
+
|
|
172
180
|
/**
|
|
173
181
|
* Whether or not to send an analytics event for a flag evaluation even if the same flag was
|
|
174
182
|
* evaluated with the same value within the last five minutes.
|
|
@@ -187,14 +195,14 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
187
195
|
|
|
188
196
|
/**
|
|
189
197
|
* The capacity of the analytics events queue.
|
|
190
|
-
*
|
|
198
|
+
*
|
|
191
199
|
* The client buffers up to this many events in memory before flushing. If the capacity is exceeded
|
|
192
200
|
* before the queue is flushed, events will be discarded. Increasing the capacity means that events
|
|
193
201
|
* are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage
|
|
194
202
|
* flag evaluations do not produce individual events, only summary counts, so you only need a large
|
|
195
203
|
* capacity if you are generating a large number of click, pageview, or identify events (or if you
|
|
196
204
|
* are using the event debugger).
|
|
197
|
-
*
|
|
205
|
+
*
|
|
198
206
|
* The default value is 100.
|
|
199
207
|
*/
|
|
200
208
|
eventCapacity?: number;
|
|
@@ -228,7 +236,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
228
236
|
|
|
229
237
|
/**
|
|
230
238
|
* Set to true to opt out of sending diagnostics data.
|
|
231
|
-
*
|
|
239
|
+
*
|
|
232
240
|
* Unless `diagnosticOptOut` is set to true, the client will send some diagnostics data to the LaunchDarkly
|
|
233
241
|
* servers in order to assist in the development of future SDK improvements. These diagnostics consist of
|
|
234
242
|
* an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the
|
|
@@ -236,10 +244,10 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
236
244
|
* as dropped events.
|
|
237
245
|
*/
|
|
238
246
|
diagnosticOptOut?: boolean;
|
|
239
|
-
|
|
247
|
+
|
|
240
248
|
/**
|
|
241
249
|
* The interval at which periodic diagnostic data is sent, in milliseconds.
|
|
242
|
-
*
|
|
250
|
+
*
|
|
243
251
|
* The default is 900000 (every 15 minutes) and the minimum value is 6000. See [[diagnosticOptOut]]
|
|
244
252
|
* for more information on the diagnostics data being sent.
|
|
245
253
|
*/
|
|
@@ -263,7 +271,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
263
271
|
/**
|
|
264
272
|
* Whether to disable the automatic sending of an alias event when [[identify]] is
|
|
265
273
|
* called with a non-anonymous user when the previous user is anonymous.
|
|
266
|
-
*
|
|
274
|
+
*
|
|
267
275
|
* The default value is `false`.
|
|
268
276
|
*/
|
|
269
277
|
autoAliasingOptOut?: boolean;
|
|
@@ -287,7 +295,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
287
295
|
|
|
288
296
|
/**
|
|
289
297
|
* An optional secondary key for a user. This affects
|
|
290
|
-
* [feature flag targeting](https://docs.launchdarkly.com/
|
|
298
|
+
* [feature flag targeting](https://docs.launchdarkly.com/home/flags/targeting-users#targeting-rules-based-on-user-attributes)
|
|
291
299
|
* as follows: if you have chosen to bucket users by a specific attribute, the secondary key (if set)
|
|
292
300
|
* is used to further distinguish between users who are otherwise identical according to that attribute.
|
|
293
301
|
*/
|
|
@@ -357,9 +365,9 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
357
365
|
/**
|
|
358
366
|
* Describes the reason that a flag evaluation produced a particular value. This is
|
|
359
367
|
* part of the [[LDEvaluationDetail]] object returned by [[LDClient.variationDetail]].
|
|
360
|
-
*
|
|
361
|
-
* This type is separate from `[[LDEvaluationReason]]` for backwards compatibility. In
|
|
362
|
-
* earlier versions of this SDK, `[[LDEvaluationReason]]` was incorrectly defined as
|
|
368
|
+
*
|
|
369
|
+
* This type is separate from `[[LDEvaluationReason]]` for backwards compatibility. In
|
|
370
|
+
* earlier versions of this SDK, `[[LDEvaluationReason]]` was incorrectly defined as
|
|
363
371
|
* being non-nullable.
|
|
364
372
|
*/
|
|
365
373
|
interface NonNullableLDEvaluationReason {
|
|
@@ -401,7 +409,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
401
409
|
/**
|
|
402
410
|
* Describes the reason that a flag evaluation produced a particular value. This is
|
|
403
411
|
* part of the [[LDEvaluationDetail]] object returned by [[LDClient.variationDetail]].
|
|
404
|
-
*
|
|
412
|
+
*
|
|
405
413
|
* Will be null when `[[LDOptions.evaluationReasons]]` is `false`.
|
|
406
414
|
*/
|
|
407
415
|
export type LDEvaluationReason = NonNullableLDEvaluationReason | null;
|
|
@@ -412,7 +420,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
412
420
|
*
|
|
413
421
|
* This is the result of calling [[LDClient.variationDetail]].
|
|
414
422
|
*
|
|
415
|
-
* For more information, see the [SDK reference guide](https://docs.launchdarkly.com/
|
|
423
|
+
* For more information, see the [SDK reference guide](https://docs.launchdarkly.com/sdk/features/evaluation-reasons#javascript).
|
|
416
424
|
*/
|
|
417
425
|
export interface LDEvaluationDetail {
|
|
418
426
|
/**
|
|
@@ -437,7 +445,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
437
445
|
* The basic interface for the LaunchDarkly client. The browser SDK and the Electron SDK both
|
|
438
446
|
* use this, but may add some methods of their own.
|
|
439
447
|
*
|
|
440
|
-
* @see
|
|
448
|
+
* @see https://docs.launchdarkly.com/sdk/client-side/javascript
|
|
441
449
|
*
|
|
442
450
|
* @ignore (don't need to show this separately in TypeDoc output; all methods will be shown in LDClient)
|
|
443
451
|
*/
|
|
@@ -462,10 +470,10 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
462
470
|
*
|
|
463
471
|
* If you want to distinguish between these success and failure conditions, use
|
|
464
472
|
* [[waitForInitialization]] instead.
|
|
465
|
-
*
|
|
473
|
+
*
|
|
466
474
|
* If you prefer to use event listeners ([[on]]) rather than Promises, you can listen on the
|
|
467
475
|
* client for a `"ready"` event, which will be fired in either case.
|
|
468
|
-
*
|
|
476
|
+
*
|
|
469
477
|
* @returns
|
|
470
478
|
* A Promise that will be resolved once the client is no longer trying to initialize.
|
|
471
479
|
*/
|
|
@@ -490,7 +498,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
490
498
|
* await client.waitForInitialization();
|
|
491
499
|
* doSomethingWithSuccessfullyInitializedClient();
|
|
492
500
|
* } catch (err) {
|
|
493
|
-
* doSomethingForFailedStartup(err);
|
|
501
|
+
* doSomethingForFailedStartup(err);
|
|
494
502
|
* }
|
|
495
503
|
* ```
|
|
496
504
|
*
|
|
@@ -501,7 +509,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
501
509
|
*
|
|
502
510
|
* Note that you can also use event listeners ([[on]]) for the same purpose: the event `"initialized"`
|
|
503
511
|
* indicates success, and `"failed"` indicates failure.
|
|
504
|
-
*
|
|
512
|
+
*
|
|
505
513
|
* @returns
|
|
506
514
|
* A Promise that will be resolved if the client initializes successfully, or rejected if it
|
|
507
515
|
* fails.
|
|
@@ -522,7 +530,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
522
530
|
* @param user
|
|
523
531
|
* The user properties. Must contain at least the `key` property.
|
|
524
532
|
* @param hash
|
|
525
|
-
* The signed user key if you are using [Secure Mode](
|
|
533
|
+
* The signed user key if you are using [Secure Mode](https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk).
|
|
526
534
|
* @param onDone
|
|
527
535
|
* A function which will be called as soon as the flag values for the new user are available,
|
|
528
536
|
* with two parameters: an error value (if any), and an [[LDFlagSet]] containing the new values
|
|
@@ -585,7 +593,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
585
593
|
* The `reason` property of the result will also be included in analytics events, if you are
|
|
586
594
|
* capturing detailed event data for this flag.
|
|
587
595
|
*
|
|
588
|
-
* For more information, see the [SDK reference guide](https://docs.launchdarkly.com/
|
|
596
|
+
* For more information, see the [SDK reference guide](https://docs.launchdarkly.com/sdk/features/evaluation-reasons#javascript).
|
|
589
597
|
*
|
|
590
598
|
* @param key
|
|
591
599
|
* The unique key of the feature flag.
|
|
@@ -611,7 +619,7 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
611
619
|
/**
|
|
612
620
|
* Registers an event listener.
|
|
613
621
|
*
|
|
614
|
-
* The following event names (keys) are used by the
|
|
622
|
+
* The following event names (keys) are used by the client:
|
|
615
623
|
*
|
|
616
624
|
* - `"ready"`: The client has finished starting up. This event will be sent regardless
|
|
617
625
|
* of whether it successfully connected to LaunchDarkly, or encountered an error
|
|
@@ -680,16 +688,16 @@ declare module 'launchdarkly-js-sdk-common' {
|
|
|
680
688
|
track(key: string, data?: any, metricValue?: number): void;
|
|
681
689
|
|
|
682
690
|
/**
|
|
683
|
-
* Associates two users for analytics purposes.
|
|
684
|
-
*
|
|
685
|
-
* This can be helpful in the situation where a person is represented by multiple
|
|
686
|
-
* LaunchDarkly users. This may happen, for example, when a person initially logs into
|
|
691
|
+
* Associates two users for analytics purposes.
|
|
692
|
+
*
|
|
693
|
+
* This can be helpful in the situation where a person is represented by multiple
|
|
694
|
+
* LaunchDarkly users. This may happen, for example, when a person initially logs into
|
|
687
695
|
* an application-- the person might be represented by an anonymous user prior to logging
|
|
688
696
|
* in and a different user after logging in, as denoted by a different user key.
|
|
689
|
-
*
|
|
690
|
-
* @param user
|
|
697
|
+
*
|
|
698
|
+
* @param user
|
|
691
699
|
* The newly identified user.
|
|
692
|
-
* @param previousUser
|
|
700
|
+
* @param previousUser
|
|
693
701
|
* The previously identified user.
|
|
694
702
|
*/
|
|
695
703
|
alias(user: LDUser, previousUser: LDUser): void;
|