PageSourceSearch

https://muffingroup.com/betheme/assets/js/pricing.js

js muffingroup.com collected 2026-10-02 02:19:10 UTC 7,950 bytes, 339 lines download raw bytes

1/* jshint esversion: 6 */
2
3(function($) {
4
5  /* globals jQuery, mfn, Paddle */
6
7  "use strict";
8
9  var paddle = {
10    sandbox : false,
11    token : 'live_6b6b826d900efe6c26810cac91f',
12    discount : 'dsc_01kz3f60er6qk2d4vn6jw1v6y5', // add to each button
13  };
14
15  var prices = [
16
17    {
18      // 1 site
19      "priceId": "pri_01kvq3jmgb56ae72tymx85eqx9",
20      "quantity": 1
21    },
22    {
23      // 3 sites
24      "priceId": "pri_01kvq3xx987h91197yk8vb1mwj",
25      "quantity": 1
26    },
27    {
28      // 3+1 promo
29      "priceId": "pri_01kvq6rqqxnzh20xrmeas36026",
30      "quantity": 1
31    },
32    {
33      // 25 sites
34      "priceId": "pri_01kvq47kxrqjatfzzq3nj0gh8h",
35      "quantity": 1
36    },
37    {
38      // unlimited sites
39      "priceId": "pri_01kvq538hvxe3tfgwnd183vwh7",
40      "quantity": 1
41    },
42
43    // Betheme One-time
44
45    {
46      // 1 lifetime
47      "priceId": "pri_01kwem258an7tmk59vjv0q0n9g",
48      "quantity": 1
49    },
50    
51    // AI credits
52
53    {
54      // Starter
55      "priceId": "pri_01m3kyehaveas8t3jckkwj0n57",
56      "quantity": 1
57    },
58    {
59      // Pro
60      "priceId": "pri_01m3kzgck4sqy4hkh5nh86rqez",
61      "quantity": 1
62    },
63    {
64      // Max
65      "priceId": "pri_01m3kzzrc0bqp2sp50knxp75fc",
66      "quantity": 1
67    },
68
69    // AI extension
70
71    {
72      // Extension
73      "priceId": "pri_01m3kwxavf4qp8sg5qyd507exs",
74      "quantity": 1
75    },
76
77  ];
78
79  /**
80   * Setup
81   */
82
83  function setup(){
84
85    // sandbox
86    if( paddle.sandbox ){
87      Paddle.Environment.set("sandbox");
88    }
89
90    Paddle.Setup({
91      token: paddle.token,
92      eventCallback: function(data) {
93        if( data.name == "checkout.completed" ){
94          console.log(data);
95        }
96      },
97    });
98
99  }
100
101  /**
102   * Get prices
103   */
104
105  function getPrices(){
106
107    var request = {
108      items: prices,
109      customerIpAddress: mfn.ip,
110    };
111
112    if( paddle.discount ){
113      request.discountId = paddle.discount;
114    }
115
116    Paddle.PricePreview(request)
117      .then((result) => {
118        // console.log(result);
119
120        var currency = result.data.currencyCode;
121        var items = result.data.details.lineItems;
122        var item;
123        var currencyClass;
124
125        if( 'USD' === currency ){
126          currency = '$';
127          currencyClass = 'symbol';
128        } else if( 'EUR' === currency ){
129          currency = '€';
130          currencyClass = 'symbol';
131        } else {
132          currency += ' ' ;
133          currencyClass = '';
134        }
135
136        for (item of items) {
137
138          // console.log(item);
139
140          var id = item.price.id;
141          var quantity = item.price.customData.licenses ?? 1;
142          var regular = (item.totals.subtotal / 100);
143          var subtotal = Math.ceil((item.totals.subtotal - item.totals.discount) / 100);
144          var perSite = Math.ceil(subtotal / quantity);
145          var total = (item.totals.total / 100).toFixed(2);
146
147          var credits = item.price.customData.credits ?? 1;
148          var perMilion = (subtotal / credits) * 1000000;
149            perMilion = Number(perMilion.toFixed(0));
150
151          var $el = $('[data-price="'+ id +'"]');
152
153          if( $el.length ){
154            $el.attr('data-subtotal',subtotal).attr('data-total',total); // dropdown options
155            $el.find('.price-currency').text(currency).addClass(currencyClass);
156            $el.find('.price-net').text(subtotal);
157            $el.find('.price-regular').text(regular);
158            $el.find('.price-total').text(total);
159            $el.find('.price-site').text(perSite);
160            $el.find('.price-milion').text(perMilion);
161          } else {
162            console.log('Pricing element not found ' + id);
163          }
164
165          // document.getElementById(id).innerHTML = subtotal + ' (' + total + ' inc. taxes)';
166        }
167      })
168      .catch((error) => {
169        console.error(error);
170    });
171
172  }
173
174  /**
175   * Choose plan
176   */
177
178  var choosePlan = function($el) {
179
180    var $parent = $el.closest('.choose-plan');
181
182    var plan = $el.data('plan');
183
184    // switch button clicked
185    if( ! plan ){
186      plan = $parent.attr('data-plan');
187      if( 'annual' == plan ){
188        plan = 'one-time';
189      } else {
190        plan = 'annual';
191      }
192    }
193
194    $parent.attr('data-plan',plan);
195
196  };
197
198  /**
199   * Multiple licenses
200   */
201
202  var multipleLicenses = function($el) {
203
204    var websites = $el.attr('data-websites'),
205      save = $el.attr('data-save'),
206      priceId = $el.attr('data-price'),
207      subtotal = $el.attr('data-subtotal'),
208      total = $el.attr('data-total');
209
210    var $parent = $el.closest('.pricing-box');
211
212    // ask for price
213    if( 'ask' == priceId ){
214      // some custom code
215    }
216
217    // price info
218    $parent.find('.price-websites').text(websites);
219    $parent.find('.price-save').text(save +'%');
220    $parent.find('.price-net').text(subtotal);
221    $parent.find('.price-total').text(total);
222
223    // buy now button
224    $parent.find('.button[data-button="'+ priceId +'"]').show(0)
225      .siblings().hide(0);
226
227  };
228
229  /**
230   * Slider
231   */
232
233  function slider(){
234    $('.customers-slider').slick({
235      dots: true,
236      arrows: false,
237      infinite: true,
238      speed: 300,
239      slidesToShow: 1,
240      adaptiveHeight: true
241    });
242  }
243
244  /**
245   * Bind
246   */
247
248  function bind(){
249
250    // choose plan
251
252    $('.choose-plan').on('click', '.pricing-switcher > a, .pricing-switcher > .toggle', function(e) {
253      e.preventDefault();
254      choosePlan($(this));
255    });
256
257    $('.choose-plan').on('click', '.card.promo a', function(e) {
258      e.preventDefault();
259      $('.pricing-switcher .toggle').trigger('click');
260    });
261
262    // multiple
263
264    $('.license-select').on('click', 'a', function(e) {
265      e.preventDefault();
266      multipleLicenses($(this));
267    });
268
269    // contact us
270
271    $('.contact-us').on('click', function(e) {
272      e.preventDefault();
273      var postfix = '@gmail.com';
274      window.open('mailto:muffingroupcom'+ postfix +'?subject=Please send me an offer for XX Betheme licenses', '_self');
275    });
276
277  }
278
279  /**
280   * Document ready
281   */
282
283  $(function($) {
284
285    bind();
286
287    setup();
288    getPrices();
289
290    slider();
291
292  });
293
294})(jQuery);
295
296document.addEventListener("DOMContentLoaded", function () {
297    const countdownContainer = document.querySelector(".special-offer-countdown");
298    if (!countdownContainer) return;
299
300    const utcDateString = countdownContainer.getAttribute("data-time").trim();
301    const targetTime = new Date(utcDateString).getTime();
302
303    const daysSpan = countdownContainer.querySelector(".countdown-unit:nth-child(1) .num");
304    const hoursSpan = countdownContainer.querySelector(".countdown-unit:nth-child(2) .num");
305    const minutesSpan = countdownContainer.querySelector(".countdown-unit:nth-child(3) .num");
306    const secondsSpan = countdownContainer.querySelector(".countdown-unit:nth-child(4) .num");
307
308    const formatNumber = (num) => String(num).padStart(2, "0");
309
310    const updateCountdown = () => {
311        const now = new Date().getTime();
312        const distance = targetTime - now;
313
314        if (distance < 0) {
315            clearInterval(interval);
316            daysSpan.textContent = "00";
317            hoursSpan.textContent = "00";
318            minutesSpan.textContent = "00";
319            secondsSpan.textContent = "00";
320            return;
321        }
322
323        // Obliczenia dla dni, godzin, minut i sekund
324        const days = Math.floor(distance / (1000 * 60 * 60 * 24));
325        const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
326        const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
327        const seconds = Math.floor((distance % (1000 * 60)) / 1000);
328
329        // Aktualizacja HTML
330        daysSpan.textContent = formatNumber(days);
331        hoursSpan.textContent = formatNumber(hours);
332        minutesSpan.textContent = formatNumber(minutes);
333        secondsSpan.textContent = formatNumber(seconds);
334    };
335
336    updateCountdown();
337
338    const interval = setInterval(updateCountdown, 1000);
339});

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.