From cf4179ef9cf5f5e65800bfa245d8a32f7adbc8bd Mon Sep 17 00:00:00 2001 From: Ben Papillon Date: Thu, 25 Jan 2024 16:00:47 -0500 Subject: [PATCH] Support apiUrl override --- react/package.json | 4 ++-- react/src/index.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/react/package.json b/react/package.json index 5868f6ad..9852728a 100644 --- a/react/package.json +++ b/react/package.json @@ -42,9 +42,9 @@ "test": "jest --config jest.config.js" }, "types": "dist/schematic-react.d.ts", - "version": "0.1.3", + "version": "0.1.4", "dependencies": { - "@schematichq/schematic-js": "^0.1.3" + "@schematichq/schematic-js": "^0.1.4" }, "peerDependencies": { "react": ">=18" diff --git a/react/src/index.tsx b/react/src/index.tsx index cc6d8078..7243d3d4 100644 --- a/react/src/index.tsx +++ b/react/src/index.tsx @@ -14,6 +14,7 @@ export interface SchematicFlags { interface SchematicProviderProps { children: ReactNode; publishableKey?: string; + apiUrl?: string; } interface SchematicContextProps { @@ -26,8 +27,9 @@ const SchematicContext = createContext({ }); const SchematicProvider: React.FC = ({ - publishableKey, + apiUrl, children, + publishableKey, }) => { const [client, setClient] = useState(); const [flagValues, setFlagValues] = useState>({}); @@ -38,6 +40,7 @@ const SchematicProvider: React.FC = ({ } const client = new SchematicJS.Schematic(publishableKey, { + apiUrl, flagListener: setFlagValues, useWebSocket: true, });