PageSourceSearch

https://supertcg.com.br/wp-content/plugins/melhor-envio-cotacao/assets/js/shipping-product-page.js?ver=7.0.7

js supertcg.com.br collected 2026-10-09 22:44:48 UTC 5,448 bytes, 120 lines download raw bytes

1(function ($) {
2    'use strict';
3    $(function () {
4        toggleCalculator();
5        $(document).on('keyup', '.iptCep', function (e) {
6            jQuery('.observation-shipping-free').hide();
7            resetarTabela();
8            if ($(this).val().length === 9) {
9                var url = $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_endpoint_url').val();
10                var cep = $(this).val();
11                var id_produto = $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #id_produto').val();
12
13                if ($(e.target).is('a#cfpp_credits')) { return; }
14
15                var errors = [];
16                if (errors.length > 0) {
17                    var row = '';
18                    row = '<tr><td colspan="3">Ocorreu um erro ao obter informações sobre o valor do frete</td></tr>';
19                    errors.map(item => {
20                        row += `<tr><td colspan="3">${item}</td></tr>`;
21                        return row;
22                    });
23                    $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').append(row);
24                    esconderLoader();
25                    exibirTabela();
26                    return false;
27                }
28
29                let inpCEP = $(this);
30                inpCEP.attr('disabled', 'disabled');
31                exibirLoader();
32                esconderTabela();
33                resetarTabela();
34
35                let qty = 1;
36                let inpQty = $('.quantity .qty:visible').val();
37                if (typeof inpQty != 'undefined') {
38                    qty = inpQty;
39                }
40
41                $.ajax({
42                    url: url,
43                    type: "POST",
44                    data: {
45                        'action': 'cotation_product_page',
46                        'data': {
47                            'cep_origem': cep,
48                            'id_produto': id_produto,
49                            'quantity': qty
50                        }
51                    },
52                    error: function (jqXHR, exception) {
53                        inpCEP.removeAttr('disabled');
54                        inpCEP.val('');
55                        alert(jqXHR.responseJSON.error);
56                        esconderLoader();
57                        esconderTabela();
58                        resetarTabela();
59                        return false;
60                    },
61                    success: function (response) {
62                        $('#destiny-shipping-mehor-envio').text('Frete para ' + response.data.destination);
63                        var row = '';
64                        let  data  = response.data.quotations;
65                        data.map(item => {
66                            if (item.observations && item.observations !== 'Frete Grátis') {
67                                jQuery('.observation-shipping-free').show();
68                                jQuery('.observation-shipping-free').html(item.observations);
69                            }
70                            let name = item.name
71                            if (!item.delivery_time) {
72                                item.delivery_time = '';
73                            }
74                            row += `<tr><td>${name} ${item.delivery_time}: ${item.price}</td></tr>`;
75                        });
76
77                        if (row == '') {
78                            row = '<tr><td colspan="3">Desculpe, o cálculo de frete para este produto só está disponível no Carrinho, por favor, prossiga com a compra normalmente.</td></tr>';
79                        }
80
81                        $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').append(row);
82                        esconderLoader();
83                        exibirTabela();
84                        inpCEP.removeAttr('disabled');
85                        inpCEP.val('');
86                    }
87                });
88            }
89        })
90
91        function exibirLoader() {
92            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete').css('display', 'none');
93            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete-loader').css('display', 'flex');
94        }
95
96        function esconderLoader() {
97            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete').css('display', 'inline-block');
98            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete-loader').css('display', 'none');
99        }
100
101        function exibirTabela() {
102            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete').show();
103        }
104
105        function esconderTabela() {
106            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete').hide();
107        }
108
109        function resetarTabela() {
110            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').html('');
111            $('#destiny-shipping-mehor-envio').text('');
112        }
113
114        $(".single_variation_wrap").on("show_variation", function (event, variation) {
115            resetarTabela();
116            esconderTabela();
117            $('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_preco').val(variation.display_price.toFixed(2));
118        });
119    });
120})(jQuery);

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.