@recras/online-booking-js 2.0.6 → 2.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recras/online-booking-js",
3
- "version": "2.0.6",
3
+ "version": "2.1.0",
4
4
  "description": "JS library for easy integration of Recras online booking and voucher sales",
5
5
  "main": "dist/onlinebooking.js",
6
6
  "scripts": {
@@ -31,22 +31,22 @@
31
31
  },
32
32
  "homepage": "https://github.com/Recras/online-booking-js#readme",
33
33
  "devDependencies": {
34
- "@babel/cli": "7.18.9",
35
- "@babel/core": "7.18.9",
34
+ "@babel/cli": "7.28.3",
35
+ "@babel/core": "7.28.5",
36
36
  "@babel/plugin-proposal-class-properties": "7.18.6",
37
- "@babel/plugin-transform-arrow-functions": "7.18.6",
38
- "@babel/plugin-transform-for-of": "7.18.8",
39
- "@babel/plugin-transform-object-assign": "7.18.6",
40
- "@babel/preset-env": "7.18.9",
37
+ "@babel/plugin-transform-arrow-functions": "7.27.1",
38
+ "@babel/plugin-transform-for-of": "7.27.1",
39
+ "@babel/plugin-transform-object-assign": "7.27.1",
40
+ "@babel/preset-env": "7.28.5",
41
41
  "babel-plugin-transform-es2017-object-entries": "0.0.5",
42
- "jasmine-core": "4.3.0",
42
+ "jasmine-core": "4.6.1",
43
43
  "jasmine-spec-reporter": "7.0.0",
44
- "jshint": "2.13.5",
45
- "karma": "6.4.0",
46
- "karma-chrome-launcher": "3.1.0",
44
+ "jshint": "2.13.6",
45
+ "karma": "6.4.4",
46
+ "karma-chrome-launcher": "3.2.0",
47
47
  "karma-firefox-launcher": "2.1.2",
48
48
  "karma-jasmine": "5.1.0",
49
- "karma-spec-reporter": "0.0.34",
50
- "uglify-js": "3.16.3"
49
+ "karma-spec-reporter": "0.0.36",
50
+ "uglify-js": "3.19.3"
51
51
  }
52
52
  }
package/src/booking.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*******************************
2
2
  * Recras integration library *
3
- * v 2.0.6 *
3
+ * v 2.1.0 *
4
4
  *******************************/
5
5
 
6
6
  class RecrasBooking {
@@ -126,6 +126,9 @@ class RecrasContactForm {
126
126
  if (contactForm['boeking.datum']) {
127
127
  contactForm['boeking.datum'] = RecrasDateHelper.formatStringForAPI(contactForm['boeking.datum']);
128
128
  }
129
+ if (this.nonce) {
130
+ contactForm.nonce = this.nonce;
131
+ }
129
132
 
130
133
  return contactForm;
131
134
  }
@@ -135,6 +138,7 @@ class RecrasContactForm {
135
138
  .then(form => {
136
139
  this.contactFormFields = form.Velden;
137
140
  this.packages = this.sortPackages(form.Arrangementen);
141
+ this.nonce = form.nonce ?? null;
138
142
  return this.contactFormFields;
139
143
  });
140
144
  }
package/src/options.js CHANGED
@@ -1,8 +1,4 @@
1
1
  class RecrasOptions {
2
- static hostnamesDebug = [
3
- 'nginx:8886', // Local development
4
- 'nginx', // Docker Selenium tests
5
- ];
6
2
 
7
3
  constructor(options) {
8
4
  this.languageHelper = new RecrasLanguageHelper();
@@ -89,18 +85,11 @@ class RecrasOptions {
89
85
  }
90
86
 
91
87
  setOptions(options) {
92
- let protocol = 'https';
93
- if (RecrasOptions.hostnamesDebug.includes(options.recras_hostname)) {
94
- protocol = 'http';
95
- }
96
- options.hostname = protocol + '://' + options.recras_hostname;
97
-
88
+ options.hostname = '//' + options.recras_hostname;
98
89
  return options;
99
90
  }
100
91
 
101
92
  validate(options) {
102
- const hostnameRegex = new RegExp(/^[a-z0-9\-]+\.recras\.nl$/i);
103
-
104
93
  if (!options.element) {
105
94
  throw new Error(this.languageHelper.translate('ERR_NO_ELEMENT'));
106
95
  }
@@ -111,14 +100,6 @@ class RecrasOptions {
111
100
  if (!options.recras_hostname) {
112
101
  throw new Error(this.languageHelper.translate('ERR_NO_HOSTNAME'));
113
102
  }
114
- if (
115
- !hostnameRegex.test(options.recras_hostname) &&
116
- !RecrasOptions.hostnamesDebug.includes(options.recras_hostname)
117
- ) {
118
- throw new Error(
119
- this.languageHelper.translate('ERR_INVALID_HOSTNAME')
120
- );
121
- }
122
103
  if (options.redirect_url) {
123
104
  if (options.redirect_url.indexOf('http://') === -1 && options.redirect_url.indexOf('https://') === -1) {
124
105
  throw new Error(this.languageHelper.translate('ERR_INVALID_REDIRECT_URL'));