launchdarkly-vue-client-sdk
Advanced tools
Comparing version 1.2.1 to 2.0.0
{ | ||
"name": "launchdarkly-vue-client-sdk", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "LaunchDarkly Client-side SDK for VueJS", | ||
@@ -48,3 +48,3 @@ "main": "./dist/launchdarkly-vue-client-sdk.umd.js", | ||
"dependencies": { | ||
"launchdarkly-js-client-sdk": "2.24.2" | ||
"launchdarkly-js-client-sdk": "3.1.3" | ||
}, | ||
@@ -58,7 +58,9 @@ "devDependencies": { | ||
"eslint": "^8.18.0", | ||
"jest": "^29.5.0", | ||
"jest-junit": "^14.0.0", | ||
"prettier": "2.7.1", | ||
"ts-jest": "^28.0.5", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "~4.5.4", | ||
"vite": "^2.9.9", | ||
"vue": "^3.2.36", | ||
"vue-tsc": "^0.38.1" | ||
@@ -65,0 +67,0 @@ }, |
@@ -5,3 +5,3 @@ # LaunchDarkly Client-side SDK for VueJS | ||
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today! | ||
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today! | ||
@@ -12,3 +12,3 @@ [![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly) | ||
This SDK only supports Vue 3. | ||
This SDK supports Vue 3.2 and newer versions. | ||
@@ -25,3 +25,3 @@ Additionally, refer to the [JavaScript SDK README](https://github.com/launchdarkly/js-client-sdk#browser-compatibility) to learn more about browser compatibility. | ||
Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [reference guide for this SDK](https://docs.launchdarkly.com/sdk/client-side/vue) or our [code-generated API documentation](https://launchdarkly.github.io/vue-client-sdk/). | ||
Read our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [reference guide for this SDK](https://docs.launchdarkly.com/sdk/client-side/vue) or our [code-generated API documentation](https://launchdarkly.github.io/vue-client-sdk/). | ||
@@ -40,13 +40,13 @@ This SDK builds upon the [JavaScript SDK](https://github.com/launchdarkly/js-client-sdk), supporting all of the same functionality, but using Vue's Composition API to add providers additional conveniences. While using this SDK you may need to directly interact with the underlying JavaScript SDK. For more information on how to use the JavaScript SDK and its characteristics, see the [SDK's README](https://github.com/launchdarkly/js-client-sdk/blob/main/README.md). | ||
* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can: | ||
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. | ||
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). | ||
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. | ||
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline. | ||
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list. | ||
* Explore LaunchDarkly | ||
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information | ||
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides | ||
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation | ||
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates | ||
- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can: | ||
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. | ||
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). | ||
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. | ||
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline. | ||
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list. | ||
- Explore LaunchDarkly | ||
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information | ||
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides | ||
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation | ||
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates | ||
@@ -53,0 +53,0 @@ ## Development |
@@ -1,5 +0,6 @@ | ||
import { initialize, type LDClient, type LDUser, type LDOptions } from 'launchdarkly-js-client-sdk' | ||
import { initialize, type LDClient, type LDContext, type LDOptions } from 'launchdarkly-js-client-sdk' | ||
import { readonly, ref, type InjectionKey, type Ref, type App } from 'vue' | ||
import { getLDFlag, type FlagRef } from './getLDFlag' | ||
import { version } from '../package.json' | ||
import { getContextOrUser } from './utils' | ||
export { useLDReady, useLDFlag, ldInit, useLDClient } from './hooks' | ||
@@ -12,9 +13,16 @@ | ||
clientSideID?: string | undefined | ||
/** | ||
* User definition. | ||
* | ||
* @defaultValue Defaults to anonymous user, `{ anonymous: 'true' }` | ||
* A LaunchDarkly context object. If unspecified, an anonymous context | ||
* with kind: 'user' will be created and used. | ||
*/ | ||
user?: LDUser | undefined | ||
context?: LDContext | ||
/** | ||
* @deprecated The `user` property will be removed in a future version, | ||
* please update your code to use context instead. | ||
*/ | ||
user?: LDContext | ||
/** | ||
* Enables or disables automatically subscribing to live updates to flags referenced using {@link useLDFlag}. | ||
@@ -25,2 +33,3 @@ * | ||
streaming?: boolean | ||
/** | ||
@@ -32,2 +41,3 @@ * Defers initialization of the LaunchDarkly client until {@link ldInit} is called explicitly. | ||
deferInitialization?: boolean | ||
/** | ||
@@ -44,2 +54,3 @@ * Options to pass to the underlying javascript SDK. | ||
export const LD_INIT = Symbol() as InjectionKey<(o?: LDPluginOptions) => [Readonly<Ref<boolean>>, LDClient]> | ||
/** | ||
@@ -51,2 +62,3 @@ * Injection key used to retrieve a boolean ref indicating if the LaunchDarkly client has finished initializing. | ||
export const LD_READY = Symbol() as InjectionKey<Readonly<Ref<boolean>>> | ||
/** | ||
@@ -57,2 +69,3 @@ * Injection key used to retrieve LaunchDarkly client. Usage: `const ldClient = inject(LD_CLIENT)`. | ||
export const LD_CLIENT = Symbol() as InjectionKey<LDClient> | ||
/** | ||
@@ -75,18 +88,26 @@ * Injection key used to retrieve `ldFlag` function. Usage: `const ldFlag = inject(LD_FLAG)`. | ||
const $ldReady = readonly(ldReady) | ||
const $ldInit = (initOptions: LDPluginOptions = {}): [Readonly<Ref<boolean>>, LDClient] => { | ||
const clientSideID = initOptions.clientSideID ?? pluginOptions.clientSideID | ||
if (!clientSideID) { | ||
throw new Error(`Cannot initialize LaunchDarkly without a clientSideID`) | ||
} | ||
const user = initOptions.user ?? pluginOptions.user ?? { anonymous: true } | ||
const context = getContextOrUser(initOptions) ?? | ||
getContextOrUser(pluginOptions) ?? { anonymous: true, kind: 'user' } | ||
const options = initOptions.options ?? pluginOptions.options | ||
const wrapperOptions = { wrapperName: 'vue-client-sdk', wrapperVersion: version } | ||
const $ldClient = initialize(clientSideID, user, { ...wrapperOptions, ...options }) | ||
const $ldClient = initialize(clientSideID, context, { ...wrapperOptions, ...options }) | ||
app.provide(LD_CLIENT, $ldClient) | ||
const enableStreaming = pluginOptions.streaming === false || initOptions.streaming === false ? false : true | ||
app.provide(LD_FLAG, getLDFlag(ldReady, $ldClient, enableStreaming)) | ||
$ldClient.on('ready', () => (ldReady.value = true)) | ||
return [$ldReady, $ldClient] | ||
} | ||
app.provide(LD_READY, $ldReady) | ||
if (pluginOptions.deferInitialization) { | ||
@@ -93,0 +114,0 @@ app.provide(LD_INIT, $ldInit) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
14743
14
7
173
1
+ Addedlaunchdarkly-js-client-sdk@3.1.3(transitive)
+ Addedlaunchdarkly-js-sdk-common@5.0.3(transitive)
+ Addeduuid@8.3.2(transitive)
- Removedlaunchdarkly-js-client-sdk@2.24.2(transitive)
- Removedlaunchdarkly-js-sdk-common@3.8.2(transitive)
- Removeduuid@3.4.0(transitive)