PageSourceSearch

https://gethlth.com/wp-content/themes/hlthcode/assets/js/mmp-lp-ca…?ver=0.25173200%201790918677

js gethlth.com collected 2026-10-02 05:45:55 UTC 2,586 bytes, 100 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2
3    const packs = document.querySelectorAll('.pack-select');
4    const proceedBtn = document.querySelector('.procced_plan_to_cart a');
5
6    let selectedProduct = '';
7    let selectedVariation = '';
8    let selectedAttribute = '';
9
10    // Default selected pack
11    if (packs.length > 0) {
12
13        packs[0].classList.add('product-selected');
14
15        selectedProduct   = packs[0].dataset.product_value;
16        selectedVariation = packs[0].dataset.variationId;
17        selectedAttribute = packs[0].dataset.attribute_pa_pack;
18
19    }
20
21    // Select pack
22    packs.forEach(pack => {
23
24        pack.style.cursor = 'pointer';
25
26        pack.addEventListener('click', function () {
27
28            packs.forEach(p => {
29                p.classList.remove('product-selected');
30            });
31
32            this.classList.add('product-selected');
33
34            selectedProduct   = this.dataset.product_value;
35            selectedVariation = this.dataset.variationId;
36            selectedAttribute = this.dataset.attribute_pa_pack;
37
38            console.log(selectedProduct);
39            console.log(selectedVariation);
40            console.log(selectedAttribute);
41
42        });
43
44    });
45
46    // Proceed button click
47    if (proceedBtn) {
48
49        proceedBtn.addEventListener('click', function (e) {
50
51            e.preventDefault();
52
53            if (!selectedProduct || !selectedVariation) {
54
55                alert('Please select a product');
56
57                return;
58
59            }
60
61            const formData = new FormData();
62
63            formData.append('action', 'hlth_add_subscription');
64            formData.append('product_id', selectedProduct);
65            formData.append('variants['+selectedVariation+']', 1);
66			if(selectedProduct == 718322){
67				formData.append('convert_to_sub_'+selectedProduct, '3_month');
68			}else if(selectedProduct == 718323){
69				formData.append('convert_to_sub_'+selectedProduct, '6_month');
70			}else{
71				formData.append('convert_to_sub_'+selectedProduct, '1_month');
72			}
73           
74			
75
76            fetch(wpObjq.ajaxurl, {
77                method: 'POST',
78                body: formData
79            })
80            .then(response => response.json())
81            .then(response => {
82
83                console.log(response);
84
85                // WooCommerce fragments refreshed
86                // Redirect to checkout
87                window.location.href = '/checkout/';
88
89            })
90            .catch(error => {
91
92                console.log('AJAX Error:', error);
93
94            });
95
96        });
97
98    }
99
100});

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.