@evervault/react
Advanced tools
Comparing version 2.9.0 to 2.10.0
@@ -16,7 +16,7 @@ import { events } from 'events'; | ||
export declare function Card({ theme, fields, autoFocus, translations, onSwipe, onReady, onError, onChange, onComplete, autoComplete, autoProgress, }: CardProps): React_2.JSX.Element; | ||
export declare function Card({ theme, fields, autoFocus, translations, onSwipe, onReady, onError, onChange, onComplete, autoComplete, autoProgress, acceptedBrands, }: CardProps): React_2.JSX.Element; | ||
declare class Card_2 { | ||
#private; | ||
values?: CardPayload; | ||
values: CardPayload; | ||
constructor(client: EvervaultClient, options?: CardOptions); | ||
@@ -60,3 +60,4 @@ get config(): { | ||
| "hiper" | ||
| "szep"; | ||
| "szep" | ||
| "uatp"; | ||
@@ -69,2 +70,3 @@ declare interface CardEvents { | ||
swipe: (payload: SwipedCard) => void; | ||
validate: (payload: CardPayload) => void; | ||
} | ||
@@ -90,2 +92,3 @@ | ||
EV_COMPLETE: CardPayload; | ||
EV_VALIDATED: CardPayload; | ||
} | ||
@@ -145,2 +148,3 @@ | ||
autoProgress?: boolean; | ||
acceptedBrands?: CardBrandName[]; | ||
} | ||
@@ -147,0 +151,0 @@ |
"use client"; | ||
import * as u from "react"; | ||
import { createContext as C, useContext as D, useState as S, useRef as m, useLayoutEffect as y, useEffect as E, useMemo as P, useCallback as B } from "react"; | ||
function M(o) { | ||
import { createContext as P, useContext as M, useState as z, useRef as m, useLayoutEffect as y, useEffect as g, useMemo as I, useCallback as B } from "react"; | ||
function O(o) { | ||
return (n) => ({ | ||
@@ -86,3 +86,3 @@ styles: { | ||
} | ||
function O(o) { | ||
function Y(o) { | ||
return (n) => ({ | ||
@@ -173,3 +173,3 @@ styles: { | ||
} | ||
function Y(o) { | ||
function U(o) { | ||
return (n) => ({ | ||
@@ -309,8 +309,8 @@ styles: { | ||
} | ||
const K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
const N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
clean: M, | ||
material: O, | ||
minimal: Y | ||
}, Symbol.toStringTag, { value: "Module" })), R = C(null); | ||
clean: O, | ||
material: Y, | ||
minimal: U | ||
}, Symbol.toStringTag, { value: "Module" })), S = P(null); | ||
function x() { | ||
@@ -323,3 +323,3 @@ if (typeof window > "u") | ||
); | ||
const o = u.useContext(R); | ||
const o = u.useContext(S); | ||
if (!o) | ||
@@ -331,7 +331,7 @@ throw new Error( | ||
} | ||
const I = C( | ||
const T = P( | ||
void 0 | ||
); | ||
function T() { | ||
const o = D(I); | ||
function j() { | ||
const o = M(T); | ||
if (!o) | ||
@@ -341,3 +341,3 @@ throw new Error("Reveal consumers must be used within a Reveal component"); | ||
} | ||
function U({ | ||
function V({ | ||
path: o, | ||
@@ -347,3 +347,3 @@ onCopy: n, | ||
}) { | ||
const [i, f] = S(null), d = m(null), { reveal: e } = T(); | ||
const [i, f] = z(null), d = m(null), { reveal: e } = j(); | ||
return u.useEffect(() => { | ||
@@ -359,4 +359,4 @@ if (!(!i || !n)) | ||
} | ||
function V({ path: o, theme: n, format: t }) { | ||
const [i, f] = S(null), d = m(null), { reveal: e } = T(); | ||
function A({ path: o, theme: n, format: t }) { | ||
const [i, f] = z(null), d = m(null), { reveal: e } = j(); | ||
return y(() => { | ||
@@ -372,4 +372,4 @@ if ((!d.current || i) ?? !e) | ||
} | ||
function j({ request: o, children: n, onReady: t, onError: i }) { | ||
const f = m(!1), d = x(), [e, a] = S(null), c = m(null); | ||
function _({ request: o, children: n, onReady: t, onError: i }) { | ||
const f = m(!1), d = x(), [e, a] = z(null), c = m(null); | ||
return u.useEffect(() => { | ||
@@ -381,3 +381,3 @@ if (!(!e || !t)) | ||
return e == null ? void 0 : e.on("error", i); | ||
}, [e, i]), E(() => { | ||
}, [e, i]), g(() => { | ||
if (!c.current || f.current) | ||
@@ -394,7 +394,7 @@ return; | ||
s().catch(console.error); | ||
}, [e, o, d]), /* @__PURE__ */ u.createElement(I.Provider, { value: { reveal: e } }, /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("div", { ref: c }), n)); | ||
}, [e, o, d]), /* @__PURE__ */ u.createElement(T.Provider, { value: { reveal: e } }, /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("div", { ref: c }), n)); | ||
} | ||
j.Text = V; | ||
j.CopyButton = U; | ||
function N({ | ||
_.Text = A; | ||
_.CopyButton = V; | ||
function Q({ | ||
theme: o, | ||
@@ -410,22 +410,23 @@ fields: n, | ||
autoComplete: s, | ||
autoProgress: r | ||
autoProgress: r, | ||
acceptedBrands: v | ||
}) { | ||
const v = x(), p = m(!1), h = m(null), [l, b] = u.useState(null); | ||
E(() => { | ||
const p = x(), b = m(!1), h = m(null), [l, E] = u.useState(null); | ||
g(() => { | ||
if (!(!l || !d)) | ||
return l == null ? void 0 : l.on("ready", d); | ||
}, [l, d]), E(() => { | ||
}, [l, d]), g(() => { | ||
if (!(!l || !e)) | ||
return l == null ? void 0 : l.on("error", e); | ||
}, [l, e]), E(() => { | ||
}, [l, e]), g(() => { | ||
if (!(!l || !f)) | ||
return l == null ? void 0 : l.on("swipe", f); | ||
}, [l, f]), E(() => { | ||
}, [l, f]), g(() => { | ||
if (!(!l || !a)) | ||
return l == null ? void 0 : l.on("change", a); | ||
}, [l, a]), E(() => { | ||
}, [l, a]), g(() => { | ||
if (!(!l || !c)) | ||
return l == null ? void 0 : l.on("complete", c); | ||
}, [l, c]); | ||
const g = P( | ||
const R = I( | ||
() => ({ | ||
@@ -437,5 +438,14 @@ theme: o, | ||
autoComplete: s, | ||
autoProgress: r | ||
autoProgress: r, | ||
acceptedBrands: v | ||
}), | ||
[o, i, n, t, s, r] | ||
[ | ||
o, | ||
i, | ||
n, | ||
t, | ||
s, | ||
r, | ||
v | ||
] | ||
); | ||
@@ -445,16 +455,16 @@ return y(() => { | ||
return; | ||
async function _() { | ||
if (p.current || !h.current) | ||
async function D() { | ||
if (b.current || !h.current) | ||
return; | ||
p.current = !0; | ||
const z = await v; | ||
if (!z) | ||
b.current = !0; | ||
const L = await p; | ||
if (!L) | ||
return; | ||
const L = z.ui.card(g); | ||
L.mount(h.current), b(L); | ||
const C = L.ui.card(R); | ||
C.mount(h.current), E(C); | ||
} | ||
l ? l.update(g) : _().catch(console.error); | ||
}, [g, l]), /* @__PURE__ */ u.createElement("div", { ref: h }); | ||
l ? l.update(R) : D().catch(console.error); | ||
}, [R, l]), /* @__PURE__ */ u.createElement("div", { ref: h }); | ||
} | ||
function Q({ | ||
function W({ | ||
theme: o, | ||
@@ -480,3 +490,3 @@ autoFocus: n, | ||
}, [r, e]); | ||
const h = P( | ||
const b = I( | ||
() => ({ | ||
@@ -494,16 +504,16 @@ theme: o, | ||
return; | ||
async function l() { | ||
async function h() { | ||
if (s.current || !p.current) | ||
return; | ||
s.current = !0; | ||
const b = await c; | ||
if (!b) | ||
const l = await c; | ||
if (!l) | ||
return; | ||
const g = b.ui.pin(h); | ||
g.mount(p.current), v(g); | ||
const E = l.ui.pin(b); | ||
E.mount(p.current), v(E); | ||
} | ||
r ? r.update(h) : l().catch(console.error); | ||
}, [r, h]), /* @__PURE__ */ u.createElement("div", { ref: p }); | ||
r ? r.update(b) : h().catch(console.error); | ||
}, [r, b]), /* @__PURE__ */ u.createElement("div", { ref: p }); | ||
} | ||
function W({ | ||
function X({ | ||
session: o, | ||
@@ -541,16 +551,16 @@ theme: n, | ||
return u.useLayoutEffect(() => { | ||
async function h() { | ||
async function b() { | ||
if (c.current) | ||
return; | ||
c.current = !0; | ||
const l = await a; | ||
if (!l) | ||
const h = await a; | ||
if (!h) | ||
return; | ||
const b = l.ui.threeDSecure(o, p); | ||
b.mount(s.current), v(b); | ||
const l = h.ui.threeDSecure(o, p); | ||
l.mount(s.current), v(l); | ||
} | ||
r ? r.update(p) : h().catch(console.error); | ||
r ? r.update(p) : b().catch(console.error); | ||
}, [r, o, p]), /* @__PURE__ */ u.createElement("div", { ref: s }); | ||
} | ||
function X(o) { | ||
function Z(o) { | ||
const n = x(), t = m(null), i = B( | ||
@@ -575,3 +585,3 @@ (d, e) => { | ||
} | ||
class A extends Promise { | ||
class H extends Promise { | ||
async encrypt(n) { | ||
@@ -584,6 +594,6 @@ return (await this).encrypt(n); | ||
} | ||
const H = "https://js.evervault.com/v2"; | ||
function q(o) { | ||
const q = "https://js.evervault.com/v2"; | ||
function F(o) { | ||
const n = document.createElement("script"); | ||
o ? n.src = o : n.src = H; | ||
o ? n.src = o : n.src = q; | ||
const t = document.head || document.body; | ||
@@ -597,3 +607,3 @@ if (!t) | ||
let w = null; | ||
function F(o) { | ||
function G(o) { | ||
return w !== null || (w = new Promise((n, t) => { | ||
@@ -609,3 +619,3 @@ if (typeof window > "u") { | ||
try { | ||
const i = q(o); | ||
const i = F(o); | ||
i.addEventListener("load", () => { | ||
@@ -621,4 +631,4 @@ window.Evervault ? n(window.Evervault) : t(new Error("Evervault.js not available")); | ||
} | ||
function G(o) { | ||
const n = Promise.resolve().then(() => F(o)); | ||
function J(o) { | ||
const n = Promise.resolve().then(() => G(o)); | ||
let t = !1; | ||
@@ -629,3 +639,3 @@ return n.catch((i) => { | ||
} | ||
const Z = ({ | ||
const $ = ({ | ||
teamId: o, | ||
@@ -638,6 +648,6 @@ appId: n, | ||
if (typeof window > "u") | ||
return /* @__PURE__ */ u.createElement(R.Provider, { value: null }, i); | ||
return /* @__PURE__ */ u.createElement(S.Provider, { value: null }, i); | ||
const d = u.useMemo( | ||
() => new A((e, a) => { | ||
G(t == null ? void 0 : t.jsSdkUrl).then((c) => { | ||
() => new H((e, a) => { | ||
J(t == null ? void 0 : t.jsSdkUrl).then((c) => { | ||
c !== void 0 ? e(new c(o, n, t)) : (console.error("Evervault.js not available"), a("Evervault.js not available")); | ||
@@ -648,5 +658,5 @@ }).catch((c) => a(c)); | ||
); | ||
return /* @__PURE__ */ u.createElement(R.Provider, { ...f, value: d }, i); | ||
return /* @__PURE__ */ u.createElement(S.Provider, { ...f, value: d }, i); | ||
}; | ||
function $({ | ||
function k({ | ||
onChange: o, | ||
@@ -669,3 +679,3 @@ config: n, | ||
} | ||
function k({ | ||
function ee({ | ||
request: o, | ||
@@ -693,13 +703,13 @@ config: n, | ||
export { | ||
N as Card, | ||
$ as EvervaultInput, | ||
Z as EvervaultProvider, | ||
k as EvervaultReveal, | ||
Q as Pin, | ||
A as PromisifiedEvervaultClient, | ||
j as Reveal, | ||
W as ThreeDSecure, | ||
K as themes, | ||
Q as Card, | ||
k as EvervaultInput, | ||
$ as EvervaultProvider, | ||
ee as EvervaultReveal, | ||
W as Pin, | ||
H as PromisifiedEvervaultClient, | ||
_ as Reveal, | ||
X as ThreeDSecure, | ||
N as themes, | ||
x as useEvervault, | ||
X as useThreeDSecure | ||
Z as useThreeDSecure | ||
}; |
{ | ||
"private": false, | ||
"name": "@evervault/react", | ||
"version": "2.9.0", | ||
"version": "2.10.0", | ||
"description": "React package for the Evervault SDK", | ||
@@ -36,5 +36,5 @@ "license": "MIT", | ||
"vite-plugin-dts": "^3.6.3", | ||
"types": "^0.3.0", | ||
"@evervault/browser": "^2.30.0", | ||
"themes": "^0.1.3", | ||
"@evervault/browser": "^2.28.0", | ||
"types": "^0.3.0", | ||
"tsconfig": "^0.0.1" | ||
@@ -51,4 +51,5 @@ }, | ||
"preinstall": "npx only-allow pnpm", | ||
"typecheck": "tsc --noEmit" | ||
"typecheck": "tsc --noEmit", | ||
"clean": "rm -rf .turbo node_modules dist" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80775
1739