@launchdarkly/js-client-sdk 0.5.2 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.0](https://github.com/launchdarkly/js-core/compare/js-client-sdk-v0.5.3...js-client-sdk-v0.6.0) (2025-04-29)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add client-side SDK plugin support. ([#834](https://github.com/launchdarkly/js-core/issues/834)) ([a843a33](https://github.com/launchdarkly/js-core/commit/a843a33e97dcab706a0034bd1fd1e3d2f78a9262))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Client SDKs should use wrapper information. ([#836](https://github.com/launchdarkly/js-core/issues/836)) ([1e0cf6a](https://github.com/launchdarkly/js-core/commit/1e0cf6a0f77f8cfe6a7a0e675fc6490ea52a5b07))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @launchdarkly/js-client-sdk-common bumped from 1.12.6 to 1.13.0
21
+
22
+ ## [0.5.3](https://github.com/launchdarkly/js-core/compare/js-client-sdk-v0.5.2...js-client-sdk-v0.5.3) (2025-04-16)
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @launchdarkly/js-client-sdk-common bumped from 1.12.5 to 1.12.6
30
+
3
31
  ## [0.5.2](https://github.com/launchdarkly/js-core/compare/js-client-sdk-v0.5.1...js-client-sdk-v0.5.2) (2025-04-15)
4
32
 
5
33
 
@@ -1,4 +1,4 @@
1
- import { LDIdentifyOptions, LDOptions, LDClient as LDClient$1, LDContext, BasicLoggerOptions, LDLogger } from '@launchdarkly/js-client-sdk-common';
1
+ import { LDIdentifyOptions, LDClient as LDClient$1, LDContext, LDPluginBase, Hook, LDOptions, BasicLoggerOptions, LDLogger } from '@launchdarkly/js-client-sdk-common';
2
2
 
3
3
  interface BrowserIdentifyOptions extends Omit<LDIdentifyOptions, 'waitForNetworkResults'> {
4
4
  /**
@@ -22,49 +22,6 @@ interface BrowserIdentifyOptions extends Omit<LDIdentifyOptions, 'waitForNetwork
22
22
  bootstrap?: unknown;
23
23
  }
24
24
 
25
- /**
26
- * Initialization options for the LaunchDarkly browser SDK.
27
- */
28
- interface BrowserOptions extends Omit<LDOptions, 'initialConnectionMode'> {
29
- /**
30
- * Whether the client should make a request to LaunchDarkly for Experimentation metrics (goals).
31
- *
32
- * This is true by default, meaning that this request will be made on every page load.
33
- * Set it to false if you are not using Experimentation and want to skip the request.
34
- */
35
- fetchGoals?: boolean;
36
- /**
37
- * A function which, if present, can change the URL in analytics events to something other
38
- * than the actual browser URL. It will be called with the current browser URL as a parameter,
39
- * and returns the value that should be stored in the event's `url` property.
40
- *
41
- * It may be useful to customize the `url` to provide specific meaning, incorporate
42
- * client-side routing concerns, or redact tokens or other info.
43
- */
44
- eventUrlTransformer?: (url: string) => string;
45
- /**
46
- * Whether or not to open a streaming connection to LaunchDarkly for live flag updates.
47
- *
48
- * If this is true, the client will always attempt to maintain a streaming connection; if false,
49
- * it never will. If you leave the value undefined (the default), the client will open a streaming
50
- * connection if you subscribe to `"change"` or `"change:flag-key"` events.
51
- *
52
- * This is equivalent to calling `client.setStreaming()` with the same value.
53
- */
54
- streaming?: boolean;
55
- /**
56
- * Determines if the SDK responds to entering different visibility states, such as foreground and background.
57
- * An example is flushing buffered events when going to the background.
58
- *
59
- * This is true by default. Generally speaking the SDK will be able to most reliably deliver
60
- * events with this setting on.
61
- *
62
- * It may be useful to disable for environments where not all window/document objects are
63
- * available, such as when running the SDK in a browser extension.
64
- */
65
- automaticBackgroundHandling?: boolean;
66
- }
67
-
68
25
  /**
69
26
  *
70
27
  * The LaunchDarkly SDK client object.
@@ -121,6 +78,61 @@ type LDClient = Omit<LDClient$1, 'setConnectionMode' | 'getConnectionMode' | 'ge
121
78
  identify(context: LDContext, identifyOptions?: BrowserIdentifyOptions): Promise<void>;
122
79
  };
123
80
 
81
+ /**
82
+ * Interface for plugins to the LaunchDarkly SDK.
83
+ */
84
+ interface LDPlugin extends LDPluginBase<LDClient, Hook> {
85
+ }
86
+
87
+ /**
88
+ * Initialization options for the LaunchDarkly browser SDK.
89
+ */
90
+ interface BrowserOptions extends Omit<LDOptions, 'initialConnectionMode'> {
91
+ /**
92
+ * Whether the client should make a request to LaunchDarkly for Experimentation metrics (goals).
93
+ *
94
+ * This is true by default, meaning that this request will be made on every page load.
95
+ * Set it to false if you are not using Experimentation and want to skip the request.
96
+ */
97
+ fetchGoals?: boolean;
98
+ /**
99
+ * A function which, if present, can change the URL in analytics events to something other
100
+ * than the actual browser URL. It will be called with the current browser URL as a parameter,
101
+ * and returns the value that should be stored in the event's `url` property.
102
+ *
103
+ * It may be useful to customize the `url` to provide specific meaning, incorporate
104
+ * client-side routing concerns, or redact tokens or other info.
105
+ */
106
+ eventUrlTransformer?: (url: string) => string;
107
+ /**
108
+ * Whether or not to open a streaming connection to LaunchDarkly for live flag updates.
109
+ *
110
+ * If this is true, the client will always attempt to maintain a streaming connection; if false,
111
+ * it never will. If you leave the value undefined (the default), the client will open a streaming
112
+ * connection if you subscribe to `"change"` or `"change:flag-key"` events.
113
+ *
114
+ * This is equivalent to calling `client.setStreaming()` with the same value.
115
+ */
116
+ streaming?: boolean;
117
+ /**
118
+ * Determines if the SDK responds to entering different visibility states, such as foreground and background.
119
+ * An example is flushing buffered events when going to the background.
120
+ *
121
+ * This is true by default. Generally speaking the SDK will be able to most reliably deliver
122
+ * events with this setting on.
123
+ *
124
+ * It may be useful to disable for environments where not all window/document objects are
125
+ * available, such as when running the SDK in a browser extension.
126
+ */
127
+ automaticBackgroundHandling?: boolean;
128
+ /**
129
+ * A list of plugins to be used with the SDK.
130
+ *
131
+ * Plugin support is currently experimental and subject to change.
132
+ */
133
+ plugins?: LDPlugin[];
134
+ }
135
+
124
136
  /**
125
137
  * Provides a basic {@link LDLogger} implementation.
126
138
  *
@@ -171,4 +183,4 @@ type LDClient = Omit<LDClient$1, 'setConnectionMode' | 'getConnectionMode' | 'ge
171
183
  */
172
184
  declare function basicLogger(options: BasicLoggerOptions): LDLogger;
173
185
 
174
- export { type BrowserOptions as B, type LDClient as L, type BrowserIdentifyOptions as a, basicLogger as b };
186
+ export { type BrowserOptions as B, type LDClient as L, type LDPlugin as a, type BrowserIdentifyOptions as b, basicLogger as c };
@@ -1,4 +1,4 @@
1
- import { LDIdentifyOptions, LDOptions, LDClient as LDClient$1, LDContext, BasicLoggerOptions, LDLogger } from '@launchdarkly/js-client-sdk-common';
1
+ import { LDIdentifyOptions, LDClient as LDClient$1, LDContext, LDPluginBase, Hook, LDOptions, BasicLoggerOptions, LDLogger } from '@launchdarkly/js-client-sdk-common';
2
2
 
3
3
  interface BrowserIdentifyOptions extends Omit<LDIdentifyOptions, 'waitForNetworkResults'> {
4
4
  /**
@@ -22,49 +22,6 @@ interface BrowserIdentifyOptions extends Omit<LDIdentifyOptions, 'waitForNetwork
22
22
  bootstrap?: unknown;
23
23
  }
24
24
 
25
- /**
26
- * Initialization options for the LaunchDarkly browser SDK.
27
- */
28
- interface BrowserOptions extends Omit<LDOptions, 'initialConnectionMode'> {
29
- /**
30
- * Whether the client should make a request to LaunchDarkly for Experimentation metrics (goals).
31
- *
32
- * This is true by default, meaning that this request will be made on every page load.
33
- * Set it to false if you are not using Experimentation and want to skip the request.
34
- */
35
- fetchGoals?: boolean;
36
- /**
37
- * A function which, if present, can change the URL in analytics events to something other
38
- * than the actual browser URL. It will be called with the current browser URL as a parameter,
39
- * and returns the value that should be stored in the event's `url` property.
40
- *
41
- * It may be useful to customize the `url` to provide specific meaning, incorporate
42
- * client-side routing concerns, or redact tokens or other info.
43
- */
44
- eventUrlTransformer?: (url: string) => string;
45
- /**
46
- * Whether or not to open a streaming connection to LaunchDarkly for live flag updates.
47
- *
48
- * If this is true, the client will always attempt to maintain a streaming connection; if false,
49
- * it never will. If you leave the value undefined (the default), the client will open a streaming
50
- * connection if you subscribe to `"change"` or `"change:flag-key"` events.
51
- *
52
- * This is equivalent to calling `client.setStreaming()` with the same value.
53
- */
54
- streaming?: boolean;
55
- /**
56
- * Determines if the SDK responds to entering different visibility states, such as foreground and background.
57
- * An example is flushing buffered events when going to the background.
58
- *
59
- * This is true by default. Generally speaking the SDK will be able to most reliably deliver
60
- * events with this setting on.
61
- *
62
- * It may be useful to disable for environments where not all window/document objects are
63
- * available, such as when running the SDK in a browser extension.
64
- */
65
- automaticBackgroundHandling?: boolean;
66
- }
67
-
68
25
  /**
69
26
  *
70
27
  * The LaunchDarkly SDK client object.
@@ -121,6 +78,61 @@ type LDClient = Omit<LDClient$1, 'setConnectionMode' | 'getConnectionMode' | 'ge
121
78
  identify(context: LDContext, identifyOptions?: BrowserIdentifyOptions): Promise<void>;
122
79
  };
123
80
 
81
+ /**
82
+ * Interface for plugins to the LaunchDarkly SDK.
83
+ */
84
+ interface LDPlugin extends LDPluginBase<LDClient, Hook> {
85
+ }
86
+
87
+ /**
88
+ * Initialization options for the LaunchDarkly browser SDK.
89
+ */
90
+ interface BrowserOptions extends Omit<LDOptions, 'initialConnectionMode'> {
91
+ /**
92
+ * Whether the client should make a request to LaunchDarkly for Experimentation metrics (goals).
93
+ *
94
+ * This is true by default, meaning that this request will be made on every page load.
95
+ * Set it to false if you are not using Experimentation and want to skip the request.
96
+ */
97
+ fetchGoals?: boolean;
98
+ /**
99
+ * A function which, if present, can change the URL in analytics events to something other
100
+ * than the actual browser URL. It will be called with the current browser URL as a parameter,
101
+ * and returns the value that should be stored in the event's `url` property.
102
+ *
103
+ * It may be useful to customize the `url` to provide specific meaning, incorporate
104
+ * client-side routing concerns, or redact tokens or other info.
105
+ */
106
+ eventUrlTransformer?: (url: string) => string;
107
+ /**
108
+ * Whether or not to open a streaming connection to LaunchDarkly for live flag updates.
109
+ *
110
+ * If this is true, the client will always attempt to maintain a streaming connection; if false,
111
+ * it never will. If you leave the value undefined (the default), the client will open a streaming
112
+ * connection if you subscribe to `"change"` or `"change:flag-key"` events.
113
+ *
114
+ * This is equivalent to calling `client.setStreaming()` with the same value.
115
+ */
116
+ streaming?: boolean;
117
+ /**
118
+ * Determines if the SDK responds to entering different visibility states, such as foreground and background.
119
+ * An example is flushing buffered events when going to the background.
120
+ *
121
+ * This is true by default. Generally speaking the SDK will be able to most reliably deliver
122
+ * events with this setting on.
123
+ *
124
+ * It may be useful to disable for environments where not all window/document objects are
125
+ * available, such as when running the SDK in a browser extension.
126
+ */
127
+ automaticBackgroundHandling?: boolean;
128
+ /**
129
+ * A list of plugins to be used with the SDK.
130
+ *
131
+ * Plugin support is currently experimental and subject to change.
132
+ */
133
+ plugins?: LDPlugin[];
134
+ }
135
+
124
136
  /**
125
137
  * Provides a basic {@link LDLogger} implementation.
126
138
  *
@@ -171,4 +183,4 @@ type LDClient = Omit<LDClient$1, 'setConnectionMode' | 'getConnectionMode' | 'ge
171
183
  */
172
184
  declare function basicLogger(options: BasicLoggerOptions): LDLogger;
173
185
 
174
- export { type BrowserOptions as B, type LDClient as L, type BrowserIdentifyOptions as a, basicLogger as b };
186
+ export { type BrowserOptions as B, type LDClient as L, type LDPlugin as a, type BrowserIdentifyOptions as b, basicLogger as c };