PageSourceSearch

https://sniker.es/assets/store/controllers/sequra_controller

js sniker.es collected 2026-10-09 03:08:14 UTC 2,644 bytes, 86 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2
3export default class extends Controller {
4    static targets = ['wait','form','error']
5
6    static values = {
7        url: String
8    }
9
10    connect(){
11        
12    }
13
14    paymentButtonTrigger(event){
15        const wait = this.waitTarget
16        wait.style.display = 'block'
17        const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
18
19        //observaciones
20        const formData = new FormData();
21        formData.append('observations', document.getElementById('observations').value)
22        //--------
23
24        fetch(this.urlValue, {
25            method: "POST",
26            headers: {
27                'X-CSRF-Token': csrfToken
28            },
29            body: formData //para actualizar observaciones del carrito
30        })
31        .then(response =>{
32            return response.text()
33        })
34        .then(html => {
35            const formTarget = this.formTarget
36            formTarget.innerHTML = html;
37
38            const scripts = formTarget.querySelectorAll("script");
39            scripts.forEach(script => {
40                const newScript = document.createElement("script");
41                if (script.src) {
42                    newScript.src = script.src; 
43                } else {
44                    newScript.textContent = script.textContent; 
45                }
46                document.body.appendChild(newScript); 
47                script.remove(); 
48            });
49
50            this.waitForSequra(() => {
51                wait.style.display = "none"
52                window.SequraFormInstance.show()
53                // document.querySelector("body").style.overflowY = "hidden"
54            })
55        })
56        .catch(error =>{
57            this.errorTarget.classList.remove('d-none')
58            wait.style.display = 'none'
59        })
60          
61        // setTimeout(()=> {
62        //     wait.style.display = 'none'
63        //     window.SequraFormInstance.show();
64        //     //document.querySelector('body').style.overflowY = 'hidden'
65        // }, 2500);
66
67    }
68
69    waitForSequra(callback, timeout = 10000) {
70        const start = Date.now()
71        const interval = setInterval(() => {
72        if (
73            window.SequraFormInstance &&
74            typeof window.SequraFormInstance.show === "function"
75        ) {
76            clearInterval(interval)
77            callback()
78        } else if (Date.now() - start > timeout) {
79            clearInterval(interval)
80            console.error("SequraFormInstance no se inicializó a tiempo")
81            this.waitTarget.style.display = "none"
82        }
83        }, 200)
84    }
85
86};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.