@bucketco/react-sdk
Advanced tools
Comparing version
@@ -40,3 +40,3 @@ import { default as React, ReactNode } from 'react'; | ||
}; | ||
type Feature<TKey extends FeatureKey> = { | ||
export type Feature<TKey extends FeatureKey> = { | ||
isEnabled: boolean; | ||
@@ -154,3 +154,16 @@ isLoading: boolean; | ||
}) => Promise<void> | undefined; | ||
/** | ||
* Returns the current `BucketClient` used by the `BucketProvider`. | ||
* | ||
* This is useful if you need to access the `BucketClient` outside of the `BucketProvider`. | ||
* | ||
* ```ts | ||
* const client = useClient(); | ||
* client.on("configCheck", () => { | ||
* console.log("configCheck hook called"); | ||
* }); | ||
* ``` | ||
*/ | ||
export declare function useClient(): BucketClient | undefined; | ||
export {}; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@bucketco/react-sdk", | ||
"version": "3.0.0-alpha.6", | ||
"version": "3.0.0-alpha.8", | ||
"license": "MIT", | ||
@@ -37,3 +37,3 @@ "repository": { | ||
"dependencies": { | ||
"@bucketco/browser-sdk": "3.0.0-alpha.4", | ||
"@bucketco/browser-sdk": "3.0.0-alpha.5", | ||
"canonical-json": "^0.0.4", | ||
@@ -47,4 +47,4 @@ "rollup": "^4.2.0" | ||
"devDependencies": { | ||
"@bucketco/eslint-config": "workspace:^", | ||
"@bucketco/tsconfig": "workspace:^", | ||
"@bucketco/eslint-config": "^0.0.2", | ||
"@bucketco/tsconfig": "^0.0.2", | ||
"@testing-library/react": "^15.0.7", | ||
@@ -70,3 +70,4 @@ "@types/jsdom": "^21.1.6", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
}, | ||
"gitHead": "62b55a86472f60a4a99e08a66e26c5d318aad525" | ||
} |
@@ -399,2 +399,23 @@ # Bucket React SDK | ||
### `useClient()` | ||
Returns the `BucketClient` used by the `BucketProvider`. The client offers more functionality that | ||
is not directly accessible thorough the other hooks. | ||
```tsx | ||
import { useClient } from "@bucketco/react-sdk"; | ||
function LoggingWrapper({ children }: { children: ReactNode }) { | ||
const client = useClient(); | ||
useEffect(() => { | ||
client.on("enabledCheck", (evt) => { | ||
console.log(`The feature ${evt.key} is ${evt.value} for user.`); | ||
}); | ||
}, [client]); | ||
return children; | ||
} | ||
``` | ||
## Content Security Policy (CSP) | ||
@@ -401,0 +422,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
884699
13.93%11
22.22%4962
10.1%429
5.15%4
33.33%21
50%12
50%+ Added
- Removed