@unleash/proxy-client-react
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -1,6 +0,6 @@ | ||
import { UnleashClient as H } from "unleash-proxy-client"; | ||
import { InMemoryStorageProvider as Y, LocalStorageProvider as j, UnleashClient as D } from "unleash-proxy-client"; | ||
import { UnleashClient as U } from "unleash-proxy-client"; | ||
import { InMemoryStorageProvider as D, LocalStorageProvider as G, UnleashClient as J } from "unleash-proxy-client"; | ||
import * as d from "react"; | ||
import U, { useContext as i, useState as b, useRef as E, useEffect as y } from "react"; | ||
const f = U.createContext(null), A = { | ||
import _, { useContext as i, useState as b, useRef as x, useEffect as y } from "react"; | ||
const f = _.createContext(null), A = { | ||
bootstrap: [], | ||
@@ -12,3 +12,3 @@ disableRefresh: !0, | ||
clientKey: "not-used" | ||
}, M = ({ | ||
}, P = "startTransition", E = d[P] || ((e) => e()), I = ({ | ||
config: e, | ||
@@ -20,3 +20,3 @@ children: t, | ||
const a = e || A, r = d.useRef( | ||
o || new H(a) | ||
o || new U(a) | ||
), [c, u] = d.useState( | ||
@@ -32,4 +32,4 @@ !!(o ? e != null && e.bootstrap && (e == null ? void 0 : e.bootstrapOverride) !== !1 : a.bootstrap && a.bootstrapOverride !== !1) | ||
const l = (v) => { | ||
d.startTransition(() => { | ||
h((T) => T || v); | ||
E(() => { | ||
h((H) => H || v); | ||
}); | ||
@@ -40,3 +40,3 @@ }; | ||
p = setTimeout(() => { | ||
d.startTransition(() => { | ||
E(() => { | ||
u(!0); | ||
@@ -50,10 +50,10 @@ }); | ||
}, []); | ||
const x = async (l) => { | ||
const R = async (l) => { | ||
await r.current.updateContext(l); | ||
}, R = (l) => r.current.isEnabled(l), F = (l) => r.current.getVariant(l), S = (l, p, g) => r.current.on(l, p, g), m = d.useMemo( | ||
}, F = (l) => r.current.isEnabled(l), S = (l) => r.current.getVariant(l), m = (l, p, g) => r.current.on(l, p, g), T = d.useMemo( | ||
() => ({ | ||
on: S, | ||
updateContext: x, | ||
isEnabled: R, | ||
getVariant: F, | ||
on: m, | ||
updateContext: R, | ||
isEnabled: F, | ||
getVariant: S, | ||
client: r.current, | ||
@@ -67,5 +67,5 @@ flagsReady: c, | ||
); | ||
return /* @__PURE__ */ d.createElement(f.Provider, { value: m }, t); | ||
}, q = (e) => { | ||
const { isEnabled: t, client: o } = i(f), [s, a] = b(!!t(e)), r = E(); | ||
return /* @__PURE__ */ d.createElement(f.Provider, { value: T }, t); | ||
}, O = (e) => { | ||
const { isEnabled: t, client: o } = i(f), [s, a] = b(!!t(e)), r = x(); | ||
return r.current = s, y(() => { | ||
@@ -85,3 +85,3 @@ if (!o) | ||
}, [o]), s; | ||
}, I = () => { | ||
}, z = () => { | ||
const { client: e } = i(f), [t, o] = b(e.getAllToggles()); | ||
@@ -96,10 +96,10 @@ return y(() => { | ||
}, []), t; | ||
}, O = () => { | ||
}, B = () => { | ||
const { flagsReady: e, flagsError: t } = i(f); | ||
return { flagsReady: e, flagsError: t }; | ||
}, P = (e, t) => { | ||
}, k = (e, t) => { | ||
var s, a, r, c; | ||
return !(e.name === (t == null ? void 0 : t.name) && e.enabled === (t == null ? void 0 : t.enabled) && e.feature_enabled === (t == null ? void 0 : t.feature_enabled) && ((s = e.payload) == null ? void 0 : s.type) === ((a = t == null ? void 0 : t.payload) == null ? void 0 : a.type) && ((r = e.payload) == null ? void 0 : r.value) === ((c = t == null ? void 0 : t.payload) == null ? void 0 : c.value)); | ||
}, z = (e) => { | ||
const { getVariant: t, client: o } = i(f), [s, a] = b(t(e)), r = E({ | ||
}, K = (e) => { | ||
const { getVariant: t, client: o } = i(f), [s, a] = b(t(e)), r = x({ | ||
name: s.name, | ||
@@ -113,3 +113,3 @@ enabled: s.enabled | ||
const n = t(e); | ||
P(r.current, n) && (a(n), r.current = n); | ||
k(r.current, n) && (a(n), r.current = n); | ||
}, u = () => { | ||
@@ -123,6 +123,6 @@ const n = t(e); | ||
}, [o]), s || {}; | ||
}, B = () => { | ||
}, L = () => { | ||
const { updateContext: e } = i(f); | ||
return e; | ||
}, K = () => { | ||
}, N = () => { | ||
const { client: e } = i(f); | ||
@@ -133,14 +133,14 @@ return e; | ||
f as FlagContext, | ||
M as FlagProvider, | ||
Y as InMemoryStorageProvider, | ||
j as LocalStorageProvider, | ||
D as UnleashClient, | ||
M as default, | ||
q as useFlag, | ||
I as useFlags, | ||
O as useFlagsStatus, | ||
K as useUnleashClient, | ||
B as useUnleashContext, | ||
z as useVariant | ||
I as FlagProvider, | ||
D as InMemoryStorageProvider, | ||
G as LocalStorageProvider, | ||
J as UnleashClient, | ||
I as default, | ||
O as useFlag, | ||
z as useFlags, | ||
B as useFlagsStatus, | ||
N as useUnleashClient, | ||
L as useUnleashContext, | ||
K as useVariant | ||
}; | ||
//# sourceMappingURL=unleash-react.js.map |
{ | ||
"name": "@unleash/proxy-client-react", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "React interface for working with unleash", | ||
@@ -42,17 +42,17 @@ "type": "module", | ||
"devDependencies": { | ||
"@testing-library/jest-dom": "^6.1.3", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/jest-dom": "^6.1.4", | ||
"@testing-library/react": "^14.1.2", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
"@types/react": "^18.2.27", | ||
"@types/react": "^18.2.38", | ||
"@vitest/coverage-istanbul": "^0.34.6", | ||
"happy-dom": "^12.9.1", | ||
"jsdom": "^22.1.0", | ||
"happy-dom": "^12.10.3", | ||
"jsdom": "^23.0.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-test-renderer": "^18.2.0", | ||
"typescript": "^5.2.2", | ||
"typescript": "^5.3.2", | ||
"unleash-proxy-client": "^3.2.0", | ||
"vite": "^4.4.11", | ||
"vite-plugin-dts": "^3.6.0", | ||
"vitest": "^0.32.4" | ||
"vite": "^4.5.0", | ||
"vite-plugin-dts": "^3.6.3", | ||
"vitest": "^0.34.6" | ||
}, | ||
@@ -59,0 +59,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
60425