@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 CHANGED
@@ -1,11 +1,11 @@
1
- # @deploysentry/react
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 @deploysentry/react
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 '@deploysentry/react';
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 '@deploysentry/react';
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 '@deploysentry/react';
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 '@deploysentry/react';
217
+ } from '@dr-sentry/react';
218
218
  ```
219
219
 
220
220
  ## Authentication
@@ -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 @deploysentry/sdk.
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 @deploysentry/sdk.
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
@@ -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
  /**
@@ -1,4 +1,4 @@
1
- import { evaluateLocal } from './local-evaluator';
1
+ import { evaluateLocal } from './local-evaluator.js';
2
2
  /**
3
3
  * Normalise a raw API response into the public {@link Flag} shape.
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { DeploySentryClient } from './client';
1
+ import type { DeploySentryClient } from './client.js';
2
2
  /**
3
3
  * React context that holds the DeploySentry client instance.
4
4
  *
@@ -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
  // ---------------------------------------------------------------------------
@@ -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
@@ -1,4 +1,4 @@
1
- import type { EvaluationContext, FlagConfig } from './types';
1
+ import type { EvaluationContext, FlagConfig } from './types.js';
2
2
  /**
3
3
  * Evaluate a flag locally using pre-loaded config data.
4
4
  *
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { ProviderProps } from './types';
2
+ import type { ProviderProps } from './types.js';
3
3
  /**
4
4
  * Provides the DeploySentry client to all descendant components.
5
5
  *
@@ -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
  *
@@ -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 @deploysentry/sdk.
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 @deploysentry/sdk.
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.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/",