@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/lib.js CHANGED
@@ -2795,10 +2795,14 @@ function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeRefl
2795
2795
 
2796
2796
  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
2797
  var log$3 = Logger.scope("Message");
2798
+
2799
+ var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
2800
+ global["XMLHttpRequest"] || require("xmlhttprequest").XMLHttpRequest;
2798
2801
  /**
2799
2802
  * A message in a conversation.
2800
2803
  */
2801
2804
 
2805
+
2802
2806
  var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2803
2807
  _inherits__default["default"](Message, _ReplayEventEmitter);
2804
2808
 
@@ -3565,7 +3569,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3565
3569
 
3566
3570
  return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
3567
3571
  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;
3572
+ var bodies, twilioPrefix, filteredMedias, contentMedia, urlPromise, url, jsonStringPromise, json, jsonString, dataType;
3569
3573
  return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context9) {
3570
3574
  while (1) {
3571
3575
  switch (_context9.prev = _context9.next) {
@@ -3634,49 +3638,59 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3634
3638
  return _context9.abrupt("return");
3635
3639
 
3636
3640
  case 28:
3637
- abortController = new AbortController();
3638
- responsePromise = fetch(url, {
3639
- signal: abortController.signal
3640
- });
3641
- onCancel(function () {
3642
- abortController.abort();
3641
+ jsonStringPromise = new Promise(function (resolve, reject) {
3642
+ var _url;
3643
+
3644
+ var isCancelled = false;
3645
+ var xhr = new XHR();
3646
+ xhr.open("GET", (_url = url) !== null && _url !== void 0 ? _url : "", true);
3647
+ xhr.responseType = "text";
3648
+
3649
+ xhr.onreadystatechange = function () {
3650
+ if (xhr.readyState !== 4 || isCancelled) {
3651
+ return;
3652
+ }
3653
+
3654
+ resolve(xhr.responseText);
3655
+ };
3656
+
3657
+ xhr.onerror = function () {
3658
+ reject(xhr.statusText);
3659
+ };
3660
+
3661
+ onCancel(function () {
3662
+ isCancelled = true;
3663
+ xhr.abort();
3664
+ reject(new Error("XHR has been aborted"));
3665
+ });
3666
+ xhr.send();
3643
3667
  });
3644
- _context9.prev = 31;
3645
- _context9.next = 34;
3646
- return responsePromise;
3668
+ _context9.prev = 29;
3669
+ _context9.next = 32;
3670
+ return jsonStringPromise;
3647
3671
 
3648
- case 34:
3649
- response = _context9.sent;
3650
- _context9.next = 37;
3651
- return response.blob();
3652
-
3653
- case 37:
3654
- blob = _context9.sent;
3672
+ case 32:
3673
+ jsonString = _context9.sent;
3674
+ json = JSON.parse(jsonString);
3655
3675
  _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
3676
  break;
3663
3677
 
3664
- case 44:
3665
- _context9.prev = 44;
3666
- _context9.t1 = _context9["catch"](31);
3678
+ case 36:
3679
+ _context9.prev = 36;
3680
+ _context9.t1 = _context9["catch"](29);
3667
3681
  reject(_context9.t1);
3668
3682
  return _context9.abrupt("return");
3669
3683
 
3670
- case 48:
3684
+ case 40:
3671
3685
  dataType = contentMedia.contentType.replace(twilioPrefix, "").replace(".", "/");
3672
3686
  resolve(parseVariant(dataType, json.data));
3673
3687
 
3674
- case 50:
3688
+ case 42:
3675
3689
  case "end":
3676
3690
  return _context9.stop();
3677
3691
  }
3678
3692
  }
3679
- }, _callee9, null, [[15, 21], [31, 44]]);
3693
+ }, _callee9, null, [[15, 21], [29, 36]]);
3680
3694
  }));
3681
3695
 
3682
3696
  return function (_x8, _x9, _x10) {
@@ -7741,7 +7755,7 @@ function PushNotification(data) {
7741
7755
  this.data = data.data || {};
7742
7756
  });
7743
7757
 
7744
- var version = "2.3.0-rc.0";
7758
+ var version = "2.3.0-rc.1";
7745
7759
 
7746
7760
  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
7761