@evervault/react
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -0,12 +1,37 @@ | ||
import type { CardPayload } from 'types'; | ||
import type { CardTranslations } from 'types'; | ||
import type { CustomConfig as CustomConfig_2 } from '@evervault/browser'; | ||
import type EvervaultClient from '@evervault/browser'; | ||
import type { EvervaultRequestProps } from '@evervault/browser'; | ||
import type { InputSettings } from '@evervault/browser'; | ||
import type { PinOptions } from 'types'; | ||
import type { PinPayload } from 'types'; | ||
import * as React_2 from 'react'; | ||
import { ReactNode } from 'react'; | ||
import type { RevealFormat } from 'types'; | ||
import type { RevealSettings } from '@evervault/browser'; | ||
import type { SwipedCard } from 'types'; | ||
import type { ThemeDefinition } from 'types'; | ||
import * as themes from 'themes'; | ||
export declare const EvervaultContext: React_2.Context<PromisifiedEvervaultClient | null>; | ||
export declare function Card({ theme, onSwipe, onReady, onError, onChange, translations, }: CardProps): React_2.JSX.Element; | ||
export declare const EvervaultInput: ({ onChange, config, onInputsLoad, }: EvervaultInputProps) => React_2.JSX.Element; | ||
declare interface CardProps { | ||
theme?: ThemeDefinition; | ||
translations?: CardTranslations; | ||
onReady?: () => void; | ||
onError?: () => void; | ||
onSwipe?: (data: SwipedCard) => void; | ||
onChange?: (data: CardPayload) => void; | ||
} | ||
export declare interface CustomConfig extends CustomConfig_2 { | ||
jsSdkUrl: string; | ||
} | ||
export declare function EvervaultInput({ onChange, config, onInputsLoad, }: EvervaultInputProps): React_2.JSX.Element; | ||
export declare interface EvervaultInputProps { | ||
onChange?: (cardData: any) => void; | ||
config?: any; | ||
onChange?: (cardData: unknown) => void; | ||
config?: InputSettings; | ||
onInputsLoad?: () => void; | ||
@@ -20,23 +45,64 @@ } | ||
appId: string; | ||
customConfig?: any; | ||
customConfig?: CustomConfig; | ||
children: React_2.ReactNode | null; | ||
} | ||
export declare const EvervaultReveal: ({ request, config, onCopy, onRevealLoad, onRevealError, }: EvervaultRevealProps) => React_2.JSX.Element; | ||
export declare function EvervaultReveal({ request, config, onCopy, onRevealLoad, onRevealError, }: EvervaultRevealProps): React_2.JSX.Element; | ||
export declare interface EvervaultRevealProps { | ||
request: Request | EvervaultRequestProps; | ||
config?: any; | ||
config?: RevealSettings; | ||
onCopy?: () => void; | ||
onRevealLoad?: () => void; | ||
onRevealError?: (e: any) => void; | ||
onRevealError?: (e: unknown) => void; | ||
} | ||
export declare function Pin({ theme, onReady, onChange, onError, length }: PinProps): React_2.JSX.Element; | ||
declare type PinProps = PinOptions & { | ||
onReady?: () => void; | ||
onError?: () => void; | ||
onChange?: (data: PinPayload) => void; | ||
}; | ||
export declare class PromisifiedEvervaultClient extends Promise<EvervaultClient> { | ||
constructor(...args: ConstructorParameters<typeof Promise<EvervaultClient>>); | ||
encrypt(data: any): Promise<string>; | ||
encrypt(data: unknown): Promise<string>; | ||
} | ||
export declare function Reveal({ request, children, onReady, onError }: RevealProps): React_2.JSX.Element; | ||
export declare namespace Reveal { | ||
var Text: typeof RevealText; | ||
var CopyButton: typeof RevealCopyButton; | ||
} | ||
declare function RevealCopyButton({ path, onCopy, ...options }: RevealCopyButtonProps): React_2.JSX.Element; | ||
declare interface RevealCopyButtonProps { | ||
path: string; | ||
onCopy?: () => void; | ||
} | ||
declare interface RevealProps { | ||
request: Request; | ||
children: ReactNode | ReactNode[]; | ||
onReady?: () => void; | ||
onError?: () => void; | ||
} | ||
declare function RevealText({ path, theme, format }: RevealTextProps): React_2.JSX.Element; | ||
declare interface RevealTextProps { | ||
path: string; | ||
theme?: ThemeDefinition; | ||
format?: RevealFormat; | ||
} | ||
export { themes } | ||
export declare function useEvervault(): PromisifiedEvervaultClient | null; | ||
export * from "types"; | ||
export { } |
"use client"; | ||
import * as i from "react"; | ||
class w extends Promise { | ||
constructor(...e) { | ||
super(...e); | ||
import * as u from "react"; | ||
import { createContext as R, useContext as B, useState as g, useRef as v, useLayoutEffect as E, useEffect as b, useMemo as S } from "react"; | ||
function k(e) { | ||
return (t) => ({ | ||
styles: { | ||
body: { | ||
paddingBottom: 2 | ||
}, | ||
label: { | ||
fontSize: 14, | ||
marginBottom: 4, | ||
display: "block", | ||
color: "#0a2540" | ||
}, | ||
input: { | ||
height: 40, | ||
fontSize: 16, | ||
borderRadius: 6, | ||
color: "#0a2540", | ||
padding: "0 12px", | ||
backgroundColor: "#fff", | ||
border: "1px solid #e6ebf1", | ||
boxShadow: "0px 1px 1px rgba(0, 0, 0, .03), 0px 3px 6px rgba(0, 0, 0, .02)", | ||
"&::placeholder": { | ||
color: "#717f96" | ||
}, | ||
"&:focus": { | ||
outline: "none", | ||
borderColor: "#63e" | ||
} | ||
}, | ||
".field[ev-valid=false] input": { | ||
color: "#df1c41", | ||
borderColor: "#df1c41" | ||
}, | ||
".error": { | ||
color: "#df1c41", | ||
fontSize: "0.75rem", | ||
padding: "0.25rem 0" | ||
}, | ||
"[ev-component=card]": { | ||
gap: 16 | ||
}, | ||
"[ev-component=pin] input": { | ||
height: 80, | ||
fontSize: 20, | ||
caretColor: "transparent" | ||
}, | ||
...e ? t.extend(e) : {} | ||
} | ||
}); | ||
} | ||
function C(e) { | ||
return (t) => ({ | ||
styles: { | ||
body: { | ||
paddingTop: 4 | ||
}, | ||
".field": { | ||
position: "relative" | ||
}, | ||
label: { | ||
top: 10, | ||
left: 8, | ||
zIndex: 3, | ||
fontSize: 14, | ||
lineHeight: 1, | ||
height: "20px", | ||
display: "flex", | ||
color: "#717f96", | ||
padding: "0 4px", | ||
alignItems: "center", | ||
position: "absolute", | ||
pointerEvents: "none", | ||
transformOrigin: "center left", | ||
transition: "transform 150ms, background 150ms" | ||
}, | ||
input: { | ||
height: 40, | ||
fontSize: 16, | ||
borderRadius: 6, | ||
color: "#0a2540", | ||
padding: "0 12px", | ||
backgroundColor: "#fff", | ||
border: "1px solid #e6ebf1", | ||
"&::placeholder": { | ||
color: "transparent" | ||
}, | ||
"&:focus": { | ||
outline: "none", | ||
borderColor: "#63e" | ||
} | ||
}, | ||
".field[ev-valid=false] input": { | ||
color: "#df1c41", | ||
borderColor: "#df1c41" | ||
}, | ||
".field:focus-within label, .field:not([ev-has-value=false]) label": { | ||
background: "white", | ||
transform: "translateY(-100%) scale(0.8)" | ||
}, | ||
".error": { | ||
color: "#df1c41", | ||
fontSize: "0.75rem", | ||
padding: "0.25rem 0" | ||
}, | ||
".field:not([ev-valid=false]):focus-within label": { | ||
color: "#63e" | ||
}, | ||
".field[ev-valid=false] label": { | ||
color: "#df1c41" | ||
}, | ||
".field[ev-has-value=true][ev-valid=true]:not(:focus-within) label": { | ||
color: "#0a2540" | ||
}, | ||
"[ev-component=card]": { | ||
gap: 16 | ||
}, | ||
...e ? t.extend(e) : {} | ||
} | ||
}); | ||
} | ||
function I(e) { | ||
return (t) => ({ | ||
styles: { | ||
body: { | ||
paddingBottom: 2 | ||
}, | ||
label: { | ||
fontSize: 14, | ||
marginBottom: "0.5rem", | ||
color: "#0a2540", | ||
display: "none" | ||
}, | ||
".field:first-child label": { | ||
display: "block" | ||
}, | ||
"fieldset[ev-valid=false]": { | ||
paddingBottom: "1.5rem" | ||
}, | ||
input: { | ||
height: 40, | ||
fontSize: 16, | ||
borderRadius: 0, | ||
color: "#0a2540", | ||
padding: "0 12px", | ||
backgroundColor: "#fff", | ||
border: "1px solid #e6ebf1", | ||
boxShadow: "0px 1px 1px rgba(0, 0, 0, .03), 0px 3px 6px rgba(0, 0, 0, .02)", | ||
"&::placeholder": { | ||
color: "#717f96" | ||
}, | ||
"&:focus": { | ||
outline: "none", | ||
borderColor: "#63e" | ||
} | ||
}, | ||
".field[ev-valid=false] input": { | ||
color: "#df1c41", | ||
borderColor: "#df1c41" | ||
}, | ||
".error": { | ||
color: "#df1c41", | ||
fontSize: "0.75rem", | ||
padding: "0.25rem 0", | ||
position: "absolute", | ||
left: 0, | ||
bottom: 0, | ||
display: "none" | ||
}, | ||
".field[ev-valid=false]": { | ||
zIndex: 4 | ||
}, | ||
".field:focus-within": { | ||
zIndex: 5 | ||
}, | ||
"[ev-component=card]": { | ||
gap: 0, | ||
"& .field[ev-valid=false]:nth-child(1) .error": { | ||
display: "block" | ||
}, | ||
"& [ev-valid=true]:nth-child(1) + [ev-valid=false] .error": { | ||
display: "block" | ||
}, | ||
"& [ev-valid=true]:nth-child(1) + [ev-valid=true]:nth-child(2) + [ev-valid=false] .error": { | ||
display: "block" | ||
}, | ||
"& [ev-name=number]": { | ||
marginBottom: "-1px", | ||
"& input": { | ||
borderTopLeftRadius: 6, | ||
borderTopRightRadius: 6 | ||
} | ||
}, | ||
"& .field:nth-child(2) input": { | ||
borderBottomLeftRadius: 6 | ||
}, | ||
"& .field:nth-child(3)": { | ||
marginLeft: "-1px" | ||
}, | ||
"& .field:last-child input": { | ||
borderBottomRightRadius: 6 | ||
} | ||
}, | ||
"[ev-component=pin]": { | ||
gap: 0, | ||
"& input": { | ||
height: 60 | ||
}, | ||
"& .field:not(:first-child)": { | ||
marginLeft: "-1px" | ||
}, | ||
"& .field:first-child input": { | ||
borderTopLeftRadius: 6, | ||
borderBottomLeftRadius: 6 | ||
}, | ||
"& .field:last-child input": { | ||
borderTopRightRadius: 6, | ||
borderBottomRightRadius: 6 | ||
} | ||
}, | ||
...e ? t.extend(e) : {} | ||
} | ||
}); | ||
} | ||
const V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
clean: k, | ||
material: C, | ||
minimal: I | ||
}, Symbol.toStringTag, { value: "Module" })), x = R(null); | ||
function h() { | ||
if (typeof window > "u") | ||
return null; | ||
if (typeof u.useContext != "function") | ||
throw new Error( | ||
"You must use React >= 18.0 in order to use useEvervault()" | ||
); | ||
const e = u.useContext(x); | ||
if (!e) | ||
throw new Error( | ||
"You must wrap your app in an <EvervaultProvider> to use useEvervault()" | ||
); | ||
return e; | ||
} | ||
const z = R( | ||
void 0 | ||
); | ||
function L() { | ||
const e = B(z); | ||
if (!e) | ||
throw new Error("Reveal consumers must be used within a Reveal component"); | ||
return e; | ||
} | ||
function T({ | ||
path: e, | ||
onCopy: t, | ||
...o | ||
}) { | ||
const [r, d] = g(null), a = v(null), { reveal: i } = L(); | ||
return u.useEffect(() => { | ||
if (!(!r || !t)) | ||
return r == null ? void 0 : r.on("copy", t); | ||
}, [r, t]), E(() => { | ||
if ((!a.current || r) ?? !i) | ||
return; | ||
const l = i == null ? void 0 : i.copyButton(e, o); | ||
l.mount(a.current), d(l); | ||
}, [i, e, o, r]), /* @__PURE__ */ u.createElement("div", { ref: a }); | ||
} | ||
function j({ path: e, theme: t, format: o }) { | ||
const [r, d] = g(null), a = v(null), { reveal: i } = L(); | ||
return E(() => { | ||
if ((!a.current || r) ?? !i) | ||
return; | ||
const l = i.text(e, { | ||
theme: t, | ||
format: o | ||
}); | ||
l.mount(a.current), d(l); | ||
}, [i, e, t, o, r]), /* @__PURE__ */ u.createElement("div", { ref: a }); | ||
} | ||
function P({ request: e, children: t, onReady: o, onError: r }) { | ||
const d = v(!1), a = h(), [i, l] = g(null), c = v(null); | ||
return u.useEffect(() => { | ||
if (!(!i || !o)) | ||
return i == null ? void 0 : i.on("ready", o); | ||
}, [i, o]), u.useEffect(() => { | ||
if (!(!i || !r)) | ||
return i == null ? void 0 : i.on("error", r); | ||
}, [i, r]), b(() => { | ||
if (!c.current || d.current) | ||
return; | ||
async function n() { | ||
d.current = !0; | ||
const f = await a; | ||
if (!f) | ||
return; | ||
const s = f.ui.reveal(e); | ||
l(s); | ||
} | ||
n().catch(console.error); | ||
}, [i, e, a]), /* @__PURE__ */ u.createElement(z.Provider, { value: { reveal: i } }, /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("div", { ref: c }), t)); | ||
} | ||
P.Text = j; | ||
P.CopyButton = T; | ||
function A({ | ||
theme: e, | ||
onSwipe: t, | ||
onReady: o, | ||
onError: r, | ||
onChange: d, | ||
translations: a | ||
}) { | ||
const i = h(), l = v(!1), c = v(null), [n, f] = u.useState(null); | ||
b(() => { | ||
if (!(!n || !o)) | ||
return n == null ? void 0 : n.on("ready", o); | ||
}, [n, o]), b(() => { | ||
if (!(!n || !r)) | ||
return n == null ? void 0 : n.on("error", r); | ||
}, [n, r]), b(() => { | ||
if (!(!n || !t)) | ||
return n == null ? void 0 : n.on("swipe", t); | ||
}, [n, t]), b(() => { | ||
if (!(!n || !d)) | ||
return n == null ? void 0 : n.on("change", d); | ||
}, [n, d]); | ||
const s = S( | ||
() => ({ | ||
theme: e, | ||
translations: a | ||
}), | ||
[e, a] | ||
); | ||
return E(() => { | ||
if (!c.current) | ||
return; | ||
async function p() { | ||
if (l.current || !c.current) | ||
return; | ||
l.current = !0; | ||
const m = await i; | ||
if (!m) | ||
return; | ||
const y = m.ui.card(s); | ||
y.mount(c.current), f(y); | ||
} | ||
n ? n.update(s) : p().catch(console.error); | ||
}, [s, n]), /* @__PURE__ */ u.createElement("div", { ref: c }); | ||
} | ||
function H({ theme: e, onReady: t, onChange: o, onError: r, length: d }) { | ||
const a = h(), i = v(!1), [l, c] = u.useState(null), n = v(null); | ||
u.useEffect(() => { | ||
if (!(!l || !t)) | ||
return l == null ? void 0 : l.on("ready", t); | ||
}, [l, t]), u.useEffect(() => { | ||
if (!(!l || !r)) | ||
return l == null ? void 0 : l.on("error", r); | ||
}, [l, r]), u.useEffect(() => { | ||
if (!(!l || !o)) | ||
return l == null ? void 0 : l.on("change", o); | ||
}, [l, o]); | ||
const f = S( | ||
() => ({ | ||
theme: e, | ||
length: d | ||
}), | ||
[e, d] | ||
); | ||
return E(() => { | ||
if (!n.current) | ||
return; | ||
async function s() { | ||
if (i.current || !n.current) | ||
return; | ||
i.current = !0; | ||
const p = await a; | ||
if (!p) | ||
return; | ||
const m = p.ui.pin(f); | ||
m.mount(n.current), c(m); | ||
} | ||
l ? l.update(f) : s().catch(console.error); | ||
}, [l, f]), /* @__PURE__ */ u.createElement("div", { ref: n }); | ||
} | ||
class _ extends Promise { | ||
async encrypt(t) { | ||
return (await this).encrypt(t); | ||
} | ||
encrypt(e) { | ||
return this.then((t) => t.encrypt(e)); | ||
} | ||
} | ||
const c = i.createContext(null), h = "https://js.evervault.com/v2", m = (n) => { | ||
const e = document.createElement("script"); | ||
n ? e.src = n : e.src = h; | ||
const t = document.head || document.body; | ||
if (!t) | ||
const O = "https://js.evervault.com/v2"; | ||
function M(e) { | ||
const t = document.createElement("script"); | ||
e ? t.src = e : t.src = O; | ||
const o = document.head || document.body; | ||
if (!o) | ||
throw new Error( | ||
"Expected document.body not to be null. Evervault.js requires a <body> element." | ||
); | ||
return t.appendChild(e), e; | ||
}; | ||
let v = null; | ||
const p = (n) => (v !== null || (v = new Promise((e, t) => { | ||
if (typeof window > "u") { | ||
e(null); | ||
return; | ||
} | ||
if (window.Evervault) { | ||
console.warn("Evervault has already been loaded"), e(window.Evervault); | ||
return; | ||
} | ||
try { | ||
const o = m(n); | ||
o.addEventListener("load", () => { | ||
window.Evervault ? e(window.Evervault) : t(new Error("Evervault.js not available")); | ||
}), o.addEventListener("error", () => { | ||
t(new Error("Failed to load Evervault.js")); | ||
}); | ||
} catch (o) { | ||
t(o); | ||
return; | ||
} | ||
})), v), y = async (n) => { | ||
const e = Promise.resolve().then( | ||
() => p(n) | ||
); | ||
let t = !1; | ||
return e.catch((o) => { | ||
t || console.warn(o); | ||
}), t = !0, e.then(() => { | ||
if (typeof window < "u") | ||
return window.Evervault; | ||
}); | ||
}, P = ({ | ||
teamId: n, | ||
appId: e, | ||
customConfig: t, | ||
children: o, | ||
...u | ||
return o.appendChild(t), t; | ||
} | ||
let w = null; | ||
function Y(e) { | ||
return w !== null || (w = new Promise((t, o) => { | ||
if (typeof window > "u") { | ||
t(void 0); | ||
return; | ||
} | ||
if (window.Evervault) { | ||
console.warn("Evervault has already been loaded"), t(window.Evervault); | ||
return; | ||
} | ||
try { | ||
const r = M(e); | ||
r.addEventListener("load", () => { | ||
window.Evervault ? t(window.Evervault) : o(new Error("Evervault.js not available")); | ||
}), r.addEventListener("error", () => { | ||
o(new Error("Failed to load Evervault.js")); | ||
}); | ||
} catch (r) { | ||
o(r); | ||
} | ||
})), w; | ||
} | ||
function F(e) { | ||
const t = Promise.resolve().then(() => Y(e)); | ||
let o = !1; | ||
return t.catch((r) => { | ||
o || console.warn(r); | ||
}), o = !0, t.then((r) => typeof window < "u" ? window.Evervault : r ?? void 0); | ||
} | ||
const q = ({ | ||
teamId: e, | ||
appId: t, | ||
customConfig: o, | ||
children: r, | ||
...d | ||
}) => { | ||
if (typeof window > "u") | ||
return /* @__PURE__ */ i.createElement(c.Provider, { value: null }, o); | ||
const a = i.useMemo( | ||
() => new w((l, r) => { | ||
y(t == null ? void 0 : t.jsSdkUrl).then((s) => { | ||
s !== void 0 ? l(new s(n, e, t)) : (console.error("Evervault.js not available"), r("Evervault.js not available")); | ||
}); | ||
return /* @__PURE__ */ u.createElement(x.Provider, { value: null }, r); | ||
const a = u.useMemo( | ||
() => new _((i, l) => { | ||
F(o == null ? void 0 : o.jsSdkUrl).then((c) => { | ||
c !== void 0 ? i(new c(e, t, o)) : (console.error("Evervault.js not available"), l("Evervault.js not available")); | ||
}).catch((c) => l(c)); | ||
}), | ||
[] | ||
); | ||
return /* @__PURE__ */ i.createElement(c.Provider, { ...u, value: a }, o); | ||
}, b = ({ | ||
onChange: n, | ||
config: e, | ||
onInputsLoad: t | ||
}) => { | ||
const o = i.useId(); | ||
return /* @__PURE__ */ u.createElement(x.Provider, { ...d, value: a }, r); | ||
}; | ||
function D({ | ||
onChange: e, | ||
config: t, | ||
onInputsLoad: o | ||
}) { | ||
const r = u.useId(); | ||
if (typeof window > "u") | ||
return /* @__PURE__ */ i.createElement("div", { id: o }); | ||
const u = f(); | ||
let a = e; | ||
return a ? a.height || (a = { | ||
height: "auto", | ||
...a | ||
}) : a = { | ||
height: "auto" | ||
}, i.useEffect(() => { | ||
u == null || u.then((l) => { | ||
const r = l.inputs(o, a); | ||
r == null || r.on("change", async (s) => { | ||
typeof n == "function" && n(s); | ||
}), t && (r == null ? void 0 : r.isInputsLoaded) != null && r.isInputsLoaded instanceof Promise && r.isInputsLoaded.then(() => t()); | ||
return /* @__PURE__ */ u.createElement("div", { id: r }); | ||
const d = h(), { height: a = "auto", ...i } = t ?? {}, l = i ? { height: a, ...i } : { height: a }; | ||
return u.useEffect(() => { | ||
d == null || d.then((c) => { | ||
const n = c.inputs(r, l); | ||
n == null || n.on("change", (f) => { | ||
typeof e == "function" && e(f); | ||
}), o && (n == null ? void 0 : n.isInputsLoaded) != null && n.isInputsLoaded instanceof Promise && n.isInputsLoaded.then(() => o()); | ||
}); | ||
}, [u]), /* @__PURE__ */ i.createElement("div", { id: o }); | ||
}, L = ({ | ||
request: n, | ||
config: e, | ||
onCopy: t, | ||
onRevealLoad: o, | ||
onRevealError: u | ||
}) => { | ||
const a = i.useId(); | ||
}, [d]), /* @__PURE__ */ u.createElement("div", { id: r }); | ||
} | ||
function G({ | ||
request: e, | ||
config: t, | ||
onCopy: o, | ||
onRevealLoad: r, | ||
onRevealError: d | ||
}) { | ||
const a = u.useId(); | ||
if (typeof window > "u") | ||
return /* @__PURE__ */ i.createElement("div", { id: a }); | ||
const l = f(); | ||
let r = e; | ||
return r ? r.height || (r = { | ||
height: "auto", | ||
...r | ||
}) : r = { | ||
height: "auto" | ||
}, i.useEffect(() => { | ||
l == null || l.then((s) => { | ||
const d = s.reveal(a, n, r, t); | ||
(d == null ? void 0 : d.isRevealLoaded) != null && d.isRevealLoaded instanceof Promise && d.isRevealLoaded.then(() => { | ||
o && o(); | ||
}).catch((E) => { | ||
u && u(E); | ||
return /* @__PURE__ */ u.createElement("div", { id: a }); | ||
const i = h(), { height: l = "auto", ...c } = t ?? {}, n = c ? { height: l, ...c } : { height: l }; | ||
return u.useEffect(() => { | ||
i == null || i.then((f) => { | ||
const s = f.reveal(a, e, n, o); | ||
(s == null ? void 0 : s.isRevealLoaded) != null && s.isRevealLoaded instanceof Promise && s.isRevealLoaded.then(() => { | ||
r && r(); | ||
}).catch((p) => { | ||
d && d(p); | ||
}); | ||
}); | ||
}, [l]), /* @__PURE__ */ i.createElement("div", { id: a }); | ||
}; | ||
function f() { | ||
if (typeof window > "u") | ||
return null; | ||
if (typeof i.useContext != "function") | ||
throw new Error( | ||
"You must use React >= 18.0 in order to use useEvervault()" | ||
); | ||
const n = i.useContext(c); | ||
if (!n) | ||
throw new Error( | ||
"You must wrap your app in an <EvervaultProvider> to use useEvervault()" | ||
); | ||
return n; | ||
}, [i]), /* @__PURE__ */ u.createElement("div", { id: a }); | ||
} | ||
export { | ||
c as EvervaultContext, | ||
b as EvervaultInput, | ||
P as EvervaultProvider, | ||
L as EvervaultReveal, | ||
w as PromisifiedEvervaultClient, | ||
f as useEvervault | ||
A as Card, | ||
D as EvervaultInput, | ||
q as EvervaultProvider, | ||
G as EvervaultReveal, | ||
H as Pin, | ||
_ as PromisifiedEvervaultClient, | ||
P as Reveal, | ||
V as themes, | ||
h as useEvervault | ||
}; |
{ | ||
"private": false, | ||
"name": "@evervault/react", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "React package for the Evervault SDK", | ||
@@ -28,12 +28,30 @@ "license": "MIT", | ||
}, | ||
"bundledDependencies": [ | ||
"types", | ||
"themes" | ||
], | ||
"devDependencies": { | ||
"@evervault/browser": "^2.14.1" | ||
"@types/react": "^18.2.8", | ||
"@types/react-dom": "^18.2.4", | ||
"@vitejs/plugin-react": "^4.1.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"vite": "^4.5.1", | ||
"vite-plugin-dts": "^3.6.3", | ||
"types": "^0.0.0", | ||
"themes": "^0.0.0", | ||
"@evervault/browser": "^2.17.0", | ||
"tsconfig": "^0.0.1" | ||
}, | ||
"scripts": { | ||
"build": "vite build", | ||
"coverage": "vitest --coverage", | ||
"dev": "vite build --watch", | ||
"format": "prettier --write .", | ||
"format:check": "prettier --check .", | ||
"typecheck": "tsc --noEmit", | ||
"build": "vite build", | ||
"dev": "vite" | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"preinstall": "npx only-allow pnpm", | ||
"typecheck": "tsc --noEmit" | ||
} | ||
} |
@@ -15,3 +15,3 @@ [](https://evervault.com/) | ||
See the Evervault [React.js SDK documentation](https://docs.evervault.com/sdks/react-sdk). | ||
See the Evervault [React.js SDK documentation](https://docs.evervault.com/sdks/reactjs). | ||
@@ -18,0 +18,0 @@ ## Installation |
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
52916
16
982
11
1
1