@recras/online-booking-js 2.0.3 → 2.0.4
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/.github/workflows/npmpublish.yml +6 -6
- package/README.md +1 -1
- package/changelog.md +3 -0
- package/dist/onlinebooking.js +21 -8
- package/dist/onlinebooking.min.js +1 -1
- package/error_messages.patch +2409 -0
- package/package.json +9 -9
- package/src/booking.js +1 -1
- package/src/contactForm.js +16 -8
- package/src/vouchers.js +1 -1
|
@@ -8,10 +8,10 @@ jobs:
|
|
|
8
8
|
build:
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
12
|
-
- uses: actions/setup-node@
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
- uses: actions/setup-node@v3
|
|
13
13
|
with:
|
|
14
|
-
node-version:
|
|
14
|
+
node-version: 16
|
|
15
15
|
- run: npm ci
|
|
16
16
|
- run: npm test
|
|
17
17
|
|
|
@@ -19,10 +19,10 @@ jobs:
|
|
|
19
19
|
needs: build
|
|
20
20
|
runs-on: ubuntu-latest
|
|
21
21
|
steps:
|
|
22
|
-
- uses: actions/checkout@
|
|
23
|
-
- uses: actions/setup-node@
|
|
22
|
+
- uses: actions/checkout@v3
|
|
23
|
+
- uses: actions/setup-node@v3
|
|
24
24
|
with:
|
|
25
|
-
node-version:
|
|
25
|
+
node-version: 16
|
|
26
26
|
registry-url: https://registry.npmjs.org/
|
|
27
27
|
- run: npm ci
|
|
28
28
|
- run: npm run build
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[](https://travis-ci.org/Recras/online-booking-js)
|
|
2
2
|
|
|
3
3
|
# Recras JS Integration Library
|
|
4
|
-
Version: 2.0.
|
|
4
|
+
Version: 2.0.4
|
|
5
5
|
|
|
6
6
|
JS library for easy online booking, contact form, and voucher integration
|
|
7
7
|
|
package/changelog.md
CHANGED
package/dist/onlinebooking.js
CHANGED
|
@@ -50,7 +50,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
50
50
|
|
|
51
51
|
/*******************************
|
|
52
52
|
* Recras integration library *
|
|
53
|
-
* v 2.0.
|
|
53
|
+
* v 2.0.4 *
|
|
54
54
|
*******************************/
|
|
55
55
|
var RecrasBooking = /*#__PURE__*/function () {
|
|
56
56
|
function RecrasBooking() {
|
|
@@ -2550,27 +2550,40 @@ var RecrasContactForm = /*#__PURE__*/function () {
|
|
|
2550
2550
|
element.parentNode.insertAdjacentHTML('afterend', "<div class=\"booking-error\">".concat(errorMsg, "</div>"));
|
|
2551
2551
|
}
|
|
2552
2552
|
}, {
|
|
2553
|
-
key: "
|
|
2554
|
-
value: function
|
|
2553
|
+
key: "showErrors",
|
|
2554
|
+
value: function showErrors() {
|
|
2555
|
+
var errors = [];
|
|
2556
|
+
|
|
2555
2557
|
for (var _i20 = 0, _this$getEmptyRequire2 = this.getEmptyRequiredFields(); _i20 < _this$getEmptyRequire2.length; _i20++) {
|
|
2556
2558
|
var el = _this$getEmptyRequire2[_i20];
|
|
2557
2559
|
var labelEl = el.parentNode.querySelector('label');
|
|
2558
2560
|
var requiredText = this.languageHelper.translate('CONTACT_FORM_FIELD_REQUIRED', {
|
|
2559
2561
|
FIELD_NAME: labelEl.innerText
|
|
2560
2562
|
});
|
|
2561
|
-
|
|
2563
|
+
errors.push(requiredText);
|
|
2562
2564
|
}
|
|
2563
2565
|
|
|
2564
2566
|
for (var _i22 = 0, _this$getInvalidField2 = this.getInvalidFields(); _i22 < _this$getInvalidField2.length; _i22++) {
|
|
2565
2567
|
var _el = _this$getInvalidField2[_i22];
|
|
2566
2568
|
|
|
2567
|
-
var
|
|
2569
|
+
var parentEl = _el.closest('div');
|
|
2570
|
+
|
|
2571
|
+
if (parentEl.classList.contains('radioGroup')) {
|
|
2572
|
+
parentEl = parentEl.parentNode.closest('div');
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
var _labelEl = parentEl.querySelector('label');
|
|
2568
2576
|
|
|
2577
|
+
console.log(_labelEl, parentEl.querySelectorAll('label'));
|
|
2569
2578
|
var invalidText = this.languageHelper.translate('CONTACT_FORM_FIELD_INVALID', {
|
|
2570
2579
|
FIELD_NAME: _labelEl.innerText
|
|
2571
2580
|
});
|
|
2572
|
-
|
|
2581
|
+
errors.push(invalidText);
|
|
2573
2582
|
}
|
|
2583
|
+
|
|
2584
|
+
errors = _toConsumableArray(new Set(errors)); // Only unique text
|
|
2585
|
+
|
|
2586
|
+
this.findElement('button[type="submit"]').insertAdjacentHTML('afterend', "<div class=\"booking-error\"><ul><li>".concat(errors.join('<li>'), "</ul></div>"));
|
|
2574
2587
|
}
|
|
2575
2588
|
}, {
|
|
2576
2589
|
key: "showLabel",
|
|
@@ -2601,7 +2614,7 @@ var RecrasContactForm = /*#__PURE__*/function () {
|
|
|
2601
2614
|
submitButton.parentNode.insertAdjacentHTML('beforeend', "<div class=\"booking-error\">".concat(this.languageHelper.translate('ERR_CONTACT_FORM_EMPTY'), "</div>"));
|
|
2602
2615
|
return false;
|
|
2603
2616
|
} else if (this.hasEmptyRequiredFields() || !this.isValid()) {
|
|
2604
|
-
this.
|
|
2617
|
+
this.showErrors();
|
|
2605
2618
|
return false;
|
|
2606
2619
|
}
|
|
2607
2620
|
|
|
@@ -3824,7 +3837,7 @@ var RecrasVoucher = /*#__PURE__*/function () {
|
|
|
3824
3837
|
this.contactForm.removeErrors();
|
|
3825
3838
|
|
|
3826
3839
|
if (this.contactForm.hasEmptyRequiredFields() || !this.contactForm.isValid() || !this.contactForm.checkRequiredCheckboxes()) {
|
|
3827
|
-
this.contactForm.
|
|
3840
|
+
this.contactForm.showErrors();
|
|
3828
3841
|
shouldDisable = true;
|
|
3829
3842
|
}
|
|
3830
3843
|
|