PageSourceSearch

https://maptools.com/assets/controllers/checkout_controller-D1sUzKW.js

js maptools.com collected 2026-10-02 06:14:11 UTC 2,644 bytes, 102 lines download raw bytes

1import {Controller} from '@hotwired/stimulus';
2import {Tooltip} from 'bootstrap';
3import debounce from 'debounce'
4
5export default class extends Controller {
6  static values = {
7    removeItemUrl: String,
8    abandonCartUrl: String,
9    updateItemQty: String,
10    shippingAddressUrl: String,
11    shippingOptionsUrl: String,
12    paymentUrl: String,
13    placeOrderUrl: String,
14    activeView: String,
15    shoppingCartUrl: String,
16    submitFormName: String,
17  };
18
19  static targets = ["targetView"];
20
21  connect() {
22  }
23
24  initialize() {
25    this.tooltips = [];
26    this.initializeTooltips(this.element);
27    this.debouncedUpdateQty = debounce(this.debouncedUpdateQty.bind(this), 600)
28  }
29
30  initializeTooltips(element) {
31    const elementsWithTooltip = element.querySelectorAll('[data-bs-toggle="tooltip"]');
32    elementsWithTooltip.forEach((element) => {
33      const tooltip = new Tooltip(element, {container: 'body'});
34      this.tooltips.push(tooltip);
35    });
36  }
37
38  submit(event) {
39    event.target.form.submit();
40  }
41
42  debouncedUpdateQty(event) {
43    const row = event.target.closest('tr');
44    row.querySelector('.checkout-item-price .spinner-border').style.display = 'flex';
45    row.querySelector('.checkout-item-total .spinner-border').style.display = 'flex';
46    document.querySelector('.checkout-basket-items-total .spinner-border').style.display = 'flex';
47    this.targetViewTarget.value = this.activeViewValue;
48    this.submit(event)
49  }
50
51  debouncedUpdateFreeQty(event) {
52    const row = event.target.closest('tr');
53    this.targetViewTarget.value = this.activeViewValue;
54    this.submit(event)
55  }
56
57  disconnect() {
58    // Dispose all tooltips on disconnect
59    this.tooltips.forEach((tooltip) => {
60      tooltip.dispose();
61    });
62    this.tooltips = [];
63  }
64
65  updateItemQty(event) {
66  }
67
68  updateFreeItemQty(event) {
69    event.preventDefault()
70  }
71
72  removeItem(event) {
73    const confirmRemove = confirm('Are you sure you want to remove this item?');
74    if (!confirmRemove) {
75      return;
76    }
77
78    const row = event.currentTarget.closest('tr');
79    row.classList.add('deleting');
80    document.querySelector('.checkout-basket-items-total .spinner-border').style.display = 'flex';
81  }
82
83  abandonCart(event) {
84    window.location.href = this.abandonCartUrlValue;
85  }
86
87  cartViewButton(event) {
88    const buttonValue = event.currentTarget.value;
89    const form = this.element.querySelector('form');
90    this.targetViewTarget.value = buttonValue;
91    form.submit();
92  }
93
94  nextButton(event) {
95    let form = this.element.querySelector('form');
96    form.submit();
97  }
98
99  placeOrderButton(event) {
100    event.preventDefault()
101  }
102}

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.