payment-token-efi 3.1.1 → 3.2.0
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/CHANGELOG.md +8 -0
- package/README.md +41 -9
- package/dist/payment-token-efi-cjs.min.js +2 -2
- package/dist/payment-token-efi-esm.min.js +2 -2
- package/dist/payment-token-efi-umd.min.js +2 -2
- package/dist/payment-token-efi.min.js +2 -2
- package/examples/app-angular.ts +22 -4
- package/examples/app-browser.html +11 -0
- package/examples/app-react.js +17 -2
- package/examples/app-react.tsx +16 -1
- package/examples/app-vue.vue +16 -1
- package/examples/webview-react-native.js +21 -0
- package/index.html +13 -0
- package/package.json +1 -1
package/examples/app-react.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useEffect } from "react"; // Added useEffect
|
|
2
2
|
import "./App.css";
|
|
3
3
|
import EfiPay from "../dist/payment-token-efi-esm.min.js";
|
|
4
4
|
|
|
@@ -7,6 +7,21 @@ const App: React.FC = () => {
|
|
|
7
7
|
const [cardMask, setCardMask] = useState<string>("");
|
|
8
8
|
const [loading, setLoading] = useState<boolean>(false);
|
|
9
9
|
|
|
10
|
+
// Add checkScriptBlocking function and call it on component mount
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
async function checkScriptBlocking() {
|
|
13
|
+
const isBlocked = await EfiPay.CreditCard.isScriptBlocked();
|
|
14
|
+
|
|
15
|
+
if (isBlocked) {
|
|
16
|
+
console.log("O script de fingerprint está bloqueado.");
|
|
17
|
+
alert("O script que gera o payment_token está bloqueado. Verifique seu navegador ou extensão. ");
|
|
18
|
+
} else {
|
|
19
|
+
console.log("O script de fingerprint não está bloqueado.");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
checkScriptBlocking();
|
|
23
|
+
}, []); // Empty dependency array ensures it runs once on mount
|
|
24
|
+
|
|
10
25
|
const runEfiJsCode = async () => {
|
|
11
26
|
setLoading(true);
|
|
12
27
|
|
package/examples/app-vue.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import { ref } from 'vue';
|
|
14
|
+
import { ref, onMounted } from 'vue';
|
|
15
15
|
import EfiPay from '../dist/payment-token-efi-umd.min.js';
|
|
16
16
|
|
|
17
17
|
export default {
|
|
@@ -21,6 +21,21 @@ export default {
|
|
|
21
21
|
const cardMask = ref('');
|
|
22
22
|
const loading = ref(false);
|
|
23
23
|
|
|
24
|
+
const checkScriptBlocking = async () => {
|
|
25
|
+
const isBlocked = await EfiPay.CreditCard.isScriptBlocked();
|
|
26
|
+
|
|
27
|
+
if (isBlocked) {
|
|
28
|
+
console.log("O script de fingerprint está bloqueado.");
|
|
29
|
+
alert(
|
|
30
|
+
"O script que gera o payment_token está bloqueado. Verifique seu navegador ou extensão. "
|
|
31
|
+
);
|
|
32
|
+
} else {
|
|
33
|
+
console.log("O script de fingerprint não está bloqueado.");
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
onMounted(checkScriptBlocking);
|
|
38
|
+
|
|
24
39
|
const runEfiJsCode = async () => {
|
|
25
40
|
loading.value = true;
|
|
26
41
|
|
|
@@ -16,6 +16,27 @@ const PaymentScreen = () => {
|
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<script>
|
|
19
|
+
async function checkScriptBlocking() {
|
|
20
|
+
const isBlocked = await EfiPay.CreditCard.isScriptBlocked();
|
|
21
|
+
if (isBlocked) {
|
|
22
|
+
console.log("O script de fingerprint está bloqueado.");
|
|
23
|
+
window.ReactNativeWebView.postMessage(
|
|
24
|
+
JSON.stringify({
|
|
25
|
+
error: {
|
|
26
|
+
code: "script_blocked",
|
|
27
|
+
name: "erro_script_bloqueado",
|
|
28
|
+
message:
|
|
29
|
+
"O script que gera o payment_token está bloqueado. Verifique seu navegador ou extensão.",
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
console.log("O script de fingerprint não está bloqueado.");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
checkScriptBlocking();
|
|
39
|
+
|
|
19
40
|
async function generateToken(data) {
|
|
20
41
|
try {
|
|
21
42
|
const result = await EfiPay.CreditCard
|
package/index.html
CHANGED
|
@@ -16,6 +16,19 @@
|
|
|
16
16
|
|
|
17
17
|
<script>
|
|
18
18
|
document.addEventListener('DOMContentLoaded', () => { // Aguarda o carregamento da página para iniciar os scripts
|
|
19
|
+
// Valida se o script de fingerprint está bloqueado
|
|
20
|
+
async function checkScriptBlocking() {
|
|
21
|
+
const isBlocked = await EfiPay.CreditCard.isScriptBlocked();
|
|
22
|
+
|
|
23
|
+
if (isBlocked) {
|
|
24
|
+
console.log("O script de fingerprint está bloqueado.");
|
|
25
|
+
alert("O script que gera o payment_token está bloqueado. Verifique seu navegador ou extensão. ")
|
|
26
|
+
} else {
|
|
27
|
+
console.log("O script de fingerprint não está bloqueado.");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
checkScriptBlocking();
|
|
31
|
+
|
|
19
32
|
// Configuração
|
|
20
33
|
var inputIdentificadorConta = document.getElementById("identificadorConta");
|
|
21
34
|
var inputValorTotal = document.getElementById("valorTotal");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-token-efi",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Módulo Javascript que permite a criptografia dos dados do cartão do cartão a partir do browser do cliente para gerar o payment_token e identificar a bandeira do cartão.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"API",
|