@evervault/react
Advanced tools
Comparing version 2.15.0 to 2.16.0
@@ -216,3 +216,3 @@ import { events } from 'events'; | ||
export declare function Card({ theme, icons, fields, autoFocus, translations, onSwipe, onReady, onError, onChange, onComplete, onFocus, onBlur, onKeyUp, onKeyDown, autoComplete, autoProgress, acceptedBrands, defaultValues, }: CardProps): React_2.JSX.Element; | ||
export declare function Card({ theme, icons, fields, autoFocus, translations, onSwipe, onReady, onError, onChange, onComplete, onFocus, onBlur, onKeyUp, onKeyDown, autoComplete, autoProgress, acceptedBrands, defaultValues, redactCVC, }: CardProps): React_2.JSX.Element; | ||
@@ -242,2 +242,3 @@ declare class Card_2 { | ||
autoProgress: boolean | undefined; | ||
redactCVC: boolean | undefined; | ||
}; | ||
@@ -322,2 +323,3 @@ }; | ||
autoProgress?: boolean; | ||
redactCVC?: boolean; | ||
defaultValues?: { | ||
@@ -375,2 +377,3 @@ name?: string; | ||
onKeyDown?: (event: FieldEvent) => void; | ||
redactCVC?: boolean; | ||
} | ||
@@ -822,3 +825,2 @@ | ||
borderRadius: number | undefined; | ||
environment: "TEST" | "PRODUCTION" | undefined; | ||
allowedAuthMethods: google.payments.api.CardAuthMethod[] | undefined; | ||
@@ -918,3 +920,2 @@ allowedCardNetworks: google.payments.api.CardNetwork[] | undefined; | ||
allowedCardNetworks?: google.payments.api.CardNetwork[]; | ||
environment?: "TEST" | "PRODUCTION"; | ||
} | ||
@@ -1558,3 +1559,3 @@ | ||
name: string; | ||
applePayIdentifier?: string; | ||
domain?: string; | ||
}; | ||
@@ -1617,1 +1618,7 @@ lineItems?: TransactionLineItem[]; | ||
export { } | ||
declare namespace Reveal { | ||
var Text: typeof RevealText; | ||
var CopyButton: typeof RevealCopyButton; | ||
} |
"use client"; | ||
import * as u from "react"; | ||
import { createContext as _, useContext as q, useState as C, useRef as b, useLayoutEffect as S, useEffect as m, useMemo as M, useCallback as j } from "react"; | ||
function G(t) { | ||
import { createContext as M, useContext as J, useState as P, useRef as b, useLayoutEffect as S, useEffect as m, useMemo as O, useCallback as _ } from "react"; | ||
function N(t) { | ||
return (o) => ({ | ||
@@ -103,3 +103,3 @@ styles: { | ||
} | ||
function J(t) { | ||
function Q(t) { | ||
return (o) => ({ | ||
@@ -207,3 +207,3 @@ styles: { | ||
} | ||
function N(t) { | ||
function U(t) { | ||
return (o) => ({ | ||
@@ -357,8 +357,8 @@ styles: { | ||
} | ||
const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
const ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
clean: G, | ||
material: J, | ||
minimal: N | ||
}, Symbol.toStringTag, { value: "Module" })), L = _(null); | ||
clean: N, | ||
material: Q, | ||
minimal: U | ||
}, Symbol.toStringTag, { value: "Module" })), L = M(null); | ||
function E() { | ||
@@ -378,7 +378,7 @@ if (typeof window > "u") | ||
} | ||
const O = _( | ||
const Y = M( | ||
void 0 | ||
); | ||
function Y() { | ||
const t = q(O); | ||
function D() { | ||
const t = J(Y); | ||
if (!t) | ||
@@ -388,3 +388,3 @@ throw new Error("Reveal consumers must be used within a Reveal component"); | ||
} | ||
function Q({ | ||
function V({ | ||
path: t, | ||
@@ -394,3 +394,3 @@ onCopy: o, | ||
}) { | ||
const [i, a] = C(null), f = b(null), { reveal: e } = Y(); | ||
const [i, a] = P(null), f = b(null), { reveal: e } = D(); | ||
return u.useEffect(() => { | ||
@@ -400,4 +400,3 @@ if (!(!i || !o)) | ||
}, [i, o]), S(() => { | ||
if ((!f.current || i) ?? !e) | ||
return; | ||
if ((!f.current || i) ?? !e) return; | ||
const c = e == null ? void 0 : e.copyButton(t, r); | ||
@@ -407,7 +406,6 @@ c.mount(f.current), a(c); | ||
} | ||
function U({ path: t, theme: o, format: r }) { | ||
const [i, a] = C(null), f = b(null), { reveal: e } = Y(); | ||
function W({ path: t, theme: o, format: r }) { | ||
const [i, a] = P(null), f = b(null), { reveal: e } = D(); | ||
return S(() => { | ||
if ((!f.current || i) ?? !e) | ||
return; | ||
if ((!f.current || i) ?? !e) return; | ||
const c = e.text(t, { | ||
@@ -420,4 +418,4 @@ theme: o, | ||
} | ||
function D({ request: t, children: o, onReady: r, onError: i }) { | ||
const a = b(!1), f = E(), [e, c] = C(null), v = b(null); | ||
function A({ request: t, children: o, onReady: r, onError: i }) { | ||
const a = b(!1), f = E(), [e, c] = P(null), v = b(null); | ||
return u.useEffect(() => { | ||
@@ -430,9 +428,7 @@ if (!(!e || !r)) | ||
}, [e, i]), m(() => { | ||
if (!v.current || a.current) | ||
return; | ||
if (!v.current || a.current) return; | ||
async function s() { | ||
a.current = !0; | ||
const l = await f; | ||
if (!l) | ||
return; | ||
if (!l) return; | ||
const d = l.ui.reveal(t); | ||
@@ -442,7 +438,7 @@ c(d); | ||
s().catch(console.error); | ||
}, [e, t, f]), /* @__PURE__ */ u.createElement(O.Provider, { value: { reveal: e } }, /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("div", { ref: v }), o)); | ||
}, [e, t, f]), /* @__PURE__ */ u.createElement(Y.Provider, { value: { reveal: e } }, /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("div", { ref: v }), o)); | ||
} | ||
D.Text = U; | ||
D.CopyButton = Q; | ||
function ee({ | ||
A.Text = W; | ||
A.CopyButton = V; | ||
function re({ | ||
theme: t, | ||
@@ -465,5 +461,6 @@ icons: o, | ||
acceptedBrands: g, | ||
defaultValues: P | ||
defaultValues: B, | ||
redactCVC: C | ||
}) { | ||
const A = E(), B = b(!1), y = b(null), [n, H] = u.useState(null); | ||
const H = E(), I = b(!1), y = b(null), [n, q] = u.useState(null); | ||
m(() => { | ||
@@ -497,3 +494,3 @@ if (!(!n || !e)) | ||
}, [n, h]); | ||
const z = M( | ||
const z = O( | ||
() => ({ | ||
@@ -508,3 +505,4 @@ theme: t, | ||
acceptedBrands: g, | ||
defaultValues: P | ||
defaultValues: B, | ||
redactCVC: C | ||
}), | ||
@@ -520,22 +518,20 @@ [ | ||
g, | ||
P | ||
B, | ||
C | ||
] | ||
); | ||
return S(() => { | ||
if (!y.current) | ||
return; | ||
async function V() { | ||
if (B.current || !y.current) | ||
return; | ||
B.current = !0; | ||
const I = await A; | ||
if (!I) | ||
return; | ||
const T = I.ui.card(z); | ||
T.mount(y.current), H(T); | ||
if (!y.current) return; | ||
async function G() { | ||
if (I.current || !y.current) return; | ||
I.current = !0; | ||
const T = await H; | ||
if (!T) return; | ||
const j = T.ui.card(z); | ||
j.mount(y.current), q(j); | ||
} | ||
n ? n.update(z) : V().catch(console.error); | ||
n ? n.update(z) : G().catch(console.error); | ||
}, [z, n]), /* @__PURE__ */ u.createElement("div", { ref: y }); | ||
} | ||
function re({ | ||
function te({ | ||
theme: t, | ||
@@ -561,3 +557,3 @@ autoFocus: o, | ||
}, [l, e]); | ||
const h = M( | ||
const h = O( | ||
() => ({ | ||
@@ -573,11 +569,8 @@ theme: t, | ||
return S(() => { | ||
if (!p.current) | ||
return; | ||
if (!p.current) return; | ||
async function w() { | ||
if (s.current || !p.current) | ||
return; | ||
if (s.current || !p.current) return; | ||
s.current = !0; | ||
const x = await v; | ||
if (!x) | ||
return; | ||
if (!x) return; | ||
const g = x.ui.pin(h); | ||
@@ -589,3 +582,3 @@ g.mount(p.current), d(g); | ||
} | ||
function te({ | ||
function oe({ | ||
session: t, | ||
@@ -626,8 +619,6 @@ theme: o, | ||
async function w() { | ||
if (s.current) | ||
return; | ||
if (s.current) return; | ||
s.current = !0; | ||
const x = await v; | ||
if (!x) | ||
return; | ||
if (!x) return; | ||
const g = x.ui.threeDSecure(t, h); | ||
@@ -639,4 +630,4 @@ g.mount(l.current), p(g); | ||
} | ||
function oe(t) { | ||
const o = E(), r = b(null), i = j( | ||
function ne(t) { | ||
const o = E(), r = b(null), i = _( | ||
(f, e) => { | ||
@@ -660,3 +651,3 @@ r.current && (r.current.unmount(), r.current = null); | ||
}, []); | ||
const a = j((f) => { | ||
const a = _((f) => { | ||
r.current && r.current.update(f); | ||
@@ -669,3 +660,3 @@ }, []); | ||
} | ||
class W extends Promise { | ||
class X extends Promise { | ||
async encrypt(o) { | ||
@@ -678,6 +669,6 @@ return (await this).encrypt(o); | ||
} | ||
const X = "https://js.evervault.com/v2"; | ||
function Z(t) { | ||
const Z = "https://js.evervault.com/v2"; | ||
function $(t) { | ||
const o = document.createElement("script"); | ||
t ? o.src = t : o.src = X; | ||
t ? o.src = t : o.src = Z; | ||
const r = document.head || document.body; | ||
@@ -691,3 +682,3 @@ if (!r) | ||
let R = null; | ||
function $(t) { | ||
function F(t) { | ||
return R !== null || (R = new Promise((o, r) => { | ||
@@ -703,3 +694,3 @@ if (typeof window > "u") { | ||
try { | ||
const i = Z(t); | ||
const i = $(t); | ||
i.addEventListener("load", () => { | ||
@@ -715,4 +706,4 @@ window.Evervault ? o(window.Evervault) : r(new Error("Evervault.js not available")); | ||
} | ||
function F(t) { | ||
const o = Promise.resolve().then(() => $(t)); | ||
function K(t) { | ||
const o = Promise.resolve().then(() => F(t)); | ||
let r = !1; | ||
@@ -723,3 +714,3 @@ return o.catch((i) => { | ||
} | ||
const ne = ({ | ||
const ie = ({ | ||
teamId: t, | ||
@@ -734,4 +725,4 @@ appId: o, | ||
const f = u.useMemo( | ||
() => new W((e, c) => { | ||
F(r == null ? void 0 : r.jsSdkUrl).then((v) => { | ||
() => new X((e, c) => { | ||
K(r == null ? void 0 : r.jsSdkUrl).then((v) => { | ||
v !== void 0 ? e(new v(t, o, r)) : (console.error("Evervault.js not available"), c("Evervault.js not available")); | ||
@@ -744,3 +735,3 @@ }).catch((v) => c(v)); | ||
}; | ||
function ie({ | ||
function ue({ | ||
onChange: t, | ||
@@ -763,3 +754,3 @@ config: o, | ||
} | ||
function ue({ | ||
function de({ | ||
request: t, | ||
@@ -787,13 +778,13 @@ config: o, | ||
export { | ||
ee as Card, | ||
ie as EvervaultInput, | ||
ne as EvervaultProvider, | ||
ue as EvervaultReveal, | ||
re as Pin, | ||
W as PromisifiedEvervaultClient, | ||
D as Reveal, | ||
te as ThreeDSecure, | ||
k as themes, | ||
re as Card, | ||
ue as EvervaultInput, | ||
ie as EvervaultProvider, | ||
de as EvervaultReveal, | ||
te as Pin, | ||
X as PromisifiedEvervaultClient, | ||
A as Reveal, | ||
oe as ThreeDSecure, | ||
ee as themes, | ||
E as useEvervault, | ||
oe as useThreeDSecure | ||
ne as useThreeDSecure | ||
}; |
{ | ||
"private": false, | ||
"name": "@evervault/react", | ||
"version": "2.15.0", | ||
"version": "2.16.0", | ||
"description": "React package for the Evervault SDK", | ||
@@ -29,14 +29,14 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/react": "^18.2.8", | ||
"@types/react-dom": "^18.2.4", | ||
"@vitejs/plugin-react": "^4.1.1", | ||
"@types/react": "^18.2.37", | ||
"@types/react-dom": "^18.2.15", | ||
"@vitejs/plugin-react": "^4.3.4", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"typescript": "5.5.4", | ||
"vite": "^4.5.5", | ||
"vite-plugin-dts": "^3.6.3", | ||
"@evervault/browser": "^2.36.0", | ||
"types": "^0.5.0", | ||
"tsconfig": "^0.0.1", | ||
"themes": "^0.1.5" | ||
"vite": "^5.4.11", | ||
"vite-plugin-dts": "^4.3.0", | ||
"themes": "^0.1.6", | ||
"tsconfig": "^0.1.0", | ||
"@evervault/browser": "^2.37.0", | ||
"types": "^0.6.0" | ||
}, | ||
@@ -43,0 +43,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
96476
2241