@dr-sentry/react 1.0.0 → 1.0.1
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 +6 -6
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/types.js +1 -1
- package/dist/esm/client.d.ts +1 -1
- package/dist/esm/client.js +1 -1
- package/dist/esm/context.d.ts +1 -1
- package/dist/esm/hooks.d.ts +2 -2
- package/dist/esm/hooks.js +1 -1
- package/dist/esm/index.d.ts +6 -6
- package/dist/esm/index.js +5 -5
- package/dist/esm/local-evaluator.d.ts +1 -1
- package/dist/esm/package.json +1 -0
- package/dist/esm/provider.d.ts +1 -1
- package/dist/esm/provider.js +2 -2
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @dr-sentry/react
|
|
2
2
|
|
|
3
3
|
Official React SDK for the DeploySentry feature flag platform. Provides React hooks and a context provider for evaluating feature flags with real-time SSE updates.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @dr-sentry/react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
React 18 or later is required as a peer dependency.
|
|
@@ -15,7 +15,7 @@ React 18 or later is required as a peer dependency.
|
|
|
15
15
|
Wrap your application with `DeploySentryProvider` and use hooks anywhere in the tree:
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import { DeploySentryProvider, useFlag } from '@
|
|
18
|
+
import { DeploySentryProvider, useFlag } from '@dr-sentry/react';
|
|
19
19
|
|
|
20
20
|
function App() {
|
|
21
21
|
return (
|
|
@@ -151,7 +151,7 @@ Create one registration file that runs at app initialization:
|
|
|
151
151
|
|
|
152
152
|
```typescript
|
|
153
153
|
// src/flags/registrations.ts
|
|
154
|
-
import type { DeploySentryClient } from '@
|
|
154
|
+
import type { DeploySentryClient } from '@dr-sentry/react';
|
|
155
155
|
import { legacySearch, vectorSearch } from '../search';
|
|
156
156
|
import { classicCheckout, newCheckout } from '../checkout';
|
|
157
157
|
|
|
@@ -171,7 +171,7 @@ Call `registerFlags(client)` after the client initializes (e.g. in the provider
|
|
|
171
171
|
### Usage in components
|
|
172
172
|
|
|
173
173
|
```tsx
|
|
174
|
-
import { useDispatch } from '@
|
|
174
|
+
import { useDispatch } from '@dr-sentry/react';
|
|
175
175
|
|
|
176
176
|
function SearchBar() {
|
|
177
177
|
const search = useDispatch<(query: string) => Promise<Results>>('search');
|
|
@@ -214,7 +214,7 @@ import type {
|
|
|
214
214
|
FlagMetadata,
|
|
215
215
|
ProviderProps,
|
|
216
216
|
UserContext,
|
|
217
|
-
} from '@
|
|
217
|
+
} from '@dr-sentry/react';
|
|
218
218
|
```
|
|
219
219
|
|
|
220
220
|
## Authentication
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* DeploySentry React SDK type definitions.
|
|
3
3
|
*
|
|
4
4
|
* Types are defined locally so the React SDK has zero runtime dependency on
|
|
5
|
-
* the Node SDK package. They mirror the canonical shapes from @
|
|
5
|
+
* the Node SDK package. They mirror the canonical shapes from @dr-sentry/sdk.
|
|
6
6
|
*/
|
|
7
7
|
/** Categories that classify the intent and lifecycle of a feature flag. */
|
|
8
8
|
export type FlagCategory = 'release' | 'feature' | 'experiment' | 'ops' | 'permission';
|
package/dist/cjs/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* DeploySentry React SDK type definitions.
|
|
4
4
|
*
|
|
5
5
|
* Types are defined locally so the React SDK has zero runtime dependency on
|
|
6
|
-
* the Node SDK package. They mirror the canonical shapes from @
|
|
6
|
+
* the Node SDK package. They mirror the canonical shapes from @dr-sentry/sdk.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
//# sourceMappingURL=types.js.map
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EvaluationContext, Flag, FlagConfig, FlagDetail, FlagMetadata, UserContext } from './types';
|
|
1
|
+
import type { EvaluationContext, Flag, FlagConfig, FlagDetail, FlagMetadata, UserContext } from './types.js';
|
|
2
2
|
/** Listener callback invoked whenever the flag store is updated. */
|
|
3
3
|
export type FlagChangeListener = () => void;
|
|
4
4
|
/**
|
package/dist/esm/client.js
CHANGED
package/dist/esm/context.d.ts
CHANGED
package/dist/esm/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DeploySentryClient } from './client';
|
|
2
|
-
import type { Flag, FlagCategory, FlagDetail } from './types';
|
|
1
|
+
import type { DeploySentryClient } from './client.js';
|
|
2
|
+
import type { Flag, FlagCategory, FlagDetail } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Return the raw {@link DeploySentryClient} instance.
|
|
5
5
|
*
|
package/dist/esm/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useContext, useMemo, useSyncExternalStore } from 'react';
|
|
2
|
-
import { DeploySentryContext } from './context';
|
|
2
|
+
import { DeploySentryContext } from './context.js';
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
// Helpers
|
|
5
5
|
// ---------------------------------------------------------------------------
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { DeploySentryContext } from './context';
|
|
2
|
-
export { DeploySentryProvider } from './provider';
|
|
3
|
-
export { useDeploySentry, useDispatch, useExpiredFlags, useFlag, useFlagDetail, useFlagsByCategory, } from './hooks';
|
|
4
|
-
export { DeploySentryClient } from './client';
|
|
5
|
-
export { evaluateLocal } from './local-evaluator';
|
|
6
|
-
export type { ApiFlagResponse, EvaluationContext, Flag, FlagCategory, FlagConfig, FlagConfigEnvironment, FlagConfigFlag, FlagConfigRule, FlagDetail, FlagMetadata, ProviderProps, Registration, SSEFlagUpdate, UserContext, } from './types';
|
|
1
|
+
export { DeploySentryContext } from './context.js';
|
|
2
|
+
export { DeploySentryProvider } from './provider.js';
|
|
3
|
+
export { useDeploySentry, useDispatch, useExpiredFlags, useFlag, useFlagDetail, useFlagsByCategory, } from './hooks.js';
|
|
4
|
+
export { DeploySentryClient } from './client.js';
|
|
5
|
+
export { evaluateLocal } from './local-evaluator.js';
|
|
6
|
+
export type { ApiFlagResponse, EvaluationContext, Flag, FlagCategory, FlagConfig, FlagConfigEnvironment, FlagConfigFlag, FlagConfigRule, FlagDetail, FlagMetadata, ProviderProps, Registration, SSEFlagUpdate, UserContext, } from './types.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Context & Provider
|
|
2
|
-
export { DeploySentryContext } from './context';
|
|
3
|
-
export { DeploySentryProvider } from './provider';
|
|
2
|
+
export { DeploySentryContext } from './context.js';
|
|
3
|
+
export { DeploySentryProvider } from './provider.js';
|
|
4
4
|
// Hooks
|
|
5
|
-
export { useDeploySentry, useDispatch, useExpiredFlags, useFlag, useFlagDetail, useFlagsByCategory, } from './hooks';
|
|
5
|
+
export { useDeploySentry, useDispatch, useExpiredFlags, useFlag, useFlagDetail, useFlagsByCategory, } from './hooks.js';
|
|
6
6
|
// Client (advanced usage)
|
|
7
|
-
export { DeploySentryClient } from './client';
|
|
7
|
+
export { DeploySentryClient } from './client.js';
|
|
8
8
|
// Local evaluation (file/flagData mode)
|
|
9
|
-
export { evaluateLocal } from './local-evaluator';
|
|
9
|
+
export { evaluateLocal } from './local-evaluator.js';
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/dist/esm/provider.d.ts
CHANGED
package/dist/esm/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { DeploySentryClient } from './client';
|
|
4
|
-
import { DeploySentryContext } from './context';
|
|
3
|
+
import { DeploySentryClient } from './client.js';
|
|
4
|
+
import { DeploySentryContext } from './context.js';
|
|
5
5
|
/**
|
|
6
6
|
* Provides the DeploySentry client to all descendant components.
|
|
7
7
|
*
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* DeploySentry React SDK type definitions.
|
|
3
3
|
*
|
|
4
4
|
* Types are defined locally so the React SDK has zero runtime dependency on
|
|
5
|
-
* the Node SDK package. They mirror the canonical shapes from @
|
|
5
|
+
* the Node SDK package. They mirror the canonical shapes from @dr-sentry/sdk.
|
|
6
6
|
*/
|
|
7
7
|
/** Categories that classify the intent and lifecycle of a feature flag. */
|
|
8
8
|
export type FlagCategory = 'release' | 'feature' | 'experiment' | 'ops' | 'permission';
|
package/dist/esm/types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* DeploySentry React SDK type definitions.
|
|
3
3
|
*
|
|
4
4
|
* Types are defined locally so the React SDK has zero runtime dependency on
|
|
5
|
-
* the Node SDK package. They mirror the canonical shapes from @
|
|
5
|
+
* the Node SDK package. They mirror the canonical shapes from @dr-sentry/sdk.
|
|
6
6
|
*/
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dr-sentry/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Official React SDK for the DeploySentry feature flag platform",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "npm run build:esm && npm run build:cjs && npm run build:cjs-package-json",
|
|
24
|
+
"build": "npm run build:esm && npm run build:cjs && npm run build:cjs-package-json && npm run fix-esm-imports",
|
|
25
25
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
26
|
+
"fix-esm-imports": "node -e \"const fs=require('fs'),path=require('path'),dir='dist/esm';fs.readdirSync(dir).filter(f=>f.endsWith('.js')||f.endsWith('.d.ts')).forEach(f=>{const p=path.join(dir,f);let s=fs.readFileSync(p,'utf8');s=s.replace(/(from\\s+['\\\"])(\\.\\/.+?)(?=['\\\"])/g,(m,pre,spec)=>spec.endsWith('.js')?m:pre+spec+'.js');fs.writeFileSync(p,s)})\"",
|
|
26
27
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
27
|
-
"build:cjs-package-json": "node -e \"require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type:'commonjs'}))\"",
|
|
28
|
+
"build:cjs-package-json": "node -e \"require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type:'commonjs'}));require('fs').writeFileSync('dist/esm/package.json', JSON.stringify({type:'module'}))\"",
|
|
28
29
|
"clean": "rm -rf dist",
|
|
29
30
|
"test": "jest",
|
|
30
31
|
"lint": "eslint src/",
|