@digipair/skill-twilio 0.48.3 → 0.49.1

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
@@ -14,8 +14,9 @@ function _extends() {
14
14
  }
15
15
 
16
16
  let TwilioService = class TwilioService {
17
- async call(url, method, data, headers) {
17
+ async call(url, method, data, headers, signal) {
18
18
  const response = await fetch(`${this.API_ENDPOINT}${url}`, {
19
+ signal,
19
20
  method,
20
21
  headers: _extends({
21
22
  Authorization: 'Basic ' + btoa(this.TWILIO_SID + ':' + this.TWILIO_TOKEN)
@@ -25,11 +26,12 @@ let TwilioService = class TwilioService {
25
26
  if (!response.ok) throw new Error('[SKILL-TWILIO] REQUEST FAILED: ' + response.status);
26
27
  return await response.json();
27
28
  }
28
- async sendSms(params, _pinsSettingsList, _context, whatsapp = false) {
29
+ async sendSms(params, _pinsSettingsList, context, whatsapp = false) {
30
+ var _context_protected;
29
31
  const { message, phoneNumber } = params;
30
32
  return await this.call(`/Accounts/${this.TWILIO_SID}/Messages.json`, 'POST', `From=${encodeURIComponent(`${whatsapp ? 'whatsapp:' : ''}${this.FROM_NUMBER}`)}&Body=${encodeURIComponent(message)}&To=${encodeURIComponent(`${phoneNumber}`)}`, {
31
33
  'Content-Type': 'application/x-www-form-urlencoded'
32
- });
34
+ }, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
33
35
  }
34
36
  constructor(context, params){
35
37
  var _context_privates_TWILIO_SID, _ref;
package/index.esm.js CHANGED
@@ -10,8 +10,9 @@ function _extends() {
10
10
  }
11
11
 
12
12
  let TwilioService = class TwilioService {
13
- async call(url, method, data, headers) {
13
+ async call(url, method, data, headers, signal) {
14
14
  const response = await fetch(`${this.API_ENDPOINT}${url}`, {
15
+ signal,
15
16
  method,
16
17
  headers: _extends({
17
18
  Authorization: 'Basic ' + btoa(this.TWILIO_SID + ':' + this.TWILIO_TOKEN)
@@ -21,11 +22,12 @@ let TwilioService = class TwilioService {
21
22
  if (!response.ok) throw new Error('[SKILL-TWILIO] REQUEST FAILED: ' + response.status);
22
23
  return await response.json();
23
24
  }
24
- async sendSms(params, _pinsSettingsList, _context, whatsapp = false) {
25
+ async sendSms(params, _pinsSettingsList, context, whatsapp = false) {
26
+ var _context_protected;
25
27
  const { message, phoneNumber } = params;
26
28
  return await this.call(`/Accounts/${this.TWILIO_SID}/Messages.json`, 'POST', `From=${encodeURIComponent(`${whatsapp ? 'whatsapp:' : ''}${this.FROM_NUMBER}`)}&Body=${encodeURIComponent(message)}&To=${encodeURIComponent(`${phoneNumber}`)}`, {
27
29
  'Content-Type': 'application/x-www-form-urlencoded'
28
- });
30
+ }, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
29
31
  }
30
32
  constructor(context, params){
31
33
  var _context_privates_TWILIO_SID, _ref;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-twilio",
3
- "version": "0.48.3",
3
+ "version": "0.49.1",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"