@twilio/conversations 2.3.0-rc.0 → 2.3.0-rc.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.
Files changed (67) hide show
  1. package/builds/browser.js +53 -30
  2. package/builds/browser.js.map +1 -1
  3. package/builds/lib.js +44 -30
  4. package/builds/lib.js.map +1 -1
  5. package/builds/twilio-conversations.js +54 -31
  6. package/builds/twilio-conversations.min.js +1 -1
  7. package/dist/aggregated-delivery-receipt.js +9 -0
  8. package/dist/aggregated-delivery-receipt.js.map +1 -1
  9. package/dist/client.js +9 -0
  10. package/dist/client.js.map +1 -1
  11. package/dist/command-executor.js +9 -0
  12. package/dist/command-executor.js.map +1 -1
  13. package/dist/configuration.js +9 -0
  14. package/dist/configuration.js.map +1 -1
  15. package/dist/content-client.js +9 -0
  16. package/dist/content-client.js.map +1 -1
  17. package/dist/content-template.js +9 -0
  18. package/dist/content-template.js.map +1 -1
  19. package/dist/conversation.js +9 -0
  20. package/dist/conversation.js.map +1 -1
  21. package/dist/data/conversations.js +9 -0
  22. package/dist/data/conversations.js.map +1 -1
  23. package/dist/data/messages.js +9 -0
  24. package/dist/data/messages.js.map +1 -1
  25. package/dist/data/participants.js +9 -0
  26. package/dist/data/participants.js.map +1 -1
  27. package/dist/data/users.js +9 -0
  28. package/dist/data/users.js.map +1 -1
  29. package/dist/detailed-delivery-receipt.js +9 -0
  30. package/dist/detailed-delivery-receipt.js.map +1 -1
  31. package/dist/index.js +9 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/interfaces/attributes.js +9 -0
  34. package/dist/interfaces/attributes.js.map +1 -1
  35. package/dist/interfaces/notification-types.js +9 -0
  36. package/dist/interfaces/notification-types.js.map +1 -1
  37. package/dist/logger.js +9 -0
  38. package/dist/logger.js.map +1 -1
  39. package/dist/media.js +9 -0
  40. package/dist/media.js.map +1 -1
  41. package/dist/message-builder.js +9 -0
  42. package/dist/message-builder.js.map +1 -1
  43. package/dist/message.js +34 -10
  44. package/dist/message.js.map +1 -1
  45. package/dist/node_modules/tslib/tslib.es6.js +9 -0
  46. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  47. package/dist/packages/conversations/package.json.js +10 -1
  48. package/dist/packages/conversations/package.json.js.map +1 -1
  49. package/dist/participant.js +9 -0
  50. package/dist/participant.js.map +1 -1
  51. package/dist/push-notification.js +9 -0
  52. package/dist/push-notification.js.map +1 -1
  53. package/dist/rest-paginator.js +9 -0
  54. package/dist/rest-paginator.js.map +1 -1
  55. package/dist/services/network.js +9 -0
  56. package/dist/services/network.js.map +1 -1
  57. package/dist/services/typing-indicator.js +9 -0
  58. package/dist/services/typing-indicator.js.map +1 -1
  59. package/dist/unsent-message.js +9 -0
  60. package/dist/unsent-message.js.map +1 -1
  61. package/dist/user.js +9 -0
  62. package/dist/user.js.map +1 -1
  63. package/dist/util/deferred.js +9 -0
  64. package/dist/util/deferred.js.map +1 -1
  65. package/dist/util/index.js +9 -0
  66. package/dist/util/index.js.map +1 -1
  67. package/package.json +9 -8
package/builds/browser.js CHANGED
@@ -128,6 +128,15 @@ This software includes platform.js under the following license.
128
128
  */
129
129
  'use strict';
130
130
 
131
+ var global =
132
+ typeof global !== "undefined"
133
+ ? global
134
+ : typeof self !== "undefined"
135
+ ? self
136
+ : typeof window !== "undefined"
137
+ ? window
138
+ : {};
139
+
131
140
  Object.defineProperty(exports, '__esModule', { value: true });
132
141
 
133
142
  require('core-js/modules/es.reflect.to-string-tag.js');
@@ -2795,10 +2804,14 @@ function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeRefl
2795
2804
 
2796
2805
  function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2797
2806
  var log$3 = Logger.scope("Message");
2807
+
2808
+ var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
2809
+ global["XMLHttpRequest"] || require("xmlhttprequest").XMLHttpRequest;
2798
2810
  /**
2799
2811
  * A message in a conversation.
2800
2812
  */
2801
2813
 
2814
+
2802
2815
  var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2803
2816
  _inherits__default["default"](Message, _ReplayEventEmitter);
2804
2817
 
@@ -3565,7 +3578,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3565
3578
 
3566
3579
  return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
3567
3580
  var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9(resolve, reject, onCancel) {
3568
- var bodies, twilioPrefix, filteredMedias, contentMedia, urlPromise, url, abortController, responsePromise, json, response, blob, text, dataType;
3581
+ var bodies, twilioPrefix, filteredMedias, contentMedia, urlPromise, url, jsonStringPromise, json, jsonString, dataType;
3569
3582
  return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context9) {
3570
3583
  while (1) {
3571
3584
  switch (_context9.prev = _context9.next) {
@@ -3634,49 +3647,59 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3634
3647
  return _context9.abrupt("return");
3635
3648
 
3636
3649
  case 28:
3637
- abortController = new AbortController();
3638
- responsePromise = fetch(url, {
3639
- signal: abortController.signal
3640
- });
3641
- onCancel(function () {
3642
- abortController.abort();
3650
+ jsonStringPromise = new Promise(function (resolve, reject) {
3651
+ var _url;
3652
+
3653
+ var isCancelled = false;
3654
+ var xhr = new XHR();
3655
+ xhr.open("GET", (_url = url) !== null && _url !== void 0 ? _url : "", true);
3656
+ xhr.responseType = "text";
3657
+
3658
+ xhr.onreadystatechange = function () {
3659
+ if (xhr.readyState !== 4 || isCancelled) {
3660
+ return;
3661
+ }
3662
+
3663
+ resolve(xhr.responseText);
3664
+ };
3665
+
3666
+ xhr.onerror = function () {
3667
+ reject(xhr.statusText);
3668
+ };
3669
+
3670
+ onCancel(function () {
3671
+ isCancelled = true;
3672
+ xhr.abort();
3673
+ reject(new Error("XHR has been aborted"));
3674
+ });
3675
+ xhr.send();
3643
3676
  });
3644
- _context9.prev = 31;
3645
- _context9.next = 34;
3646
- return responsePromise;
3677
+ _context9.prev = 29;
3678
+ _context9.next = 32;
3679
+ return jsonStringPromise;
3647
3680
 
3648
- case 34:
3649
- response = _context9.sent;
3650
- _context9.next = 37;
3651
- return response.blob();
3652
-
3653
- case 37:
3654
- blob = _context9.sent;
3681
+ case 32:
3682
+ jsonString = _context9.sent;
3683
+ json = JSON.parse(jsonString);
3655
3684
  _context9.next = 40;
3656
- return blob.text();
3657
-
3658
- case 40:
3659
- text = _context9.sent;
3660
- json = JSON.parse(text);
3661
- _context9.next = 48;
3662
3685
  break;
3663
3686
 
3664
- case 44:
3665
- _context9.prev = 44;
3666
- _context9.t1 = _context9["catch"](31);
3687
+ case 36:
3688
+ _context9.prev = 36;
3689
+ _context9.t1 = _context9["catch"](29);
3667
3690
  reject(_context9.t1);
3668
3691
  return _context9.abrupt("return");
3669
3692
 
3670
- case 48:
3693
+ case 40:
3671
3694
  dataType = contentMedia.contentType.replace(twilioPrefix, "").replace(".", "/");
3672
3695
  resolve(parseVariant(dataType, json.data));
3673
3696
 
3674
- case 50:
3697
+ case 42:
3675
3698
  case "end":
3676
3699
  return _context9.stop();
3677
3700
  }
3678
3701
  }
3679
- }, _callee9, null, [[15, 21], [31, 44]]);
3702
+ }, _callee9, null, [[15, 21], [29, 36]]);
3680
3703
  }));
3681
3704
 
3682
3705
  return function (_x8, _x9, _x10) {
@@ -7741,7 +7764,7 @@ function PushNotification(data) {
7741
7764
  this.data = data.data || {};
7742
7765
  });
7743
7766
 
7744
- var version = "2.3.0-rc.0";
7767
+ var version = "2.3.0-rc.1";
7745
7768
 
7746
7769
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7747
7770