@flagify/react 1.0.0 → 1.0.2
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/README.md +23 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://flagify.dev">
|
|
3
|
-
<
|
|
4
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://flagify.dev/logo-white.svg" />
|
|
5
|
-
<source media="(prefers-color-scheme: light)" srcset="https://flagify.dev/logo-color.svg" />
|
|
6
|
-
<img alt="Flagify" src="https://flagify.dev/logo-color.svg" width="280" />
|
|
7
|
-
</picture>
|
|
3
|
+
<img alt="Flagify" src="https://flagify.dev/logo-color.svg" width="280" />
|
|
8
4
|
</a>
|
|
9
5
|
</p>
|
|
10
6
|
|
|
@@ -15,14 +11,14 @@
|
|
|
15
11
|
<p align="center">
|
|
16
12
|
<a href="https://www.npmjs.com/package/@flagify/react"><img src="https://img.shields.io/npm/v/@flagify/react.svg?style=flat-square&color=0D80F9" alt="npm version" /></a>
|
|
17
13
|
<a href="https://www.npmjs.com/package/@flagify/react"><img src="https://img.shields.io/npm/dm/@flagify/react.svg?style=flat-square&color=0D80F9" alt="npm downloads" /></a>
|
|
18
|
-
<a href="https://github.com/flagifyhq/
|
|
19
|
-
<a href="https://github.com/flagifyhq/
|
|
14
|
+
<a href="https://github.com/flagifyhq/javascript/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@flagify/react.svg?style=flat-square&color=0D80F9" alt="license" /></a>
|
|
15
|
+
<a href="https://github.com/flagifyhq/javascript"><img src="https://img.shields.io/github/stars/flagifyhq/javascript?style=flat-square&color=0D80F9" alt="github stars" /></a>
|
|
20
16
|
</p>
|
|
21
17
|
|
|
22
18
|
<p align="center">
|
|
23
19
|
<a href="https://flagify.dev/docs">Documentation</a> ·
|
|
24
20
|
<a href="https://flagify.dev/docs/sdks/react">SDK Reference</a> ·
|
|
25
|
-
<a href="https://github.com/flagifyhq/
|
|
21
|
+
<a href="https://github.com/flagifyhq/javascript/issues">Issues</a> ·
|
|
26
22
|
<a href="https://flagify.dev">Website</a>
|
|
27
23
|
</p>
|
|
28
24
|
|
|
@@ -218,9 +214,24 @@ function ItemList() {
|
|
|
218
214
|
|
|
219
215
|
---
|
|
220
216
|
|
|
217
|
+
### `useIsReady(): boolean`
|
|
218
|
+
|
|
219
|
+
Returns `true` once the Flagify client has completed its initial flag sync. Useful for showing loading states.
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
function App() {
|
|
223
|
+
const isReady = useIsReady()
|
|
224
|
+
|
|
225
|
+
if (!isReady) return <Spinner />
|
|
226
|
+
return <Dashboard />
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
221
232
|
### `useFlagifyClient(): Flagify`
|
|
222
233
|
|
|
223
|
-
Direct access to the underlying [`Flagify`](https://
|
|
234
|
+
Direct access to the underlying [`Flagify`](https://www.npmjs.com/package/@flagify/node) client instance. Throws if used outside of `<FlagifyProvider>`.
|
|
224
235
|
|
|
225
236
|
```tsx
|
|
226
237
|
function FeatureGate({ flagKey, children }: { flagKey: string; children: ReactNode }) {
|
|
@@ -306,6 +317,7 @@ function ThemeProvider({ children }: { children: ReactNode }) {
|
|
|
306
317
|
| `useFlag` | Hook | Boolean flag evaluation |
|
|
307
318
|
| `useVariant` | Hook | String variant evaluation |
|
|
308
319
|
| `useFlagValue` | Hook | Typed value evaluation with generics |
|
|
320
|
+
| `useIsReady` | Hook | Client readiness check |
|
|
309
321
|
| `useFlagifyClient` | Hook | Direct client access |
|
|
310
322
|
| `FlagifyProviderProps` | Type | Props for `FlagifyProvider` |
|
|
311
323
|
| `FlagifyContextValue` | Type | Shape of the context value |
|
|
@@ -325,8 +337,8 @@ We welcome contributions. Please open an issue first to discuss what you'd like
|
|
|
325
337
|
|
|
326
338
|
```bash
|
|
327
339
|
# Clone
|
|
328
|
-
git clone https://github.com/flagifyhq/
|
|
329
|
-
cd
|
|
340
|
+
git clone https://github.com/flagifyhq/javascript.git
|
|
341
|
+
cd javascript
|
|
330
342
|
|
|
331
343
|
# Install
|
|
332
344
|
pnpm install
|
|
@@ -336,9 +348,6 @@ pnpm run dev
|
|
|
336
348
|
|
|
337
349
|
# Build
|
|
338
350
|
pnpm run build
|
|
339
|
-
|
|
340
|
-
# Generate barrel exports
|
|
341
|
-
pnpm run generate
|
|
342
351
|
```
|
|
343
352
|
|
|
344
353
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flagify/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "React SDK for Flagify — hooks and provider for feature flag evaluation.",
|
|
5
5
|
"author": "Mario Campbell R <mario@mariocampbellr.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"react": ">=18.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@flagify/node": "1.0.
|
|
24
|
+
"@flagify/node": "1.0.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@testing-library/jest-dom": "^6.9.1",
|