@recras/online-booking-js 1.9.0 → 1.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Build Status](https://travis-ci.org/Recras/online-booking-js.svg?branch=master)](https://travis-ci.org/Recras/online-booking-js)
2
2
 
3
3
  # Recras JS Integration Library
4
- Version: 1.9.0
4
+ Version: 1.10.3
5
5
 
6
6
  JS library for easy online booking, contact form, and voucher integration
7
7
 
@@ -131,12 +131,12 @@ the constants in [src/eventHelper.js](src/eventHelper.js).
131
131
  When Google Analytics integration is enabled, certain events sent to GA include a label and/or value:
132
132
 
133
133
  | Event | Label | Value |
134
- | ---------------------------------- | --------------------------------- | ----------------------------------- |
134
+ | ---------------------------------- | --------------------------------- |-------------------------------------|
135
135
  | `Recras:Booking:PackageChanged` | Package name | Package ID |
136
136
  | `Recras:Booking:DateSelected` | Selected date, in ISO 8601 format | N/A |
137
- | `Recras:Booking:BuyInProgress` | Package name | Package ID |
137
+ | `Recras:Booking:BuyInProgress` | Package name | Rounded total amount of the booking |
138
138
  | `Recras:Booking:RedirectToPayment` | N/A | Rounded total amount of the booking |
139
139
  | `Recras:ContactForm:Submit` | N/A | Form ID |
140
140
  | `Recras:Voucher:TemplateChanged` | N/A | Template ID |
141
- | `Recras:Voucher:BuyInProgress` | Template name | Template ID |
141
+ | `Recras:Voucher:BuyInProgress` | Template name | Rounded total amount of the order |
142
142
  | `Recras:Voucher:RedirectToPayment` | N/A | Rounded total amount of the order |
package/changelog.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.3 (2021-12-16)
4
+ * Change value of "BuyInProgress" events from package/template ID (bookings/vouchers, respectively) to total price
5
+
6
+ ## 1.10.2 (2021-10-07)
7
+ * Clicking required checkboxes would become slow after clicking a few times - fixed
8
+
9
+ ## 1.10.1 (2021-09-09)
10
+ * Make redirect without Mollie more robust
11
+
12
+ ## 1.10.0 (2021-09-08)
13
+ * Replace alerts with inline messages
14
+
3
15
  ## 1.9.0 (2021-08-16)
4
16
  * Allow changing the term for number of vouchers
5
17
 
@@ -50,7 +50,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
50
50
 
51
51
  /*******************************
52
52
  * Recras integration library *
53
- * v 1.9.0 *
53
+ * v 1.10.3 *
54
54
  *******************************/
55
55
  var RecrasBooking = /*#__PURE__*/function () {
56
56
  function RecrasBooking() {
@@ -1153,6 +1153,10 @@ var RecrasBooking = /*#__PURE__*/function () {
1153
1153
  _toConsumableArray(this.findElements('.recras-input-invalid')).forEach(function (el) {
1154
1154
  el.classList.remove('recras-input-invalid');
1155
1155
  });
1156
+
1157
+ _toConsumableArray(this.findElements('.recras-success')).forEach(function (el) {
1158
+ el.parentNode.removeChild(el);
1159
+ });
1156
1160
  }
1157
1161
  /**
1158
1162
  * requiredAmount calculates the amount N needed of Y in the sentence 'product X requires N times product Y'
@@ -1675,7 +1679,7 @@ var RecrasBooking = /*#__PURE__*/function () {
1675
1679
  }, 0);
1676
1680
 
1677
1681
  if (this.bookingSize() === 0 && productSum === 0) {
1678
- window.alert(this.languageHelper.translate('NO_PRODUCTS'));
1682
+ this.error(this.languageHelper.translate('NO_PRODUCTS'));
1679
1683
  return false;
1680
1684
  }
1681
1685
 
@@ -1685,7 +1689,7 @@ var RecrasBooking = /*#__PURE__*/function () {
1685
1689
  return false;
1686
1690
  }
1687
1691
 
1688
- this.eventHelper.sendEvent(RecrasEventHelper.PREFIX_BOOKING, RecrasEventHelper.EVENT_BOOKING_BOOKING_SUBMITTED, this.selectedPackage.arrangement, this.selectedPackage.id);
1692
+ this.eventHelper.sendEvent(RecrasEventHelper.PREFIX_BOOKING, RecrasEventHelper.EVENT_BOOKING_BOOKING_SUBMITTED, this.selectedPackage.arrangement, Math.round(this.getTotalPrice()));
1689
1693
  var paymentMethod = this.paymentMethods(this.selectedPackage)[0];
1690
1694
  var paymentMethodEl = this.findElement('[name="paymentMethod"]:checked');
1691
1695
 
@@ -1723,23 +1727,24 @@ var RecrasBooking = /*#__PURE__*/function () {
1723
1727
  }
1724
1728
 
1725
1729
  return this.postJson('onlineboeking/reserveer', bookingParams).then(function (json) {
1726
- //TODO: redirect for payment afterwards. This needs to be implemented in Recras first
1727
1730
  if (json.payment_url) {
1731
+ _this28.eventHelper.sendEvent(RecrasEventHelper.PREFIX_BOOKING, RecrasEventHelper.EVENT_BOOKING_REDIRECT_PAYMENT, null, Math.round(_this28.getTotalPrice()));
1732
+
1728
1733
  window.top.location.href = json.payment_url;
1734
+ } else if (json.redirect) {
1735
+ window.top.location.href = json.redirect;
1729
1736
  } else if (json.message && json.status) {
1730
- if (bookingParams.redirect_url) {
1731
- _this28.eventHelper.sendEvent(RecrasEventHelper.PREFIX_BOOKING, RecrasEventHelper.EVENT_BOOKING_REDIRECT_PAYMENT, null, Math.round(_this28.getTotalPrice()));
1737
+ _this28.findElement('.recras-amountsform').reset();
1732
1738
 
1733
- window.top.location.href = bookingParams.redirect_url;
1734
- } else {
1735
- _this28.findElement('.recras-amountsform').reset();
1739
+ _this28.findElement('.recras-datetime').reset();
1736
1740
 
1737
- _this28.findElement('.recras-datetime').reset();
1741
+ _this28.findElement('.recras-contactform').reset();
1738
1742
 
1739
- _this28.findElement('.recras-contactform').reset();
1743
+ _this28.element.scrollIntoView({
1744
+ behavior: 'smooth'
1745
+ });
1740
1746
 
1741
- window.alert(json.message);
1742
- }
1747
+ _this28.element.insertAdjacentHTML('afterbegin', "<p class=\"recras-success\">".concat(json.message, "</p>"));
1743
1748
  } else {
1744
1749
  console.log(json);
1745
1750
  }
@@ -1962,6 +1967,7 @@ var RecrasContactForm = /*#__PURE__*/function () {
1962
1967
  throw new Error(this.languageHelper.translate('ERR_NO_FORM'));
1963
1968
  }
1964
1969
 
1970
+ this.checkboxEventListeners = [];
1965
1971
  this.eventHelper = new RecrasEventHelper();
1966
1972
  this.eventHelper.setEvents(this.options.getAnalyticsEvents());
1967
1973
  this.element = this.options.getElement();
@@ -2013,10 +2019,6 @@ var RecrasContactForm = /*#__PURE__*/function () {
2013
2019
  group.parentNode.querySelector('label').insertAdjacentHTML('beforeend', "<div class=\"recrasError\">".concat(_this32.languageHelper.translate('CONTACT_FORM_CHECKBOX_REQUIRED'), "</div>"));
2014
2020
  isOkay = false;
2015
2021
  }
2016
-
2017
- _toConsumableArray(group.querySelectorAll('input')).forEach(function (el) {
2018
- el.addEventListener('change', _this32.checkRequiredCheckboxes.bind(_this32));
2019
- });
2020
2022
  });
2021
2023
 
2022
2024
  return isOkay;
@@ -2288,6 +2290,10 @@ var RecrasContactForm = /*#__PURE__*/function () {
2288
2290
  _toConsumableArray(this.findElements('.recrasError')).forEach(function (el) {
2289
2291
  el.parentNode.removeChild(el);
2290
2292
  });
2293
+
2294
+ _toConsumableArray(this.findElements('.recras-success')).forEach(function (el) {
2295
+ el.parentNode.removeChild(el);
2296
+ });
2291
2297
  }
2292
2298
  }, {
2293
2299
  key: "hasEmptyRequiredFields",
@@ -2463,6 +2469,12 @@ var RecrasContactForm = /*#__PURE__*/function () {
2463
2469
  }).then(function (html) {
2464
2470
  _this37.appendHtml(html);
2465
2471
 
2472
+ _toConsumableArray(_this37.findElements('.checkboxGroupRequired')).forEach(function (group) {
2473
+ _toConsumableArray(group.querySelectorAll('input')).forEach(function (el) {
2474
+ el.addEventListener('change', _this37.checkRequiredCheckboxes.bind(_this37));
2475
+ });
2476
+ });
2477
+
2466
2478
  _this37.findElement('.recras-contactform').addEventListener('submit', _this37.submitForm.bind(_this37));
2467
2479
 
2468
2480
  if (_this37.hasBookingDateField()) {
@@ -2552,7 +2564,7 @@ var RecrasContactForm = /*#__PURE__*/function () {
2552
2564
  this.removeErrors('.recras-contactform');
2553
2565
 
2554
2566
  if (this.isEmpty()) {
2555
- submitButton.parentNode.insertAdjacentHTML('afterend', "<div class=\"booking-error\">".concat(this.languageHelper.translate('ERR_CONTACT_FORM_EMPTY'), "</div>"));
2567
+ submitButton.parentNode.insertAdjacentHTML('beforeend', "<div class=\"booking-error\">".concat(this.languageHelper.translate('ERR_CONTACT_FORM_EMPTY'), "</div>"));
2556
2568
  return false;
2557
2569
  } else if (this.hasEmptyRequiredFields() || !this.isValid()) {
2558
2570
  this.showInlineErrors();
@@ -2572,11 +2584,16 @@ var RecrasContactForm = /*#__PURE__*/function () {
2572
2584
  if (_this38.options.getRedirectUrl()) {
2573
2585
  window.top.location.href = _this38.options.getRedirectUrl();
2574
2586
  } else {
2575
- window.alert(_this38.languageHelper.translate('CONTACT_FORM_SUBMIT_SUCCESS'));
2587
+ _this38.element.scrollIntoView({
2588
+ behavior: 'smooth'
2589
+ });
2590
+
2591
+ _this38.element.insertAdjacentHTML('afterbegin', "<p class=\"recras-success\">".concat(_this38.languageHelper.translate('CONTACT_FORM_SUBMIT_SUCCESS'), "</p>"));
2592
+
2576
2593
  submitButton.parentNode.reset();
2577
2594
  }
2578
2595
  } else {
2579
- window.alert(_this38.languageHelper.translate('CONTACT_FORM_SUBMIT_FAILED'));
2596
+ _this38.error(_this38.languageHelper.translate('CONTACT_FORM_SUBMIT_FAILED'));
2580
2597
  }
2581
2598
 
2582
2599
  submitButton.removeAttribute('disabled');
@@ -2598,7 +2615,7 @@ var RecrasCSSHelper = /*#__PURE__*/function () {
2598
2615
  _createClass(RecrasCSSHelper, null, [{
2599
2616
  key: "cssBooking",
2600
2617
  value: function cssBooking() {
2601
- return "\n.recras-onlinebooking {\n max-width: 800px;\n}\n.recras-onlinebooking > form + form, .recras-finalise {\n border-top: 2px solid #dedede; /* Any love for Kirby out there? */\n}\n.recras-amountsform > div {\n display: -ms-grid;\n display: grid;\n -ms-grid-columns: 1fr 5em 7em;\n grid-template-columns: 1fr 5em 7em;\n}\n.recras-amountsform > div > div:first-child {\n -ms-grid-column: 1;\n}\n.recras-amountsform > div > input {\n -ms-grid-column: 2;\n}\n.recras-amountsform input {\n width: auto; /* Firefox fix */\n}\n.recras-amountsform > div > div:last-child {\n -ms-grid-column: 3;\n}\n.recras-input-invalid {\n border: 1px solid hsl(0, 50%, 50%);\n}\n.booking-error, .minimum-amount {\n color: hsl(0, 50%, 50%);\n}\n.minimum-amount {\n padding-left: 0.5em;\n}\n.recras-datetime {\n display: -ms-grid;\n display: grid;\n -ms-grid-columns: 30% 70%;\n grid-template-columns: 30% 70%;\n}\n.recras-datetime > * {\n margin: 0.25em 0;\n}\n.recras-datetime label {\n display: block;\n -ms-grid-column: 1;\n}\n.recras-datetime input, .recras-datetime select {\n max-width: 12em;\n -ms-grid-column: 2;\n}\n.recras-datetime > :nth-child(-n + 2) {\n -ms-grid-row: 1;\n}\n.recras-datetime > :nth-last-child(-n + 2) {\n -ms-grid-row: 2;\n}\n.time-preview {\n padding-right: 0.5em;\n}\n.recrasUnitPrice {\n opacity: 0.5;\n}\n.recras-onlinebooking .recrasHidden {\n display: none;\n}\n";
2618
+ return "\n.recras-onlinebooking {\n max-width: 800px;\n}\n.recras-onlinebooking > form + form, .recras-finalise {\n border-top: 2px solid #dedede; /* Any love for Kirby out there? */\n}\n.recras-amountsform > div {\n display: -ms-grid;\n display: grid;\n -ms-grid-columns: 1fr 5em 7em;\n grid-template-columns: 1fr 5em 7em;\n}\n.recras-amountsform > div > div:first-child {\n -ms-grid-column: 1;\n}\n.recras-amountsform > div > input {\n -ms-grid-column: 2;\n}\n.recras-amountsform input {\n width: auto; /* Firefox fix */\n}\n.recras-amountsform > div > div:last-child {\n -ms-grid-column: 3;\n}\n.recras-input-invalid {\n border: 1px solid hsl(0, 50%, 50%);\n}\n.booking-error, .minimum-amount {\n color: hsl(0, 50%, 50%);\n}\n.recras-success {\n color: hsl(120, 40%, 40%);\n}\n.minimum-amount {\n padding-left: 0.5em;\n}\n.recras-datetime {\n display: -ms-grid;\n display: grid;\n -ms-grid-columns: 30% 70%;\n grid-template-columns: 30% 70%;\n}\n.recras-datetime > * {\n margin: 0.25em 0;\n}\n.recras-datetime label {\n display: block;\n -ms-grid-column: 1;\n}\n.recras-datetime input, .recras-datetime select {\n max-width: 12em;\n -ms-grid-column: 2;\n}\n.recras-datetime > :nth-child(-n + 2) {\n -ms-grid-row: 1;\n}\n.recras-datetime > :nth-last-child(-n + 2) {\n -ms-grid-row: 2;\n}\n.time-preview {\n padding-right: 0.5em;\n}\n.recrasUnitPrice {\n opacity: 0.5;\n}\n.recras-onlinebooking .recrasHidden {\n display: none;\n}\n";
2602
2619
  }
2603
2620
  }, {
2604
2621
  key: "cssGlobal",
@@ -3629,7 +3646,7 @@ var RecrasVoucher = /*#__PURE__*/function () {
3629
3646
  return false;
3630
3647
  }
3631
3648
 
3632
- this.eventHelper.sendEvent(RecrasEventHelper.PREFIX_VOUCHER, RecrasEventHelper.EVENT_VOUCHER_VOUCHER_SUBMITTED, this.selectedTemplate.name, this.selectedTemplate.id);
3649
+ this.eventHelper.sendEvent(RecrasEventHelper.PREFIX_VOUCHER, RecrasEventHelper.EVENT_VOUCHER_VOUCHER_SUBMITTED, this.selectedTemplate.name, Math.round(this.totalPrice()));
3633
3650
  this.findElement('.buyTemplate').setAttribute('disabled', 'disabled');
3634
3651
  var payload = {
3635
3652
  voucher_template_id: this.selectedTemplate.id,
package/docs/demo.css CHANGED
@@ -58,6 +58,7 @@ button:disabled {
58
58
  }
59
59
  input:not([type="checkbox"]):not([type="radio"]):not(input[type="number"]), select, textarea, .radioGroup {
60
60
  font: inherit;
61
+ max-width: 100%;
61
62
  width: 300px;
62
63
  }
63
64
  input[type="number"] {
@@ -83,6 +84,11 @@ input[type="number"] {
83
84
  border: 1px solid #a00 !important;
84
85
  padding: 0.5em !important;
85
86
  }
87
+ .recras-success {
88
+ background: hsl(120, 25%, 96%);
89
+ border: 1px solid hsl(120, 40%, 40%);
90
+ padding: 0.5em !important;
91
+ }
86
92
 
87
93
  .recras-onlinebooking > form + form, .recras-finalise {
88
94
  border-top: 2px solid hsla(147, 25%, 25%, 0.25);
@@ -20,7 +20,7 @@
20
20
  console.log(params);
21
21
  };
22
22
  const recrasOptions = {
23
- recras_hostname: 'demo.recras.nl', // Required
23
+ recras_hostname: 'staging-7164-boek-3v9yx2.recras.nl', // Required
24
24
  element: document.getElementById('onlinebooking'), // Required
25
25
  locale: 'nl_NL', // Optional, default is nl_NL. Valid values are de_DE, en_GB, nl_NL, sv_SE
26
26
  //package_id: 7, // Optional, this will skip the package selection step for online booking
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recras/online-booking-js",
3
- "version": "1.9.0",
3
+ "version": "1.10.3",
4
4
  "description": "JS library for easy integration of Recras online booking and voucher sales",
5
5
  "main": "dist/onlinebooking.js",
6
6
  "scripts": {
package/src/booking.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*******************************
2
2
  * Recras integration library *
3
- * v 1.9.0 *
3
+ * v 1.10.3 *
4
4
  *******************************/
5
5
 
6
6
  class RecrasBooking {
@@ -906,6 +906,9 @@ class RecrasBooking {
906
906
  [...this.findElements('.recras-input-invalid')].forEach(el => {
907
907
  el.classList.remove('recras-input-invalid');
908
908
  });
909
+ [...this.findElements('.recras-success')].forEach(el => {
910
+ el.parentNode.removeChild(el);
911
+ });
909
912
  }
910
913
 
911
914
  /**
@@ -1376,7 +1379,7 @@ ${ msgs[1] }</p></div>`);
1376
1379
  let productCounts = this.productCounts().map(line => line.aantal);
1377
1380
  let productSum = productCounts.reduce((a, b) => a + b, 0);
1378
1381
  if (this.bookingSize() === 0 && productSum === 0) {
1379
- window.alert(this.languageHelper.translate('NO_PRODUCTS'));
1382
+ this.error(this.languageHelper.translate('NO_PRODUCTS'));
1380
1383
  return false;
1381
1384
  }
1382
1385
  let status = this.contactForm.checkRequiredCheckboxes();
@@ -1388,7 +1391,7 @@ ${ msgs[1] }</p></div>`);
1388
1391
  RecrasEventHelper.PREFIX_BOOKING,
1389
1392
  RecrasEventHelper.EVENT_BOOKING_BOOKING_SUBMITTED,
1390
1393
  this.selectedPackage.arrangement,
1391
- this.selectedPackage.id
1394
+ Math.round(this.getTotalPrice())
1392
1395
  );
1393
1396
 
1394
1397
  let paymentMethod = this.paymentMethods(this.selectedPackage)[0];
@@ -1424,24 +1427,27 @@ ${ msgs[1] }</p></div>`);
1424
1427
  }
1425
1428
 
1426
1429
  return this.postJson('onlineboeking/reserveer', bookingParams).then(json => {
1427
- //TODO: redirect for payment afterwards. This needs to be implemented in Recras first
1428
1430
  if (json.payment_url) {
1431
+ this.eventHelper.sendEvent(
1432
+ RecrasEventHelper.PREFIX_BOOKING,
1433
+ RecrasEventHelper.EVENT_BOOKING_REDIRECT_PAYMENT,
1434
+ null,
1435
+ Math.round(this.getTotalPrice())
1436
+ );
1429
1437
  window.top.location.href = json.payment_url;
1438
+ } else if (json.redirect) {
1439
+ window.top.location.href = json.redirect;
1430
1440
  } else if (json.message && json.status) {
1431
- if (bookingParams.redirect_url) {
1432
- this.eventHelper.sendEvent(
1433
- RecrasEventHelper.PREFIX_BOOKING,
1434
- RecrasEventHelper.EVENT_BOOKING_REDIRECT_PAYMENT,
1435
- null,
1436
- Math.round(this.getTotalPrice())
1437
- );
1438
- window.top.location.href = bookingParams.redirect_url;
1439
- } else {
1440
- this.findElement('.recras-amountsform').reset();
1441
- this.findElement('.recras-datetime').reset();
1442
- this.findElement('.recras-contactform').reset();
1443
- window.alert(json.message);
1444
- }
1441
+ this.findElement('.recras-amountsform').reset();
1442
+ this.findElement('.recras-datetime').reset();
1443
+ this.findElement('.recras-contactform').reset();
1444
+ this.element.scrollIntoView({
1445
+ behavior: 'smooth',
1446
+ });
1447
+ this.element.insertAdjacentHTML(
1448
+ 'afterbegin',
1449
+ `<p class="recras-success">${ json.message }</p>`
1450
+ );
1445
1451
  } else {
1446
1452
  console.log(json);
1447
1453
  }
@@ -11,6 +11,8 @@ class RecrasContactForm {
11
11
  throw new Error(this.languageHelper.translate('ERR_NO_FORM'));
12
12
  }
13
13
 
14
+ this.checkboxEventListeners = [];
15
+
14
16
  this.eventHelper = new RecrasEventHelper();
15
17
  this.eventHelper.setEvents(this.options.getAnalyticsEvents());
16
18
 
@@ -53,9 +55,6 @@ class RecrasContactForm {
53
55
  group.parentNode.querySelector('label').insertAdjacentHTML('beforeend', `<div class="recrasError">${ this.languageHelper.translate('CONTACT_FORM_CHECKBOX_REQUIRED') }</div>`);
54
56
  isOkay = false;
55
57
  }
56
- [...group.querySelectorAll('input')].forEach(el => {
57
- el.addEventListener('change', this.checkRequiredCheckboxes.bind(this));
58
- });
59
58
  });
60
59
  return isOkay;
61
60
  }
@@ -263,6 +262,9 @@ class RecrasContactForm {
263
262
  [...this.findElements('.recrasError')].forEach(el => {
264
263
  el.parentNode.removeChild(el);
265
264
  });
265
+ [...this.findElements('.recras-success')].forEach(el => {
266
+ el.parentNode.removeChild(el);
267
+ });
266
268
  }
267
269
 
268
270
  hasEmptyRequiredFields() {
@@ -411,7 +413,14 @@ class RecrasContactForm {
411
413
  }))
412
414
  .then(html => {
413
415
  this.appendHtml(html);
416
+
417
+ [...this.findElements('.checkboxGroupRequired')].forEach(group => {
418
+ [...group.querySelectorAll('input')].forEach(el => {
419
+ el.addEventListener('change', this.checkRequiredCheckboxes.bind(this));
420
+ });
421
+ });
414
422
  this.findElement('.recras-contactform').addEventListener('submit', this.submitForm.bind(this));
423
+
415
424
  if (this.hasBookingDateField()) {
416
425
  let pikadayOptions = Object.assign(
417
426
  RecrasCalendarHelper.defaultOptions(),
@@ -491,7 +500,7 @@ class RecrasContactForm {
491
500
  this.removeErrors('.recras-contactform');
492
501
  if (this.isEmpty()) {
493
502
  submitButton.parentNode.insertAdjacentHTML(
494
- 'afterend',
503
+ 'beforeend',
495
504
  `<div class="booking-error">${ this.languageHelper.translate('ERR_CONTACT_FORM_EMPTY') }</div>`
496
505
  );
497
506
  return false;
@@ -521,11 +530,17 @@ class RecrasContactForm {
521
530
  if (this.options.getRedirectUrl()) {
522
531
  window.top.location.href = this.options.getRedirectUrl();
523
532
  } else {
524
- window.alert(this.languageHelper.translate('CONTACT_FORM_SUBMIT_SUCCESS'));
533
+ this.element.scrollIntoView({
534
+ behavior: 'smooth',
535
+ });
536
+ this.element.insertAdjacentHTML(
537
+ 'afterbegin',
538
+ `<p class="recras-success">${ this.languageHelper.translate('CONTACT_FORM_SUBMIT_SUCCESS') }</p>`
539
+ );
525
540
  submitButton.parentNode.reset();
526
541
  }
527
542
  } else {
528
- window.alert(this.languageHelper.translate('CONTACT_FORM_SUBMIT_FAILED'));
543
+ this.error(this.languageHelper.translate('CONTACT_FORM_SUBMIT_FAILED'));
529
544
  }
530
545
  submitButton.removeAttribute('disabled');
531
546
  this.loadingIndicatorHide();
package/src/cssHelper.js CHANGED
@@ -32,6 +32,9 @@ class RecrasCSSHelper {
32
32
  .booking-error, .minimum-amount {
33
33
  color: hsl(0, 50%, 50%);
34
34
  }
35
+ .recras-success {
36
+ color: hsl(120, 40%, 40%);
37
+ }
35
38
  .minimum-amount {
36
39
  padding-left: 0.5em;
37
40
  }
package/src/vouchers.js CHANGED
@@ -53,7 +53,7 @@ class RecrasVoucher {
53
53
  RecrasEventHelper.PREFIX_VOUCHER,
54
54
  RecrasEventHelper.EVENT_VOUCHER_VOUCHER_SUBMITTED,
55
55
  this.selectedTemplate.name,
56
- this.selectedTemplate.id
56
+ Math.round(this.totalPrice())
57
57
  );
58
58
  this.findElement('.buyTemplate').setAttribute('disabled', 'disabled');
59
59
 
package/upgrading.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.10.2 -> 1.10.3
2
+ * The value of "BuyInProgress" events sent to Google Analytics was changed from package ID to total price. This is true for both bookings and vouchers. We consider this a bugfix and not a backwards-compatibility breaking change.
3
+
1
4
  # 1.2.0 -> 1.3.0
2
5
  * Option `showSubmit` for contact forms (only used internally) is now named `standalone`. The old option will remain as alias until the next major version.
3
6