@unleash/proxy-client-react
Advanced tools
Comparing version 4.0.2-alpha.0 to 4.0.2-rc.0
/** @format */ | ||
export type { IConfig, IContext, IMutableContext, IVariant, IToggle, } from 'unleash-proxy-client'; | ||
export { UnleashClient, IStorageProvider, LocalStorageProvider, InMemoryStorageProvider, } from 'unleash-proxy-client'; | ||
export { UnleashClient, type IStorageProvider, LocalStorageProvider, InMemoryStorageProvider, } from 'unleash-proxy-client'; | ||
import FlagContext from './FlagContext'; | ||
@@ -5,0 +5,0 @@ import FlagProvider from './FlagProvider'; |
import { UnleashClient as H } from "unleash-proxy-client"; | ||
import { IStorageProvider as Y, InMemoryStorageProvider as j, LocalStorageProvider as D, UnleashClient as G } from "unleash-proxy-client"; | ||
import { InMemoryStorageProvider as Y, LocalStorageProvider as j, UnleashClient as D } from "unleash-proxy-client"; | ||
import * as d from "react"; | ||
import P, { useContext as i, useState as y, useRef as E, useEffect as b } from "react"; | ||
const f = P.createContext(null), U = { | ||
import U, { useContext as i, useState as y, useRef as E, useEffect as b } from "react"; | ||
const f = U.createContext(null), A = { | ||
bootstrap: [], | ||
@@ -12,3 +12,3 @@ disableRefresh: !0, | ||
clientKey: "not-used" | ||
}, M = ({ | ||
}, q = ({ | ||
config: e, | ||
@@ -19,7 +19,7 @@ children: r, | ||
}) => { | ||
const a = e || U, t = d.useRef( | ||
const a = e || A, t = d.useRef( | ||
n || new H(a) | ||
), [c, u] = d.useState( | ||
!!(n ? e != null && e.bootstrap && (e == null ? void 0 : e.bootstrapOverride) !== !1 : a.bootstrap && a.bootstrapOverride !== !1) | ||
), [o, v] = d.useState(null); | ||
), [o, h] = d.useState(null); | ||
d.useEffect(() => { | ||
@@ -31,5 +31,5 @@ !a && !n && console.error( | ||
); | ||
const l = (h) => { | ||
const l = (v) => { | ||
d.startTransition(() => { | ||
v((T) => T || h); | ||
h((T) => T || v); | ||
}); | ||
@@ -61,3 +61,3 @@ }; | ||
setFlagsReady: u, | ||
setFlagsError: v | ||
setFlagsError: h | ||
}), | ||
@@ -67,3 +67,3 @@ [c, o] | ||
return /* @__PURE__ */ d.createElement(f.Provider, { value: m }, r); | ||
}, q = (e) => { | ||
}, I = (e) => { | ||
const { isEnabled: r, client: n } = i(f), [s, a] = y(!!r(e)), t = E(); | ||
@@ -97,3 +97,3 @@ return t.current = s, b(() => { | ||
return { flagsReady: e, flagsError: r }; | ||
}, A = (e, r) => { | ||
}, P = (e, r) => { | ||
var s, a, t, c; | ||
@@ -111,3 +111,3 @@ return !(e.name === (r == null ? void 0 : r.name) && e.enabled === (r == null ? void 0 : r.enabled) && ((s = e.payload) == null ? void 0 : s.type) === ((a = r == null ? void 0 : r.payload) == null ? void 0 : a.type) && ((t = e.payload) == null ? void 0 : t.value) === ((c = r == null ? void 0 : r.payload) == null ? void 0 : c.value)); | ||
const o = r(e); | ||
A(t.current, o) && (a(o), t.current = o); | ||
P(t.current, o) && (a(o), t.current = o); | ||
}, u = () => { | ||
@@ -130,9 +130,8 @@ const o = r(e); | ||
f as FlagContext, | ||
M as FlagProvider, | ||
Y as IStorageProvider, | ||
j as InMemoryStorageProvider, | ||
D as LocalStorageProvider, | ||
G as UnleashClient, | ||
M as default, | ||
q as useFlag, | ||
q as FlagProvider, | ||
Y as InMemoryStorageProvider, | ||
j as LocalStorageProvider, | ||
D as UnleashClient, | ||
q as default, | ||
I as useFlag, | ||
O as useFlags, | ||
@@ -139,0 +138,0 @@ _ as useFlagsStatus, |
{ | ||
"name": "@unleash/proxy-client-react", | ||
"version": "4.0.2-alpha.0", | ||
"version": "4.0.2-rc.0", | ||
"description": "React interface for working with unleash", | ||
@@ -49,3 +49,3 @@ "type": "module", | ||
"typescript": "^5.2.2", | ||
"unleash-proxy-client": "3.0.0-beta.2", | ||
"unleash-proxy-client": "^3.0.0", | ||
"vite": "^4.4.11", | ||
@@ -56,4 +56,4 @@ "vite-plugin-dts": "^3.6.0", | ||
"peerDependencies": { | ||
"unleash-proxy-client": "3.0.0-beta.2" | ||
"unleash-proxy-client": "^3.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
59333
213