@featureflare/react 0.0.3 → 0.0.4
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 +26 -23
- package/dist/index.cjs +25 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -15
- package/dist/index.d.ts +17 -15
- package/dist/index.js +23 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @featureflare/react
|
|
2
2
|
|
|
3
|
-
React hooks and provider for
|
|
3
|
+
React hooks and provider for FeatureFlare feature flags.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -21,22 +21,24 @@ yarn add @featureflare/react
|
|
|
21
21
|
|
|
22
22
|
### Setup Provider
|
|
23
23
|
|
|
24
|
-
Wrap your app with `
|
|
24
|
+
Wrap your app with `FeatureFlareProvider`:
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
|
-
import {
|
|
27
|
+
import { FeatureFlareProvider } from '@featureflare/react';
|
|
28
28
|
|
|
29
29
|
export function App() {
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
31
|
+
<FeatureFlareProvider
|
|
32
32
|
config={{
|
|
33
|
+
// Optional: explicit FeatureFlare API URL
|
|
34
|
+
apiBaseUrl: 'https://shipit-api-392444455847.us-central1.run.app',
|
|
33
35
|
// SDK automatically uses window.location.origin in browser
|
|
34
36
|
sdkKey: 'your-client-key-here' // Client key for browser
|
|
35
37
|
}}
|
|
36
38
|
initialUser={{ id: 'user-123' }}
|
|
37
39
|
>
|
|
38
40
|
{/* Your app */}
|
|
39
|
-
</
|
|
41
|
+
</FeatureFlareProvider>
|
|
40
42
|
);
|
|
41
43
|
}
|
|
42
44
|
```
|
|
@@ -60,13 +62,13 @@ export function NewNav() {
|
|
|
60
62
|
|
|
61
63
|
### Update User
|
|
62
64
|
|
|
63
|
-
Use the `
|
|
65
|
+
Use the `useFeatureFlareUser` hook to get and update the current user:
|
|
64
66
|
|
|
65
67
|
```typescript
|
|
66
|
-
import {
|
|
68
|
+
import { useFeatureFlareUser } from '@featureflare/react';
|
|
67
69
|
|
|
68
70
|
export function UserSwitcher() {
|
|
69
|
-
const [user, setUser] =
|
|
71
|
+
const [user, setUser] = useFeatureFlareUser();
|
|
70
72
|
|
|
71
73
|
return (
|
|
72
74
|
<button
|
|
@@ -85,19 +87,20 @@ export function UserSwitcher() {
|
|
|
85
87
|
|
|
86
88
|
## API Reference
|
|
87
89
|
|
|
88
|
-
### `
|
|
90
|
+
### `FeatureFlareProvider`
|
|
89
91
|
|
|
90
|
-
Provider component that wraps your app and provides the
|
|
92
|
+
Provider component that wraps your app and provides the FeatureFlare client context.
|
|
91
93
|
|
|
92
94
|
#### Props
|
|
93
95
|
|
|
94
|
-
- `config:
|
|
95
|
-
- `
|
|
96
|
+
- `config: FeatureFlareReactConfig` - Configuration object
|
|
97
|
+
- `apiBaseUrl?: string` - Optional explicit FeatureFlare API base URL.
|
|
98
|
+
- `sdkKey?: string` - Client SDK key (recommended). If not provided, reads from `FEATUREFLARE_CLIENT_KEY` env var.
|
|
96
99
|
- `projectKey?: string` - Legacy: project key (requires `envKey`). Not recommended.
|
|
97
100
|
- `envKey?: string` - Environment key (default: `'production'`). Only used with `projectKey`.
|
|
98
|
-
- `initialUser:
|
|
99
|
-
- `user?:
|
|
100
|
-
- `onUserChange?: (user:
|
|
101
|
+
- `initialUser: FeatureFlareUserPayload` - Initial user payload
|
|
102
|
+
- `user?: FeatureFlareUserPayload` - Controlled user (requires `onUserChange`)
|
|
103
|
+
- `onUserChange?: (user: FeatureFlareUserPayload) => void` - Callback for user changes (required if using controlled `user`)
|
|
101
104
|
- `children: React.ReactNode` - Your app components
|
|
102
105
|
|
|
103
106
|
### `useBoolFlag(flagKey: string, defaultValue: boolean)`
|
|
@@ -116,31 +119,31 @@ Hook to evaluate a boolean feature flag.
|
|
|
116
119
|
const { value, loading, error } = useBoolFlag('feature-flag', false);
|
|
117
120
|
```
|
|
118
121
|
|
|
119
|
-
### `
|
|
122
|
+
### `useFeatureFlareUser()`
|
|
120
123
|
|
|
121
124
|
Hook to get and update the current user.
|
|
122
125
|
|
|
123
126
|
**Returns:**
|
|
124
127
|
|
|
125
|
-
`[user:
|
|
128
|
+
`[user: FeatureFlareUserPayload | null, setUser: (user: FeatureFlareUserPayload) => void]`
|
|
126
129
|
|
|
127
130
|
**Example:**
|
|
128
131
|
|
|
129
132
|
```typescript
|
|
130
|
-
const [user, setUser] =
|
|
133
|
+
const [user, setUser] = useFeatureFlareUser();
|
|
131
134
|
```
|
|
132
135
|
|
|
133
136
|
## Environment Variables
|
|
134
137
|
|
|
135
138
|
The SDK automatically reads from environment variables if `sdkKey` is not provided:
|
|
136
139
|
|
|
137
|
-
- `
|
|
140
|
+
- `FEATUREFLARE_CLIENT_KEY` - Client SDK key
|
|
138
141
|
|
|
139
142
|
```typescript
|
|
140
|
-
// This will use
|
|
141
|
-
<
|
|
143
|
+
// This will use FEATUREFLARE_CLIENT_KEY from env if sdkKey is not provided
|
|
144
|
+
<FeatureFlareProvider config={{}} initialUser={{ id: 'user-123' }}>
|
|
142
145
|
{/* ... */}
|
|
143
|
-
</
|
|
146
|
+
</FeatureFlareProvider>
|
|
144
147
|
```
|
|
145
148
|
|
|
146
149
|
## API Base URL
|
|
@@ -151,7 +154,7 @@ The SDK automatically uses `window.location.origin` in the browser (assumes API
|
|
|
151
154
|
|
|
152
155
|
Use **client keys** for browser/mobile applications. Client keys are not secret and will be visible in your JavaScript bundle.
|
|
153
156
|
|
|
154
|
-
Get your SDK keys from your
|
|
157
|
+
Get your SDK keys from your FeatureFlare Console → Environments.
|
|
155
158
|
|
|
156
159
|
## License
|
|
157
160
|
|
package/dist/index.cjs
CHANGED
|
@@ -30,11 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
|
|
33
|
+
FeatureFlareProvider: () => FeatureFlareProvider,
|
|
34
34
|
useBoolFlag: () => useBoolFlag,
|
|
35
35
|
useBoolFlags: () => useBoolFlags,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
useFeatureFlareContext: () => useFeatureFlareContext,
|
|
37
|
+
useFeatureFlareUser: () => useFeatureFlareUser
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(index_exports);
|
|
40
40
|
|
|
@@ -42,38 +42,44 @@ module.exports = __toCommonJS(index_exports);
|
|
|
42
42
|
var import_react = __toESM(require("react"), 1);
|
|
43
43
|
var import_sdk_js = require("@featureflare/sdk-js");
|
|
44
44
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var
|
|
46
|
-
function
|
|
45
|
+
var FeatureFlareContext = (0, import_react.createContext)(null);
|
|
46
|
+
function FeatureFlareProvider(props) {
|
|
47
47
|
if (props.user && !props.onUserChange) {
|
|
48
|
-
throw new Error("
|
|
48
|
+
throw new Error("FeatureFlareProvider: when providing `user`, also provide `onUserChange` (controlled mode).");
|
|
49
49
|
}
|
|
50
50
|
const [internalUser, setInternalUser] = (0, import_react.useState)(props.initialUser);
|
|
51
51
|
const user = props.user ?? internalUser;
|
|
52
52
|
const setUser = props.onUserChange ?? setInternalUser;
|
|
53
53
|
const client = (0, import_react.useMemo)(() => {
|
|
54
|
-
return new import_sdk_js.
|
|
54
|
+
return new import_sdk_js.FeatureFlareClient({
|
|
55
|
+
apiBaseUrl: props.config.apiBaseUrl,
|
|
55
56
|
sdkKey: props.config.sdkKey,
|
|
56
57
|
projectKey: props.config.projectKey,
|
|
57
58
|
envKey: props.config.envKey
|
|
58
59
|
});
|
|
59
|
-
}, [
|
|
60
|
+
}, [
|
|
61
|
+
props.config.apiBaseUrl,
|
|
62
|
+
props.config.envKey,
|
|
63
|
+
props.config.projectKey,
|
|
64
|
+
props.config.sdkKey
|
|
65
|
+
]);
|
|
60
66
|
const value = (0, import_react.useMemo)(() => ({ client, user, setUser }), [client, user]);
|
|
61
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FeatureFlareContext.Provider, { value, children: props.children });
|
|
62
68
|
}
|
|
63
|
-
function
|
|
64
|
-
const ctx = import_react.default.useContext(
|
|
65
|
-
if (!ctx) throw new Error("
|
|
69
|
+
function useFeatureFlareContext() {
|
|
70
|
+
const ctx = import_react.default.useContext(FeatureFlareContext);
|
|
71
|
+
if (!ctx) throw new Error("useFeatureFlareContext must be used within <FeatureFlareProvider>.");
|
|
66
72
|
return ctx;
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
// src/hooks.ts
|
|
70
76
|
var import_react2 = require("react");
|
|
71
|
-
function
|
|
72
|
-
const { user, setUser } =
|
|
77
|
+
function useFeatureFlareUser() {
|
|
78
|
+
const { user, setUser } = useFeatureFlareContext();
|
|
73
79
|
return [user, setUser];
|
|
74
80
|
}
|
|
75
81
|
function useBoolFlag(flagKey, defaultValue = false) {
|
|
76
|
-
const { client, user } =
|
|
82
|
+
const { client, user } = useFeatureFlareContext();
|
|
77
83
|
const [state, setState] = (0, import_react2.useState)({ value: defaultValue, loading: true, error: null });
|
|
78
84
|
const userId = user.id ?? user.key ?? "";
|
|
79
85
|
const key = (0, import_react2.useMemo)(() => `${flagKey}:${userId}`, [flagKey, userId]);
|
|
@@ -103,7 +109,7 @@ function useBoolFlag(flagKey, defaultValue = false) {
|
|
|
103
109
|
return state;
|
|
104
110
|
}
|
|
105
111
|
function useBoolFlags(flagKeys, defaultValue = false) {
|
|
106
|
-
const { client, user } =
|
|
112
|
+
const { client, user } = useFeatureFlareContext();
|
|
107
113
|
const sortedKeys = (0, import_react2.useMemo)(() => [...flagKeys].map((k) => k.trim()).filter(Boolean).sort(), [flagKeys]);
|
|
108
114
|
const userId = user.id ?? user.key ?? "";
|
|
109
115
|
const key = (0, import_react2.useMemo)(() => `${sortedKeys.join(",")}:${userId}`, [sortedKeys, userId]);
|
|
@@ -139,10 +145,10 @@ function useBoolFlags(flagKeys, defaultValue = false) {
|
|
|
139
145
|
}
|
|
140
146
|
// Annotate the CommonJS export names for ESM import in node:
|
|
141
147
|
0 && (module.exports = {
|
|
142
|
-
|
|
148
|
+
FeatureFlareProvider,
|
|
143
149
|
useBoolFlag,
|
|
144
150
|
useBoolFlags,
|
|
145
|
-
|
|
146
|
-
|
|
151
|
+
useFeatureFlareContext,
|
|
152
|
+
useFeatureFlareUser
|
|
147
153
|
});
|
|
148
154
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/provider.tsx","../src/hooks.ts"],"sourcesContent":["export * from './provider.js';\nexport * from './hooks.js';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/provider.tsx","../src/hooks.ts"],"sourcesContent":["export * from './provider.js';\nexport * from './hooks.js';\nexport type { FeatureFlareUserPayload } from '@featureflare/sdk-js';\n","import React, { createContext, useMemo, useState } from 'react';\nimport { FeatureFlareClient, type FeatureFlareUserPayload } from '@featureflare/sdk-js';\n\ntype FeatureFlareReactConfig = {\n /** Optional: explicit FeatureFlare API base URL. */\n apiBaseUrl?: string;\n /** Recommended: use a client key (featureflare_cli_...). */\n sdkKey?: string;\n /** Legacy/insecure browser mode: uses /api/v1/eval (no sdkKey). */\n projectKey?: string;\n envKey?: string;\n};\n\ntype FeatureFlareContextValue = {\n client: FeatureFlareClient;\n user: FeatureFlareUserPayload;\n setUser: (next: FeatureFlareUserPayload) => void;\n};\n\nconst FeatureFlareContext = createContext<FeatureFlareContextValue | null>(null);\n\nexport function FeatureFlareProvider(props: {\n config: FeatureFlareReactConfig;\n initialUser: FeatureFlareUserPayload;\n user?: FeatureFlareUserPayload;\n onUserChange?: (next: FeatureFlareUserPayload) => void;\n children: React.ReactNode;\n}) {\n if (props.user && !props.onUserChange) {\n throw new Error('FeatureFlareProvider: when providing `user`, also provide `onUserChange` (controlled mode).');\n }\n\n const [internalUser, setInternalUser] = useState<FeatureFlareUserPayload>(props.initialUser);\n const user = props.user ?? internalUser;\n const setUser = props.onUserChange ?? setInternalUser;\n\n const client = useMemo(() => {\n return new FeatureFlareClient({\n apiBaseUrl: props.config.apiBaseUrl,\n sdkKey: props.config.sdkKey,\n projectKey: props.config.projectKey,\n envKey: props.config.envKey\n });\n }, [\n props.config.apiBaseUrl,\n props.config.envKey,\n props.config.projectKey,\n props.config.sdkKey\n ]);\n\n const value = useMemo(() => ({ client, user, setUser }), [client, user]);\n return <FeatureFlareContext.Provider value={value}>{props.children}</FeatureFlareContext.Provider>;\n}\n\nexport function useFeatureFlareContext(): FeatureFlareContextValue {\n const ctx = React.useContext(FeatureFlareContext);\n if (!ctx) throw new Error('useFeatureFlareContext must be used within <FeatureFlareProvider>.');\n return ctx;\n}\n","import { useEffect, useMemo, useRef, useState } from 'react';\nimport type { FeatureFlareUserPayload } from '@featureflare/sdk-js';\nimport { useFeatureFlareContext } from './provider.js';\n\ntype BoolFlagState = {\n value: boolean;\n loading: boolean;\n error: string | null;\n};\n\ntype BoolFlagsState = {\n values: Record<string, boolean>;\n loading: boolean;\n errors: Record<string, string>;\n};\n\nexport function useFeatureFlareUser(): [FeatureFlareUserPayload, (next: FeatureFlareUserPayload) => void] {\n const { user, setUser } = useFeatureFlareContext();\n return [user, setUser];\n}\n\nexport function useBoolFlag(flagKey: string, defaultValue = false): BoolFlagState {\n const { client, user } = useFeatureFlareContext();\n const [state, setState] = useState<BoolFlagState>({ value: defaultValue, loading: true, error: null });\n const userId = user.id ?? user.key ?? '';\n const key = useMemo(() => `${flagKey}:${userId}`, [flagKey, userId]);\n const lastKey = useRef<string>('');\n\n useEffect(() => {\n let cancelled = false;\n const nextKey = key;\n lastKey.current = nextKey;\n setState((s) => ({ ...s, loading: true, error: null }));\n\n (async () => {\n try {\n const v = await client.bool(flagKey, user, defaultValue);\n if (cancelled) return;\n if (lastKey.current !== nextKey) return;\n setState({ value: v, loading: false, error: null });\n } catch (e) {\n if (cancelled) return;\n if (lastKey.current !== nextKey) return;\n const msg = e instanceof Error ? e.message : String(e);\n setState({ value: defaultValue, loading: false, error: msg });\n }\n })();\n\n return () => {\n cancelled = true;\n };\n }, [client, defaultValue, flagKey, key, user]);\n\n return state;\n}\n\nexport function useBoolFlags(flagKeys: string[], defaultValue = false): BoolFlagsState {\n const { client, user } = useFeatureFlareContext();\n const sortedKeys = useMemo(() => [...flagKeys].map((k) => k.trim()).filter(Boolean).sort(), [flagKeys]);\n const userId = user.id ?? user.key ?? '';\n const key = useMemo(() => `${sortedKeys.join(',')}:${userId}`, [sortedKeys, userId]);\n const [state, setState] = useState<BoolFlagsState>({ values: {}, loading: true, errors: {} });\n const lastKey = useRef<string>('');\n\n useEffect(() => {\n let cancelled = false;\n const nextKey = key;\n lastKey.current = nextKey;\n setState({ values: {}, loading: true, errors: {} });\n\n (async () => {\n const values: Record<string, boolean> = {};\n const errors: Record<string, string> = {};\n await Promise.all(\n sortedKeys.map(async (flagKey) => {\n try {\n values[flagKey] = await client.bool(flagKey, user, defaultValue);\n } catch (e) {\n values[flagKey] = defaultValue;\n errors[flagKey] = e instanceof Error ? e.message : String(e);\n }\n })\n );\n\n if (cancelled) return;\n if (lastKey.current !== nextKey) return;\n setState({ values, loading: false, errors });\n })();\n\n return () => {\n cancelled = true;\n };\n }, [client, defaultValue, key, sortedKeys, user]);\n\n return state;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAwD;AACxD,oBAAiE;AAkDxD;AAhCT,IAAM,0BAAsB,4BAA+C,IAAI;AAExE,SAAS,qBAAqB,OAMlC;AACD,MAAI,MAAM,QAAQ,CAAC,MAAM,cAAc;AACrC,UAAM,IAAI,MAAM,6FAA6F;AAAA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M,UAAU;AAChB,YAAQ,UAAU;AAClB,aAAS,EAAE,QAAQ,CAAC,GAAG,SAAS,MAAM,QAAQ,CAAC,EAAE,CAAC;AAElD,KAAC,YAAY;AACX,YAAM,SAAkC,CAAC;AACzC,YAAM,SAAiC,CAAC;AACxC,YAAM,QAAQ;AAAA,QACZ,WAAW,IAAI,OAAO,YAAY;AAChC,cAAI;AACF,mBAAO,OAAO,IAAI,MAAM,OAAO,KAAK,SAAS,MAAM,YAAY;AAAA,UACjE,SAAS,GAAG;AACV,mBAAO,OAAO,IAAI;AAClB,mBAAO,OAAO,IAAI,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AAAA,UAC7D;AAAA,QACF,CAAC;AAAA,MACH;AAEA,UAAI,UAAW;AACf,UAAI,QAAQ,YAAY,QAAS;AACjC,eAAS,EAAE,QAAQ,SAAS,OAAO,OAAO,CAAC;AAAA,IAC7C,GAAG;AAEH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,KAAK,YAAY,IAAI,CAAC;AAEhD,SAAO;AACT;","names":["React","import_react"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { FeatureFlareUserPayload, FeatureFlareClient } from '@featureflare/sdk-js';
|
|
4
|
+
export { FeatureFlareUserPayload } from '@featureflare/sdk-js';
|
|
5
5
|
|
|
6
|
-
type
|
|
6
|
+
type FeatureFlareReactConfig = {
|
|
7
|
+
/** Optional: explicit FeatureFlare API base URL. */
|
|
8
|
+
apiBaseUrl?: string;
|
|
7
9
|
/** Recommended: use a client key (featureflare_cli_...). */
|
|
8
10
|
sdkKey?: string;
|
|
9
11
|
/** Legacy/insecure browser mode: uses /api/v1/eval (no sdkKey). */
|
|
10
12
|
projectKey?: string;
|
|
11
13
|
envKey?: string;
|
|
12
14
|
};
|
|
13
|
-
type
|
|
14
|
-
client:
|
|
15
|
-
user:
|
|
16
|
-
setUser: (next:
|
|
15
|
+
type FeatureFlareContextValue = {
|
|
16
|
+
client: FeatureFlareClient;
|
|
17
|
+
user: FeatureFlareUserPayload;
|
|
18
|
+
setUser: (next: FeatureFlareUserPayload) => void;
|
|
17
19
|
};
|
|
18
|
-
declare function
|
|
19
|
-
config:
|
|
20
|
-
initialUser:
|
|
21
|
-
user?:
|
|
22
|
-
onUserChange?: (next:
|
|
20
|
+
declare function FeatureFlareProvider(props: {
|
|
21
|
+
config: FeatureFlareReactConfig;
|
|
22
|
+
initialUser: FeatureFlareUserPayload;
|
|
23
|
+
user?: FeatureFlareUserPayload;
|
|
24
|
+
onUserChange?: (next: FeatureFlareUserPayload) => void;
|
|
23
25
|
children: React.ReactNode;
|
|
24
26
|
}): react_jsx_runtime.JSX.Element;
|
|
25
|
-
declare function
|
|
27
|
+
declare function useFeatureFlareContext(): FeatureFlareContextValue;
|
|
26
28
|
|
|
27
29
|
type BoolFlagState = {
|
|
28
30
|
value: boolean;
|
|
@@ -34,8 +36,8 @@ type BoolFlagsState = {
|
|
|
34
36
|
loading: boolean;
|
|
35
37
|
errors: Record<string, string>;
|
|
36
38
|
};
|
|
37
|
-
declare function
|
|
39
|
+
declare function useFeatureFlareUser(): [FeatureFlareUserPayload, (next: FeatureFlareUserPayload) => void];
|
|
38
40
|
declare function useBoolFlag(flagKey: string, defaultValue?: boolean): BoolFlagState;
|
|
39
41
|
declare function useBoolFlags(flagKeys: string[], defaultValue?: boolean): BoolFlagsState;
|
|
40
42
|
|
|
41
|
-
export {
|
|
43
|
+
export { FeatureFlareProvider, useBoolFlag, useBoolFlags, useFeatureFlareContext, useFeatureFlareUser };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { FeatureFlareUserPayload, FeatureFlareClient } from '@featureflare/sdk-js';
|
|
4
|
+
export { FeatureFlareUserPayload } from '@featureflare/sdk-js';
|
|
5
5
|
|
|
6
|
-
type
|
|
6
|
+
type FeatureFlareReactConfig = {
|
|
7
|
+
/** Optional: explicit FeatureFlare API base URL. */
|
|
8
|
+
apiBaseUrl?: string;
|
|
7
9
|
/** Recommended: use a client key (featureflare_cli_...). */
|
|
8
10
|
sdkKey?: string;
|
|
9
11
|
/** Legacy/insecure browser mode: uses /api/v1/eval (no sdkKey). */
|
|
10
12
|
projectKey?: string;
|
|
11
13
|
envKey?: string;
|
|
12
14
|
};
|
|
13
|
-
type
|
|
14
|
-
client:
|
|
15
|
-
user:
|
|
16
|
-
setUser: (next:
|
|
15
|
+
type FeatureFlareContextValue = {
|
|
16
|
+
client: FeatureFlareClient;
|
|
17
|
+
user: FeatureFlareUserPayload;
|
|
18
|
+
setUser: (next: FeatureFlareUserPayload) => void;
|
|
17
19
|
};
|
|
18
|
-
declare function
|
|
19
|
-
config:
|
|
20
|
-
initialUser:
|
|
21
|
-
user?:
|
|
22
|
-
onUserChange?: (next:
|
|
20
|
+
declare function FeatureFlareProvider(props: {
|
|
21
|
+
config: FeatureFlareReactConfig;
|
|
22
|
+
initialUser: FeatureFlareUserPayload;
|
|
23
|
+
user?: FeatureFlareUserPayload;
|
|
24
|
+
onUserChange?: (next: FeatureFlareUserPayload) => void;
|
|
23
25
|
children: React.ReactNode;
|
|
24
26
|
}): react_jsx_runtime.JSX.Element;
|
|
25
|
-
declare function
|
|
27
|
+
declare function useFeatureFlareContext(): FeatureFlareContextValue;
|
|
26
28
|
|
|
27
29
|
type BoolFlagState = {
|
|
28
30
|
value: boolean;
|
|
@@ -34,8 +36,8 @@ type BoolFlagsState = {
|
|
|
34
36
|
loading: boolean;
|
|
35
37
|
errors: Record<string, string>;
|
|
36
38
|
};
|
|
37
|
-
declare function
|
|
39
|
+
declare function useFeatureFlareUser(): [FeatureFlareUserPayload, (next: FeatureFlareUserPayload) => void];
|
|
38
40
|
declare function useBoolFlag(flagKey: string, defaultValue?: boolean): BoolFlagState;
|
|
39
41
|
declare function useBoolFlags(flagKeys: string[], defaultValue?: boolean): BoolFlagsState;
|
|
40
42
|
|
|
41
|
-
export {
|
|
43
|
+
export { FeatureFlareProvider, useBoolFlag, useBoolFlags, useFeatureFlareContext, useFeatureFlareUser };
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,45 @@
|
|
|
1
1
|
// src/provider.tsx
|
|
2
2
|
import React, { createContext, useMemo, useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { FeatureFlareClient } from "@featureflare/sdk-js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
6
|
-
function
|
|
5
|
+
var FeatureFlareContext = createContext(null);
|
|
6
|
+
function FeatureFlareProvider(props) {
|
|
7
7
|
if (props.user && !props.onUserChange) {
|
|
8
|
-
throw new Error("
|
|
8
|
+
throw new Error("FeatureFlareProvider: when providing `user`, also provide `onUserChange` (controlled mode).");
|
|
9
9
|
}
|
|
10
10
|
const [internalUser, setInternalUser] = useState(props.initialUser);
|
|
11
11
|
const user = props.user ?? internalUser;
|
|
12
12
|
const setUser = props.onUserChange ?? setInternalUser;
|
|
13
13
|
const client = useMemo(() => {
|
|
14
|
-
return new
|
|
14
|
+
return new FeatureFlareClient({
|
|
15
|
+
apiBaseUrl: props.config.apiBaseUrl,
|
|
15
16
|
sdkKey: props.config.sdkKey,
|
|
16
17
|
projectKey: props.config.projectKey,
|
|
17
18
|
envKey: props.config.envKey
|
|
18
19
|
});
|
|
19
|
-
}, [
|
|
20
|
+
}, [
|
|
21
|
+
props.config.apiBaseUrl,
|
|
22
|
+
props.config.envKey,
|
|
23
|
+
props.config.projectKey,
|
|
24
|
+
props.config.sdkKey
|
|
25
|
+
]);
|
|
20
26
|
const value = useMemo(() => ({ client, user, setUser }), [client, user]);
|
|
21
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
+
return /* @__PURE__ */ jsx(FeatureFlareContext.Provider, { value, children: props.children });
|
|
22
28
|
}
|
|
23
|
-
function
|
|
24
|
-
const ctx = React.useContext(
|
|
25
|
-
if (!ctx) throw new Error("
|
|
29
|
+
function useFeatureFlareContext() {
|
|
30
|
+
const ctx = React.useContext(FeatureFlareContext);
|
|
31
|
+
if (!ctx) throw new Error("useFeatureFlareContext must be used within <FeatureFlareProvider>.");
|
|
26
32
|
return ctx;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
// src/hooks.ts
|
|
30
36
|
import { useEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
|
|
31
|
-
function
|
|
32
|
-
const { user, setUser } =
|
|
37
|
+
function useFeatureFlareUser() {
|
|
38
|
+
const { user, setUser } = useFeatureFlareContext();
|
|
33
39
|
return [user, setUser];
|
|
34
40
|
}
|
|
35
41
|
function useBoolFlag(flagKey, defaultValue = false) {
|
|
36
|
-
const { client, user } =
|
|
42
|
+
const { client, user } = useFeatureFlareContext();
|
|
37
43
|
const [state, setState] = useState2({ value: defaultValue, loading: true, error: null });
|
|
38
44
|
const userId = user.id ?? user.key ?? "";
|
|
39
45
|
const key = useMemo2(() => `${flagKey}:${userId}`, [flagKey, userId]);
|
|
@@ -63,7 +69,7 @@ function useBoolFlag(flagKey, defaultValue = false) {
|
|
|
63
69
|
return state;
|
|
64
70
|
}
|
|
65
71
|
function useBoolFlags(flagKeys, defaultValue = false) {
|
|
66
|
-
const { client, user } =
|
|
72
|
+
const { client, user } = useFeatureFlareContext();
|
|
67
73
|
const sortedKeys = useMemo2(() => [...flagKeys].map((k) => k.trim()).filter(Boolean).sort(), [flagKeys]);
|
|
68
74
|
const userId = user.id ?? user.key ?? "";
|
|
69
75
|
const key = useMemo2(() => `${sortedKeys.join(",")}:${userId}`, [sortedKeys, userId]);
|
|
@@ -98,10 +104,10 @@ function useBoolFlags(flagKeys, defaultValue = false) {
|
|
|
98
104
|
return state;
|
|
99
105
|
}
|
|
100
106
|
export {
|
|
101
|
-
|
|
107
|
+
FeatureFlareProvider,
|
|
102
108
|
useBoolFlag,
|
|
103
109
|
useBoolFlags,
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
useFeatureFlareContext,
|
|
111
|
+
useFeatureFlareUser
|
|
106
112
|
};
|
|
107
113
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.tsx","../src/hooks.ts"],"sourcesContent":["import React, { createContext, useMemo, useState } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/provider.tsx","../src/hooks.ts"],"sourcesContent":["import React, { createContext, useMemo, useState } from 'react';\nimport { FeatureFlareClient, type FeatureFlareUserPayload } from '@featureflare/sdk-js';\n\ntype FeatureFlareReactConfig = {\n /** Optional: explicit FeatureFlare API base URL. */\n apiBaseUrl?: string;\n /** Recommended: use a client key (featureflare_cli_...). */\n sdkKey?: string;\n /** Legacy/insecure browser mode: uses /api/v1/eval (no sdkKey). */\n projectKey?: string;\n envKey?: string;\n};\n\ntype FeatureFlareContextValue = {\n client: FeatureFlareClient;\n user: FeatureFlareUserPayload;\n setUser: (next: FeatureFlareUserPayload) => void;\n};\n\nconst FeatureFlareContext = createContext<FeatureFlareContextValue | null>(null);\n\nexport function FeatureFlareProvider(props: {\n config: FeatureFlareReactConfig;\n initialUser: FeatureFlareUserPayload;\n user?: FeatureFlareUserPayload;\n onUserChange?: (next: FeatureFlareUserPayload) => void;\n children: React.ReactNode;\n}) {\n if (props.user && !props.onUserChange) {\n throw new Error('FeatureFlareProvider: when providing `user`, also provide `onUserChange` (controlled mode).');\n }\n\n const [internalUser, setInternalUser] = useState<FeatureFlareUserPayload>(props.initialUser);\n const user = props.user ?? internalUser;\n const setUser = props.onUserChange ?? setInternalUser;\n\n const client = useMemo(() => {\n return new FeatureFlareClient({\n apiBaseUrl: props.config.apiBaseUrl,\n sdkKey: props.config.sdkKey,\n projectKey: props.config.projectKey,\n envKey: props.config.envKey\n });\n }, [\n props.config.apiBaseUrl,\n props.config.envKey,\n props.config.projectKey,\n props.config.sdkKey\n ]);\n\n const value = useMemo(() => ({ client, user, setUser }), [client, user]);\n return <FeatureFlareContext.Provider value={value}>{props.children}</FeatureFlareContext.Provider>;\n}\n\nexport function useFeatureFlareContext(): FeatureFlareContextValue {\n const ctx = React.useContext(FeatureFlareContext);\n if (!ctx) throw new Error('useFeatureFlareContext must be used within <FeatureFlareProvider>.');\n return ctx;\n}\n","import { useEffect, useMemo, useRef, useState } from 'react';\nimport type { FeatureFlareUserPayload } from '@featureflare/sdk-js';\nimport { useFeatureFlareContext } from './provider.js';\n\ntype BoolFlagState = {\n value: boolean;\n loading: boolean;\n error: string | null;\n};\n\ntype BoolFlagsState = {\n values: Record<string, boolean>;\n loading: boolean;\n errors: Record<string, string>;\n};\n\nexport function useFeatureFlareUser(): [FeatureFlareUserPayload, (next: FeatureFlareUserPayload) => void] {\n const { user, setUser } = useFeatureFlareContext();\n return [user, setUser];\n}\n\nexport function useBoolFlag(flagKey: string, defaultValue = false): BoolFlagState {\n const { client, user } = useFeatureFlareContext();\n const [state, setState] = useState<BoolFlagState>({ value: defaultValue, loading: true, error: null });\n const userId = user.id ?? user.key ?? '';\n const key = useMemo(() => `${flagKey}:${userId}`, [flagKey, userId]);\n const lastKey = useRef<string>('');\n\n useEffect(() => {\n let cancelled = false;\n const nextKey = key;\n lastKey.current = nextKey;\n setState((s) => ({ ...s, loading: true, error: null }));\n\n (async () => {\n try {\n const v = await client.bool(flagKey, user, defaultValue);\n if (cancelled) return;\n if (lastKey.current !== nextKey) return;\n setState({ value: v, loading: false, error: null });\n } catch (e) {\n if (cancelled) return;\n if (lastKey.current !== nextKey) return;\n const msg = e instanceof Error ? e.message : String(e);\n setState({ value: defaultValue, loading: false, error: msg });\n }\n })();\n\n return () => {\n cancelled = true;\n };\n }, [client, defaultValue, flagKey, key, user]);\n\n return state;\n}\n\nexport function useBoolFlags(flagKeys: string[], defaultValue = false): BoolFlagsState {\n const { client, user } = useFeatureFlareContext();\n const sortedKeys = useMemo(() => [...flagKeys].map((k) => k.trim()).filter(Boolean).sort(), [flagKeys]);\n const userId = user.id ?? user.key ?? '';\n const key = useMemo(() => `${sortedKeys.join(',')}:${userId}`, [sortedKeys, userId]);\n const [state, setState] = useState<BoolFlagsState>({ values: {}, loading: true, errors: {} });\n const lastKey = useRef<string>('');\n\n useEffect(() => {\n let cancelled = false;\n const nextKey = key;\n lastKey.current = nextKey;\n setState({ values: {}, loading: true, errors: {} });\n\n (async () => {\n const values: Record<string, boolean> = {};\n const errors: Record<string, string> = {};\n await Promise.all(\n sortedKeys.map(async (flagKey) => {\n try {\n values[flagKey] = await client.bool(flagKey, user, defaultValue);\n } catch (e) {\n values[flagKey] = defaultValue;\n errors[flagKey] = e instanceof Error ? e.message : String(e);\n }\n })\n );\n\n if (cancelled) return;\n if (lastKey.current !== nextKey) return;\n setState({ values, loading: false, errors });\n })();\n\n return () => {\n cancelled = true;\n };\n }, [client, defaultValue, key, sortedKeys, user]);\n\n return state;\n}\n"],"mappings":";AAAA,OAAO,SAAS,eAAe,SAAS,gBAAgB;AACxD,SAAS,0BAAwD;AAkDxD;AAhCT,IAAM,sBAAsB,cAA+C,IAAI;AAExE,SAAS,qBAAqB,OAMlC;AACD,MAAI,MAAM,QAAQ,CAAC,MAAM,cAAc;AACrC,UAAM,IAAI,MAAM,6FAA6F;AAAA,EAC/G;AAEA,QAAM,CAAC,cAAc,eAAe,IAAI,SAAkC,MAAM,WAAW;AAC3F,QAAM,OAAO,MAAM,QAAQ;AAC3B,QAAM,UAAU,MAAM,gBAAgB;AAEtC,QAAM,SAAS,QAAQ,MAAM;AAC3B,WAAO,IAAI,mBAAmB;AAAA,MAC5B,YAAY,MAAM,OAAO;AAAA,MACzB,QAAQ,MAAM,OAAO;AAAA,MACrB,YAAY,MAAM,OAAO;AAAA,MACzB,QAAQ,MAAM,OAA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AAAA,UACjE,SAAS,GAAG;AACV,mBAAO,OAAO,IAAI;AAClB,mBAAO,OAAO,IAAI,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AAAA,UAC7D;AAAA,QACF,CAAC;AAAA,MACH;AAEA,UAAI,UAAW;AACf,UAAI,QAAQ,YAAY,QAAS;AACjC,eAAS,EAAE,QAAQ,SAAS,OAAO,OAAO,CAAC;AAAA,IAC7C,GAAG;AAEH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,KAAK,YAAY,IAAI,CAAC;AAEhD,SAAO;AACT;","names":["useMemo","useState","useState","useMemo"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featureflare/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"react-dom": ">=18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@featureflare/sdk-js": "0.0.
|
|
36
|
+
"@featureflare/sdk-js": "0.0.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^22.10.2",
|