@evervault/evervault-react-native 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/components/3DS/ThreeDSecure.js +34 -0
- package/dist/commonjs/components/3DS/ThreeDSecure.js.map +1 -0
- package/dist/commonjs/components/3DS/ThreeDSecureFrame.js +45 -0
- package/dist/commonjs/components/3DS/ThreeDSecureFrame.js.map +1 -0
- package/dist/commonjs/components/3DS/config.js +9 -0
- package/dist/commonjs/components/3DS/config.js.map +1 -0
- package/dist/commonjs/components/3DS/context.js +9 -0
- package/dist/commonjs/components/3DS/context.js.map +1 -0
- package/dist/commonjs/components/3DS/index.js +20 -0
- package/dist/commonjs/components/3DS/index.js.map +1 -0
- package/dist/commonjs/components/3DS/styles.js +63 -0
- package/dist/commonjs/components/3DS/styles.js.map +1 -0
- package/dist/commonjs/components/3DS/threeDSSession.js +109 -0
- package/dist/commonjs/components/3DS/threeDSSession.js.map +1 -0
- package/dist/commonjs/components/3DS/types.js +2 -0
- package/dist/commonjs/components/3DS/types.js.map +1 -0
- package/dist/commonjs/components/3DS/useThreeDSecure.js +46 -0
- package/dist/commonjs/components/3DS/useThreeDSecure.js.map +1 -0
- package/dist/commonjs/index.js +13 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/components/3DS/ThreeDSecure.js +28 -0
- package/dist/module/components/3DS/ThreeDSecure.js.map +1 -0
- package/dist/module/components/3DS/ThreeDSecureFrame.js +36 -0
- package/dist/module/components/3DS/ThreeDSecureFrame.js.map +1 -0
- package/dist/module/components/3DS/config.js +3 -0
- package/dist/module/components/3DS/config.js.map +1 -0
- package/dist/module/components/3DS/context.js +3 -0
- package/dist/module/components/3DS/context.js.map +1 -0
- package/dist/module/components/3DS/index.js +3 -0
- package/dist/module/components/3DS/index.js.map +1 -0
- package/dist/module/components/3DS/styles.js +58 -0
- package/dist/module/components/3DS/styles.js.map +1 -0
- package/dist/module/components/3DS/threeDSSession.js +100 -0
- package/dist/module/components/3DS/threeDSSession.js.map +1 -0
- package/dist/module/components/3DS/types.js +2 -0
- package/dist/module/components/3DS/types.js.map +1 -0
- package/dist/module/components/3DS/useThreeDSecure.js +40 -0
- package/dist/module/components/3DS/useThreeDSecure.js.map +1 -0
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/typescript/src/components/3DS/ThreeDSecure.d.ts +8 -0
- package/dist/typescript/src/components/3DS/ThreeDSecure.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/ThreeDSecureFrame.d.ts +3 -0
- package/dist/typescript/src/components/3DS/ThreeDSecureFrame.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/config.d.ts +3 -0
- package/dist/typescript/src/components/3DS/config.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/context.d.ts +4 -0
- package/dist/typescript/src/components/3DS/context.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/index.d.ts +3 -0
- package/dist/typescript/src/components/3DS/index.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/styles.d.ts +57 -0
- package/dist/typescript/src/components/3DS/styles.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/threeDSSession.d.ts +10 -0
- package/dist/typescript/src/components/3DS/threeDSSession.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/types.d.ts +42 -0
- package/dist/typescript/src/components/3DS/types.d.ts.map +1 -0
- package/dist/typescript/src/components/3DS/useThreeDSecure.d.ts +3 -0
- package/dist/typescript/src/components/3DS/useThreeDSecure.d.ts.map +1 -0
- package/dist/typescript/src/components/Card/types.d.ts +1 -1
- package/dist/typescript/src/components/Card/types.d.ts.map +1 -1
- package/dist/typescript/src/index.d.ts +1 -0
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/components/3DS/ThreeDSecure.tsx +32 -0
- package/src/components/3DS/ThreeDSecureFrame.tsx +39 -0
- package/src/components/3DS/config.ts +2 -0
- package/src/components/3DS/context.tsx +4 -0
- package/src/components/3DS/index.ts +2 -0
- package/src/components/3DS/styles.tsx +63 -0
- package/src/components/3DS/threeDSSession.ts +132 -0
- package/src/components/3DS/types.ts +46 -0
- package/src/components/3DS/useThreeDSecure.tsx +51 -0
- package/src/components/Card/types.ts +2 -1
- package/src/index.tsx +1 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { EV_API_DOMAIN } from "./config";
|
|
2
|
+
const stopPolling = (intervalRef, setIsVisible) => {
|
|
3
|
+
setIsVisible(false);
|
|
4
|
+
clearInterval(intervalRef.current);
|
|
5
|
+
intervalRef.current = null;
|
|
6
|
+
};
|
|
7
|
+
export const startSession = async (session, callbacks, intervalRef, setIsVisible) => {
|
|
8
|
+
try {
|
|
9
|
+
const sessionState = await session.get();
|
|
10
|
+
switch (sessionState.status) {
|
|
11
|
+
case "success":
|
|
12
|
+
stopPolling(intervalRef, setIsVisible);
|
|
13
|
+
callbacks.onSuccess();
|
|
14
|
+
break;
|
|
15
|
+
case "failure":
|
|
16
|
+
stopPolling(intervalRef, setIsVisible);
|
|
17
|
+
callbacks.onFailure(new Error("3DS session failed"));
|
|
18
|
+
break;
|
|
19
|
+
case "action-required":
|
|
20
|
+
setIsVisible(true);
|
|
21
|
+
pollSession(session, callbacks, intervalRef, setIsVisible);
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error("Error checking session state", error);
|
|
28
|
+
callbacks.onError(new Error("Failed to check 3DS session state"));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export const pollSession = (session, callbacks, intervalRef, setIsVisible, interval = 3000) => {
|
|
32
|
+
intervalRef.current = setInterval(async () => {
|
|
33
|
+
try {
|
|
34
|
+
const pollResponse = await session.get();
|
|
35
|
+
if (pollResponse.status === "success") {
|
|
36
|
+
stopPolling(intervalRef, setIsVisible);
|
|
37
|
+
callbacks.onSuccess();
|
|
38
|
+
} else if (pollResponse.status === "failure") {
|
|
39
|
+
stopPolling(intervalRef, setIsVisible);
|
|
40
|
+
callbacks.onFailure(new Error("3DS session failed"));
|
|
41
|
+
} else {
|
|
42
|
+
setIsVisible(true);
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
stopPolling(intervalRef, setIsVisible);
|
|
46
|
+
console.error("Error polling session", error);
|
|
47
|
+
callbacks.onError(new Error("Error polling 3DS session"));
|
|
48
|
+
}
|
|
49
|
+
}, interval);
|
|
50
|
+
};
|
|
51
|
+
export function threeDSecureSession({
|
|
52
|
+
sessionId,
|
|
53
|
+
appId,
|
|
54
|
+
callbacks,
|
|
55
|
+
intervalRef,
|
|
56
|
+
setIsVisible
|
|
57
|
+
}) {
|
|
58
|
+
const get = async () => {
|
|
59
|
+
try {
|
|
60
|
+
const response = await fetch(`https://${EV_API_DOMAIN}/frontend/3ds/browser-sessions/${sessionId}`, {
|
|
61
|
+
headers: {
|
|
62
|
+
"x-evervault-app-id": appId
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const result = await response.json();
|
|
66
|
+
return result;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Error fetching 3DS session status", error);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const cancel = async () => {
|
|
73
|
+
try {
|
|
74
|
+
await fetch(`https://${EV_API_DOMAIN}/frontend/3ds/browser-sessions/${sessionId}`, {
|
|
75
|
+
method: "PATCH",
|
|
76
|
+
headers: {
|
|
77
|
+
"Content-Type": "application/json",
|
|
78
|
+
"x-evervault-app-id": appId
|
|
79
|
+
},
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
outcome: "cancelled"
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
callbacks.onFailure(new Error("3DS session cancelled by user"));
|
|
85
|
+
setIsVisible(false);
|
|
86
|
+
if (intervalRef.current) {
|
|
87
|
+
clearInterval(intervalRef.current);
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error("Error cancelling 3DS session", error);
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
sessionId,
|
|
96
|
+
get,
|
|
97
|
+
cancel
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=threeDSSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EV_API_DOMAIN","stopPolling","intervalRef","setIsVisible","clearInterval","current","startSession","session","callbacks","sessionState","get","status","onSuccess","onFailure","Error","pollSession","error","console","onError","interval","setInterval","pollResponse","threeDSecureSession","sessionId","appId","response","fetch","headers","result","json","cancel","method","body","JSON","stringify","outcome"],"sourceRoot":"../../../../src","sources":["components/3DS/threeDSSession.ts"],"mappings":"AAMA,SAASA,aAAa,QAAQ,UAAU;AAExC,MAAMC,WAAW,GAAGA,CAClBC,WAA0D,EAC1DC,YAAqC,KAClC;EACHA,YAAY,CAAC,KAAK,CAAC;EACnBC,aAAa,CAACF,WAAW,CAACG,OAAQ,CAAC;EACnCH,WAAW,CAACG,OAAO,GAAG,IAAI;AAC5B,CAAC;AAED,OAAO,MAAMC,YAAY,GAAG,MAAAA,CAC1BC,OAA4B,EAC5BC,SAAgC,EAChCN,WAA0D,EAC1DC,YAAqC,KAClC;EACH,IAAI;IACF,MAAMM,YAAY,GAAG,MAAMF,OAAO,CAACG,GAAG,CAAC,CAAC;IAExC,QAAQD,YAAY,CAACE,MAAM;MACzB,KAAK,SAAS;QACZV,WAAW,CAACC,WAAW,EAAEC,YAAY,CAAC;QACtCK,SAAS,CAACI,SAAS,CAAC,CAAC;QACrB;MACF,KAAK,SAAS;QACZX,WAAW,CAACC,WAAW,EAAEC,YAAY,CAAC;QACtCK,SAAS,CAACK,SAAS,CAAC,IAAIC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpD;MACF,KAAK,iBAAiB;QACpBX,YAAY,CAAC,IAAI,CA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":["components/3DS/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { useEvervault } from "../EvervaultProvider";
|
|
4
|
+
import { startSession, threeDSecureSession } from "./threeDSSession";
|
|
5
|
+
export const useThreeDSecure = () => {
|
|
6
|
+
const {
|
|
7
|
+
appUuid
|
|
8
|
+
} = useEvervault();
|
|
9
|
+
const intervalRef = useRef(null);
|
|
10
|
+
const [session, setSession] = useState(null);
|
|
11
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
12
|
+
if (!appUuid) {
|
|
13
|
+
throw new Error("useThreeDSecure must be used within an Evervault Provider");
|
|
14
|
+
}
|
|
15
|
+
const start = (sessionId, callbacks) => {
|
|
16
|
+
const session = threeDSecureSession({
|
|
17
|
+
sessionId,
|
|
18
|
+
appId: appUuid,
|
|
19
|
+
callbacks,
|
|
20
|
+
intervalRef,
|
|
21
|
+
setIsVisible
|
|
22
|
+
});
|
|
23
|
+
setSession(session);
|
|
24
|
+
startSession(session, callbacks, intervalRef, setIsVisible);
|
|
25
|
+
};
|
|
26
|
+
const cancel = async () => {
|
|
27
|
+
if (session) {
|
|
28
|
+
await session.cancel();
|
|
29
|
+
} else {
|
|
30
|
+
console.warn("No 3DS session to cancel");
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
start,
|
|
35
|
+
cancel,
|
|
36
|
+
session,
|
|
37
|
+
isVisible: isVisible
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=useThreeDSecure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","useRef","useEvervault","startSession","threeDSecureSession","useThreeDSecure","appUuid","intervalRef","session","setSession","isVisible","setIsVisible","Error","start","sessionId","callbacks","appId","cancel","console","warn"],"sourceRoot":"../../../../src","sources":["components/3DS/useThreeDSecure.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,MAAM,QAAQ,OAAO;AAC9B,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,kBAAkB;AAOpE,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAyB;EACtD,MAAM;IAAEC;EAAQ,CAAC,GAAGJ,YAAY,CAAC,CAAC;EAClC,MAAMK,WAAW,GAAGN,MAAM,CAAwB,IAAI,CAAC;EACvD,MAAM,CAACO,OAAO,EAAEC,UAAU,CAAC,GAAGT,QAAQ,CAA6B,IAAI,CAAC;EACxE,MAAM,CAACU,SAAS,EAAEC,YAAY,CAAC,GAAGX,QAAQ,CAAC,KAAK,CAAC;EAEjD,IAAI,CAACM,OAAO,EAAE;IACZ,MAAM,IAAIM,KAAK,CACb,2DACF,CAAC;EACH;EAEA,MAAMC,KAAK,GAAGA,CAACC,SAAiB,EAAEC,SAAgC,KAAK;IACrE,MAAMP,OAAO,GAAGJ,mBAAmB,CAAC;MAClCU,SAAS;MACTE,KAAK,EAAEV,OAAO;MACdS,SAAS;MACTR,WAAW;MACXI;IACF,CAAC,CAAC;IAEFF,UAAU,CAACD,OAAO,CAAC;IAEnBL,YAAY,CAACK,OAAO,EAAEO,SAAS,EAAER,WAAW,EAAEI,YAAY,CAAC;EAC7D,CAAC;EAED,MAAMM,MAAM,GAAG,MAAAA,CAAA,KAAY;IACzB,IAAIT,OAAO,EAAE;MACX,MAAMA,OAAO,CAACS,MAAM,CAAC,CAAC;IACxB,CAAC,MAAM;MACLC,OAAO,CAACC,IAAI,CAAC,0BAA0B,CAAC;IAC1C;EACF,CAAC;EAED,OAAO;IACLN,KAAK;IACLI,MAAM;IACNT,OAAO;IACPE,SAAS,EAAEA;EACb,CAAC;AACH,CAAC","ignoreList":[]}
|
package/dist/module/index.js
CHANGED
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Card","init","encrypt","default","EvervaultProvider"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAAyBA,IAAI,QAAQ,mBAAmB;AACxD,SAASC,IAAI,EAAEC,OAAO,QAAQ,OAAO;AASrC,SAASC,OAAO,IAAIC,iBAAiB,QAAQ,gCAAgC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Card","ThreeDSecure","useThreeDSecure","init","encrypt","default","EvervaultProvider"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAAyBA,IAAI,QAAQ,mBAAmB;AACxD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,IAAI,EAAEC,OAAO,QAAQ,OAAO;AASrC,SAASC,OAAO,IAAIC,iBAAiB,QAAQ,gCAAgC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ThreeDSecureProviderProps } from "./types";
|
|
3
|
+
import { ThreeDSecureFrame } from "./ThreeDSecureFrame";
|
|
4
|
+
declare const ThreeDSecureNamespace: (({ state, children }: ThreeDSecureProviderProps) => React.JSX.Element | null) & {
|
|
5
|
+
Frame: typeof ThreeDSecureFrame;
|
|
6
|
+
};
|
|
7
|
+
export { ThreeDSecureNamespace as ThreeDSecure };
|
|
8
|
+
//# sourceMappingURL=ThreeDSecure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeDSecure.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/ThreeDSecure.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAwBxD,QAAA,MAAM,qBAAqB,yBApBgB,yBAAyB;;CAsBlE,CAAC;AAEH,OAAO,EAAE,qBAAqB,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeDSecureFrame.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/ThreeDSecureFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAQpD,wBAAgB,iBAAiB,6BA8BhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,QAAmD,CAAC;AAC9E,eAAO,MAAM,oBAAoB,QAA0D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/context.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,mBAAmB,mDAAgD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare const defaultModalStyles: {
|
|
2
|
+
modalContainer: {
|
|
3
|
+
flex: number;
|
|
4
|
+
justifyContent: "flex-end";
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
};
|
|
7
|
+
modalContent: {
|
|
8
|
+
width: "100%";
|
|
9
|
+
height: "95%";
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
padding: number;
|
|
12
|
+
justifyContent: "flex-start";
|
|
13
|
+
borderTopLeftRadius: number;
|
|
14
|
+
borderTopRightRadius: number;
|
|
15
|
+
};
|
|
16
|
+
titleBar: {
|
|
17
|
+
justifyContent: "center";
|
|
18
|
+
alignItems: "center";
|
|
19
|
+
padding: number;
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
borderBottomWidth: number;
|
|
22
|
+
borderBottomColor: string;
|
|
23
|
+
position: "relative";
|
|
24
|
+
width: "100%";
|
|
25
|
+
borderTopLeftRadius: number;
|
|
26
|
+
borderTopRightRadius: number;
|
|
27
|
+
};
|
|
28
|
+
titleText: {
|
|
29
|
+
fontSize: number;
|
|
30
|
+
fontWeight: "bold";
|
|
31
|
+
};
|
|
32
|
+
closeButton: {
|
|
33
|
+
position: "absolute";
|
|
34
|
+
left: number;
|
|
35
|
+
padding: number;
|
|
36
|
+
};
|
|
37
|
+
closeButtonText: {
|
|
38
|
+
fontSize: number;
|
|
39
|
+
fontWeight: "bold";
|
|
40
|
+
color: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
declare const defaultThreeDSecureFrameStyles: {
|
|
44
|
+
threeDSFrame: {
|
|
45
|
+
flex: number;
|
|
46
|
+
};
|
|
47
|
+
webView: {
|
|
48
|
+
flex: number;
|
|
49
|
+
};
|
|
50
|
+
spinnerOverlay: {
|
|
51
|
+
flex: number;
|
|
52
|
+
justifyContent: "center";
|
|
53
|
+
alignItems: "center";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export { defaultModalStyles, defaultThreeDSecureFrameStyles };
|
|
57
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/styles.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCtB,CAAC;AAEH,QAAA,MAAM,8BAA8B;;;;;;;;;;;;CAYlC,CAAC;AAEH,OAAO,EACH,kBAAkB,EAClB,8BAA8B,EACjC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
/// <reference types="node" />
|
|
6
|
+
import { ThreeDSecureCallbacks, ThreeDSecureSessionsParams, ThreeDSecureSession } from "./types";
|
|
7
|
+
export declare const startSession: (session: ThreeDSecureSession, callbacks: ThreeDSecureCallbacks, intervalRef: React.MutableRefObject<NodeJS.Timeout | null>, setIsVisible: (show: boolean) => void) => Promise<void>;
|
|
8
|
+
export declare const pollSession: (session: ThreeDSecureSession, callbacks: ThreeDSecureCallbacks, intervalRef: React.MutableRefObject<NodeJS.Timeout | null>, setIsVisible: (show: boolean) => void, interval?: number) => void;
|
|
9
|
+
export declare function threeDSecureSession({ sessionId, appId, callbacks, intervalRef, setIsVisible, }: ThreeDSecureSessionsParams): ThreeDSecureSession;
|
|
10
|
+
//# sourceMappingURL=threeDSSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threeDSSession.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/threeDSSession.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAYjB,eAAO,MAAM,YAAY,YACd,mBAAmB,aACjB,qBAAqB,eACnB,MAAM,gBAAgB,CAAC,OAAO,OAAO,GAAG,IAAI,CAAC,gBAC5C,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,kBAyBtC,CAAC;AAEF,eAAO,MAAM,WAAW,YACb,mBAAmB,aACjB,qBAAqB,eACnB,MAAM,gBAAgB,CAAC,OAAO,OAAO,GAAG,IAAI,CAAC,gBAC5C,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,aAC3B,MAAM,SAoBjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,KAAK,EACL,SAAS,EACT,WAAW,EACX,YAAY,GACb,EAAE,0BAA0B,GAAG,mBAAmB,CAkDlD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export interface ThreeDSecureCallbacks {
|
|
4
|
+
onError: (error: Error) => void;
|
|
5
|
+
onFailure: (error: Error) => void;
|
|
6
|
+
onSuccess: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface ThreeDSecureInitialState {
|
|
9
|
+
session: ThreeDSecureSession | null;
|
|
10
|
+
isVisible: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ThreeDSecureProviderProps {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
state: ThreeDSecureState;
|
|
15
|
+
}
|
|
16
|
+
export interface ThreeDSecureSession {
|
|
17
|
+
cancel: () => Promise<void>;
|
|
18
|
+
get: () => Promise<ThreeDSecureSessionResponse>;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ThreeDSecureSessionResponse {
|
|
22
|
+
nextAction: {
|
|
23
|
+
creq?: string;
|
|
24
|
+
type: string;
|
|
25
|
+
url?: string;
|
|
26
|
+
};
|
|
27
|
+
status: SessionStatus;
|
|
28
|
+
}
|
|
29
|
+
export interface ThreeDSecureSessionsParams {
|
|
30
|
+
appId: string;
|
|
31
|
+
callbacks: ThreeDSecureCallbacks;
|
|
32
|
+
intervalRef: React.MutableRefObject<NodeJS.Timeout | null>;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
setIsVisible: (show: boolean) => void;
|
|
35
|
+
}
|
|
36
|
+
export interface ThreeDSecureState extends ThreeDSecureInitialState {
|
|
37
|
+
cancel: () => Promise<void>;
|
|
38
|
+
start: (sessionId: string, callbacks: ThreeDSecureCallbacks) => void;
|
|
39
|
+
}
|
|
40
|
+
type SessionStatus = "action-required" | "failure" | "success";
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../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KAAK,IAAI,CAAC;CACtE;AAED,KAAK,aAAa,GAAG,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThreeDSecure.d.ts","sourceRoot":"","sources":["../../../../../src/components/3DS/useThreeDSecure.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,eAAe,QAAO,iBAwClC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CardBrandName = "american-express" | "visa" | "mastercard" | "discover" | "jcb" | "diners-club" | "unionpay" | "maestro" | "mir" | "elo" | "hipercard" | "hiper" | "szep";
|
|
1
|
+
export type CardBrandName = "american-express" | "visa" | "mastercard" | "discover" | "jcb" | "diners-club" | "unionpay" | "maestro" | "mir" | "elo" | "hipercard" | "hiper" | "szep" | "uatp";
|
|
2
2
|
export interface CardConfig {
|
|
3
3
|
acceptedBrands?: CardBrandName[];
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,kBAAkB,GAClB,MAAM,GACN,YAAY,GACZ,UAAU,GACV,KAAK,GACL,aAAa,GACb,UAAU,GACV,SAAS,GACT,KAAK,GACL,KAAK,GACL,WAAW,GACX,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,EAAE,UAAU,CAAC;QACnB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,kBAAkB,GAClB,MAAM,GACN,YAAY,GACZ,UAAU,GACV,KAAK,GACL,aAAa,GACb,UAAU,GACV,SAAS,GACT,KAAK,GACL,KAAK,GACL,WAAW,GACX,OAAO,GACP,MAAM,GACN,MAAM,CAAC;AAEX,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,EAAE,UAAU,CAAC;QACnB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { type CardProps, Card } from "./components/Card";
|
|
2
|
+
export { ThreeDSecure, useThreeDSecure } from "./components/3DS";
|
|
2
3
|
export { init, encrypt } from "./sdk";
|
|
3
4
|
export type { CardPayload, CardExpiry, CardBrandName, CardConfig, CardForm, CardField, } from "./components/Card/types";
|
|
4
5
|
export { default as EvervaultProvider } from "./components/EvervaultProvider";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACtC,YAAY,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,UAAU,EACV,QAAQ,EACR,SAAS,GACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACtC,YAAY,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,UAAU,EACV,QAAQ,EACR,SAAS,GACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evervault/evervault-react-native",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Evervault react native sdk",
|
|
5
5
|
"main": "./dist/commonjs/index.js",
|
|
6
6
|
"module": "./dist/module/index.js",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"nodemon": "^3.1.4",
|
|
49
49
|
"react-native-masked-text": "^1.13.0",
|
|
50
|
-
"
|
|
50
|
+
"react-native-webview": "^13.12.0",
|
|
51
|
+
"@evervault/card-validator": "1.1.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@commitlint/config-conventional": "^17.0.2",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { createContext, useContext } from "react";
|
|
2
|
+
import { ThreeDSecureProviderProps } from "./types";
|
|
3
|
+
import { useEvervault } from "../EvervaultProvider";
|
|
4
|
+
import { ThreeDSecureFrame } from "./ThreeDSecureFrame";
|
|
5
|
+
import { ThreeDSecureContext } from "./context";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const ThreeDSecure = ({ state, children }: ThreeDSecureProviderProps) => {
|
|
9
|
+
const { appUuid } = useEvervault();
|
|
10
|
+
|
|
11
|
+
if (!appUuid) {
|
|
12
|
+
throw new Error("ThreeDSecure must be used within an Evervault Provider");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { session, isVisible } = state;
|
|
16
|
+
|
|
17
|
+
if (!session) return null;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<ThreeDSecureContext.Provider value={state}>
|
|
21
|
+
{isVisible && children}
|
|
22
|
+
</ThreeDSecureContext.Provider>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const ThreeDSecureNamespace = Object.assign(ThreeDSecure, {
|
|
29
|
+
Frame: ThreeDSecureFrame
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { ThreeDSecureNamespace as ThreeDSecure };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useContext, useState } from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { useEvervault } from "../EvervaultProvider";
|
|
4
|
+
import WebView from "react-native-webview";
|
|
5
|
+
import { CHALLENGE_DOMAIN_3DS } from "./config";
|
|
6
|
+
import { defaultThreeDSecureFrameStyles as defaultStyles } from "./styles";
|
|
7
|
+
import { ThreeDSecureContext } from "./context";
|
|
8
|
+
|
|
9
|
+
export function ThreeDSecureFrame() {
|
|
10
|
+
const { teamUuid, appUuid } = useEvervault();
|
|
11
|
+
const context = useContext(ThreeDSecureContext);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if (!teamUuid || !appUuid) {
|
|
15
|
+
throw new Error('Missing Evervault Team or App Uuid. Make sure the ThreeDSecureFrame is nested within the Evervault Provider');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!context) {
|
|
19
|
+
throw new Error("ThreeDSecure.Frame must be used within an Evervault ThreeDSecure provider component");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { session } = context;
|
|
23
|
+
|
|
24
|
+
if (!session) {
|
|
25
|
+
return null; // 3DS Session not started yet
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View style={defaultStyles.threeDSFrame}>
|
|
30
|
+
<WebView
|
|
31
|
+
source={{
|
|
32
|
+
uri: `https://${CHALLENGE_DOMAIN_3DS}/?session=${session.sessionId}&app=${appUuid}&team=${teamUuid}`,
|
|
33
|
+
}}
|
|
34
|
+
containerStyle={defaultStyles.webView}
|
|
35
|
+
overScrollMode="content"
|
|
36
|
+
/>
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const defaultModalStyles = StyleSheet.create({
|
|
4
|
+
modalContainer: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
justifyContent: "flex-end",
|
|
7
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
8
|
+
},
|
|
9
|
+
modalContent: {
|
|
10
|
+
width: "100%",
|
|
11
|
+
height: "95%",
|
|
12
|
+
backgroundColor: "#fff",
|
|
13
|
+
padding: 0,
|
|
14
|
+
justifyContent: "flex-start",
|
|
15
|
+
borderTopLeftRadius: 20,
|
|
16
|
+
borderTopRightRadius: 20,
|
|
17
|
+
},
|
|
18
|
+
titleBar: {
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
padding: 10,
|
|
22
|
+
backgroundColor: "#f5f5f5",
|
|
23
|
+
borderBottomWidth: 1,
|
|
24
|
+
borderBottomColor: "#ccc",
|
|
25
|
+
position: "relative",
|
|
26
|
+
width: "100%",
|
|
27
|
+
borderTopLeftRadius: 20,
|
|
28
|
+
borderTopRightRadius: 20,
|
|
29
|
+
},
|
|
30
|
+
titleText: {
|
|
31
|
+
fontSize: 18,
|
|
32
|
+
fontWeight: "bold",
|
|
33
|
+
},
|
|
34
|
+
closeButton: {
|
|
35
|
+
position: "absolute",
|
|
36
|
+
left: 10,
|
|
37
|
+
padding: 10,
|
|
38
|
+
},
|
|
39
|
+
closeButtonText: {
|
|
40
|
+
fontSize: 18,
|
|
41
|
+
fontWeight: "bold",
|
|
42
|
+
color: "black",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const defaultThreeDSecureFrameStyles = StyleSheet.create({
|
|
47
|
+
threeDSFrame: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
},
|
|
50
|
+
webView: {
|
|
51
|
+
flex: 1,
|
|
52
|
+
},
|
|
53
|
+
spinnerOverlay: {
|
|
54
|
+
flex: 1,
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
defaultModalStyles,
|
|
62
|
+
defaultThreeDSecureFrameStyles
|
|
63
|
+
}
|