@digipair/skill-smoobu 0.48.3 → 0.49.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/index.cjs.js CHANGED
@@ -16,8 +16,9 @@ function _extends() {
16
16
  }
17
17
 
18
18
  let SmoobuService = class SmoobuService {
19
- async call(url, method, data = null, headers = {}) {
19
+ async call(url, method, data, headers, signal) {
20
20
  const response = await fetch(`${this.API_ENDPOINT}${url}`, {
21
+ signal,
21
22
  method,
22
23
  headers: _extends({
23
24
  'Api-Key': this.SMOOBU_API_KEY
@@ -27,11 +28,13 @@ let SmoobuService = class SmoobuService {
27
28
  if (!response.ok) throw new Error('[SKILL-SMOOBU] REQUEST FAILED: ' + response.status);
28
29
  return await response.json();
29
30
  }
30
- async getReservationWithId(params, _pinsSettingsList, _context) {
31
+ async getReservationWithId(params, _pinsSettingsList, context) {
32
+ var _context_protected;
31
33
  const { reservationId } = params;
32
- return await this.call(`/reservations/${reservationId}`, 'GET');
34
+ return await this.call(`/reservations/${reservationId}`, 'GET', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
33
35
  }
34
- async getAllReservations(params, _pinsSettingsList, _context) {
36
+ async getAllReservations(params, _pinsSettingsList, context) {
37
+ var _context_protected;
35
38
  const { created_from, created_to, from, to, modifiedFrom, modifiedTo, arrivalFrom, arrivalTo, departureFrom, departureTo, showCancellation, excludeBlocked, page, pageSize, apartmentId, includeRelated, includePriceElements } = params;
36
39
  const queryParams = new URLSearchParams();
37
40
  if (created_from) queryParams.append('created_from', created_from);
@@ -51,13 +54,14 @@ let SmoobuService = class SmoobuService {
51
54
  if (apartmentId) queryParams.append('apartmentId', apartmentId);
52
55
  if (includeRelated) queryParams.append('includeRelated', includeRelated);
53
56
  if (includePriceElements) queryParams.append('includePriceElements', includePriceElements);
54
- return await this.call(`/reservations?${queryParams.toString()}`, 'GET');
57
+ return await this.call(`/reservations?${queryParams.toString()}`, 'GET', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
55
58
  }
56
- async sendMessage(params, _pinsSettingsList, _context) {
59
+ async sendMessage(params, _pinsSettingsList, context) {
60
+ var _context_protected;
57
61
  const { reservationId, message } = params;
58
62
  return await this.call(`/reservations/${reservationId}/messages/send-message-to-guest`, 'POST', JSON.stringify({
59
63
  messageBody: message
60
- }));
64
+ }), {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
61
65
  }
62
66
  async event(params, _pinsSettingsList, context) {
63
67
  const { updateRates = [], newReservation = [], cancelReservation = [], updateReservation = [] } = params;
package/index.esm.js CHANGED
@@ -23899,14 +23899,14 @@ function indent(str, spaces) {
23899
23899
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23900
23900
  // match is required
23901
23901
  if (!match) {
23902
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23902
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23903
23903
  v: nextMatch1
23904
23904
  };
23905
23905
  }
23906
23906
  var token = match.token, offset = match.offset;
23907
23907
  i1 += offset;
23908
23908
  if (token === " ") {
23909
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23909
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23910
23910
  }
23911
23911
  tokens1 = _to_consumable_array$1(tokens1).concat([
23912
23912
  token
@@ -23925,7 +23925,7 @@ function indent(str, spaces) {
23925
23925
  if (contextKeys.some(function(el) {
23926
23926
  return el.startsWith(name);
23927
23927
  })) {
23928
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23928
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23929
23929
  }
23930
23930
  if (dateTimeIdentifiers.some(function(el) {
23931
23931
  return el === name;
@@ -23944,9 +23944,9 @@ function indent(str, spaces) {
23944
23944
  if (dateTimeIdentifiers.some(function(el) {
23945
23945
  return el.startsWith(name);
23946
23946
  })) {
23947
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23947
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23948
23948
  }
23949
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23949
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23950
23950
  v: nextMatch1
23951
23951
  };
23952
23952
  };
@@ -27954,8 +27954,9 @@ const preparePinsSettings = async (settings, context)=>{
27954
27954
  };
27955
27955
 
27956
27956
  let SmoobuService = class SmoobuService {
27957
- async call(url, method, data = null, headers = {}) {
27957
+ async call(url, method, data, headers, signal) {
27958
27958
  const response = await fetch(`${this.API_ENDPOINT}${url}`, {
27959
+ signal,
27959
27960
  method,
27960
27961
  headers: _extends({
27961
27962
  'Api-Key': this.SMOOBU_API_KEY
@@ -27965,11 +27966,13 @@ let SmoobuService = class SmoobuService {
27965
27966
  if (!response.ok) throw new Error('[SKILL-SMOOBU] REQUEST FAILED: ' + response.status);
27966
27967
  return await response.json();
27967
27968
  }
27968
- async getReservationWithId(params, _pinsSettingsList, _context) {
27969
+ async getReservationWithId(params, _pinsSettingsList, context) {
27970
+ var _context_protected;
27969
27971
  const { reservationId } = params;
27970
- return await this.call(`/reservations/${reservationId}`, 'GET');
27972
+ return await this.call(`/reservations/${reservationId}`, 'GET', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
27971
27973
  }
27972
- async getAllReservations(params, _pinsSettingsList, _context) {
27974
+ async getAllReservations(params, _pinsSettingsList, context) {
27975
+ var _context_protected;
27973
27976
  const { created_from, created_to, from, to, modifiedFrom, modifiedTo, arrivalFrom, arrivalTo, departureFrom, departureTo, showCancellation, excludeBlocked, page, pageSize, apartmentId, includeRelated, includePriceElements } = params;
27974
27977
  const queryParams = new URLSearchParams();
27975
27978
  if (created_from) queryParams.append('created_from', created_from);
@@ -27989,13 +27992,14 @@ let SmoobuService = class SmoobuService {
27989
27992
  if (apartmentId) queryParams.append('apartmentId', apartmentId);
27990
27993
  if (includeRelated) queryParams.append('includeRelated', includeRelated);
27991
27994
  if (includePriceElements) queryParams.append('includePriceElements', includePriceElements);
27992
- return await this.call(`/reservations?${queryParams.toString()}`, 'GET');
27995
+ return await this.call(`/reservations?${queryParams.toString()}`, 'GET', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
27993
27996
  }
27994
- async sendMessage(params, _pinsSettingsList, _context) {
27997
+ async sendMessage(params, _pinsSettingsList, context) {
27998
+ var _context_protected;
27995
27999
  const { reservationId, message } = params;
27996
28000
  return await this.call(`/reservations/${reservationId}/messages/send-message-to-guest`, 'POST', JSON.stringify({
27997
28001
  messageBody: message
27998
- }));
28002
+ }), {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
27999
28003
  }
28000
28004
  async event(params, _pinsSettingsList, context) {
28001
28005
  const { updateRates = [], newReservation = [], cancelReservation = [], updateReservation = [] } = params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-smoobu",
3
- "version": "0.48.3",
3
+ "version": "0.49.0",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"