Skip to content

Commit 0659716

Browse files
Junaed/fssdk 12294 - useOptimizelyUserContext, useOptimizelyClient, useDecide(#321)
1 parent ed5275f commit 0659716

19 files changed

Lines changed: 1147 additions & 25 deletions

package-lock.json

Lines changed: 21 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
},
4646
"dependencies": {
4747
"@optimizely/optimizely-sdk": "^6.3.0",
48-
"hoist-non-react-statics": "^3.3.2",
49-
"tslib": "^2.8.1"
48+
"tslib": "^2.8.1",
49+
"use-sync-external-store": "^1.6.0"
5050
},
5151
"peerDependencies": {
5252
"react": ">=16.8.0"
@@ -60,6 +60,7 @@
6060
"@types/jest": "^30.0.0",
6161
"@types/react": "^18.3.0",
6262
"@types/react-dom": "^18.3.0",
63+
"@types/use-sync-external-store": "^1.5.0",
6364
"@typescript-eslint/eslint-plugin": "^8.0.0",
6465
"@typescript-eslint/parser": "^8.0.0",
6566
"@vitest/coverage-v8": "^4.0.18",

rollup.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import terser from '@rollup/plugin-terser';
1919
import pkg from './package.json' with { type: 'json' };
2020

2121
const { dependencies, peerDependencies } = pkg;
22-
const external = [...Object.keys(dependencies || {}), ...Object.keys(peerDependencies || {}), 'crypto'];
22+
const externalDeps = [...Object.keys(dependencies || {}), ...Object.keys(peerDependencies || {}), 'crypto'];
23+
const external = (id) => externalDeps.some((dep) => id === dep || id.startsWith(dep + '/'));
2324

2425
export default {
2526
input: '.build/index.js',

src/hooks/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright 2026, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
export { useOptimizelyClient } from './useOptimizelyClient';
18+
export { useOptimizelyUserContext } from './useOptimizelyUserContext';
19+
export type { UseOptimizelyUserContextResult } from './useOptimizelyUserContext';
20+
export { useDecide } from './useDecide';
21+
export type { UseDecideConfig, UseDecideResult } from './useDecide';

0 commit comments

Comments
 (0)