@twilio/conversations 2.3.0-rc.1 → 2.3.0-rc.2

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/README.md CHANGED
@@ -54,7 +54,7 @@ client.on('initFailed', ({ error }) => {
54
54
  Releases of `twilio-conversations.js` are hosted on a CDN, and you can include these
55
55
  directly in your web app using a `<script>` tag.
56
56
  ```html
57
- <script src="https://media.twiliocdn.com/sdk/js/conversations/v2.2/twilio-conversations.min.js"></script>
57
+ <script src="https://media.twiliocdn.com/sdk/js/conversations/v2.3/twilio-conversations.min.js"></script>
58
58
  ```
59
59
  Using this method, `twilio-conversations.js` will set a browser global `Twilio.Conversations` through which you can use the client:
60
60
  ```
@@ -72,7 +72,7 @@ number. While less flexible it is significantly more secure, which is required b
72
72
  To consume securely use the following script snippet format:
73
73
 
74
74
  ```html
75
- <script src="https://media.twiliocdn.com/sdk/js/conversations/releases/2.2.0/twilio-conversations.min.js"
75
+ <script src="https://media.twiliocdn.com/sdk/js/conversations/releases/2.3.0/twilio-conversations.min.js"
76
76
  integrity="sha256-<HASH FROM THE CHANGELOGS PAGE>"
77
77
  crossorigin="anonymous"></script>
78
78
  ```
package/builds/browser.js CHANGED
@@ -173,6 +173,7 @@ require('core-js/modules/es.regexp.exec.js');
173
173
  require('core-js/modules/es.string.replace.js');
174
174
  require('core-js/modules/es.array.join.js');
175
175
  var declarativeTypeValidator = require('@twilio/declarative-type-validator');
176
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
176
177
  require('core-js/modules/es.array.includes.js');
177
178
  var replayEventEmitter = require('@twilio/replay-event-emitter');
178
179
  var isEqual = require('lodash.isequal');
@@ -188,7 +189,6 @@ var twilsock = require('twilsock');
188
189
  var notifications = require('@twilio/notifications');
189
190
  var twilioSync = require('twilio-sync');
190
191
  var mcsClient = require('@twilio/mcs-client');
191
- var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
192
192
  require('core-js/modules/es.set.js');
193
193
  require('core-js/modules/es.number.is-integer.js');
194
194
  require('core-js/modules/es.typed-array.uint8-array.js');
@@ -259,9 +259,9 @@ var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallChec
259
259
  var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
260
260
  var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
261
261
  var loglevelLog__namespace = /*#__PURE__*/_interopNamespace(loglevelLog);
262
+ var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
262
263
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
263
264
  var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
264
- var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
265
265
 
266
266
  function __decorate(decorators, target, key, desc) {
267
267
  var c = arguments.length,
@@ -564,12 +564,17 @@ var UriBuilder = /*#__PURE__*/function () {
564
564
  return UriBuilder;
565
565
  }();
566
566
 
567
- var attributesValidator = declarativeTypeValidator.custom(function (value) {
567
+ var json = declarativeTypeValidator.custom(function (value) {
568
568
  return [["string", "number", "boolean", "object"].includes(_typeof__default["default"](value)), "a JSON type"];
569
569
  });
570
- var optionalAttributesValidator = declarativeTypeValidator.custom(function (value) {
570
+ var optionalJson = declarativeTypeValidator.custom(function (value) {
571
571
  return [["undefined", "string", "number", "boolean", "object"].includes(_typeof__default["default"](value)), "an optional JSON type"];
572
572
  });
573
+ var sendMediaOptions = declarativeTypeValidator.objectSchema("send media options", {
574
+ contentType: [declarativeTypeValidator.literal(null), "string"],
575
+ filename: ["string", "undefined"],
576
+ media: [declarativeTypeValidator.literal("null"), "string", Buffer].concat(_toConsumableArray__default["default"](typeof Blob === "function" ? [Blob] : []))
577
+ });
573
578
 
574
579
  function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
575
580
 
@@ -1076,7 +1081,7 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
1076
1081
  return User;
1077
1082
  }(replayEventEmitter.ReplayEventEmitter);
1078
1083
 
1079
- __decorate([declarativeTypeValidator.validateTypesAsync(attributesValidator), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], User.prototype, "updateAttributes", null);
1084
+ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], User.prototype, "updateAttributes", null);
1080
1085
 
1081
1086
  __decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
1082
1087
 
@@ -1630,7 +1635,7 @@ _defineProperty__default["default"](Participant, "typingEnded", "typingEnded");
1630
1635
 
1631
1636
  _defineProperty__default["default"](Participant, "updated", "updated");
1632
1637
 
1633
- __decorate([declarativeTypeValidator.validateTypesAsync(attributesValidator), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
1638
+ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
1634
1639
 
1635
1640
  function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
1636
1641
 
@@ -2765,7 +2770,7 @@ var ContentTemplate = /*#__PURE__*/_createClass__default["default"](
2765
2770
  */
2766
2771
 
2767
2772
  /**
2768
- * Variants of the content. See @{link ContentData}.
2773
+ * Variants of the content. See {@link ContentData}.
2769
2774
  */
2770
2775
 
2771
2776
  /**
@@ -2806,7 +2811,7 @@ function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !
2806
2811
  var log$3 = Logger.scope("Message");
2807
2812
 
2808
2813
  var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
2809
- global["XMLHttpRequest"] || require("xmlhttprequest").XMLHttpRequest;
2814
+ global["XMLHttpRequest"] || {};
2810
2815
  /**
2811
2816
  * A message in a conversation.
2812
2817
  */
@@ -3722,7 +3727,7 @@ __decorate([declarativeTypeValidator.validateTypes([declarativeTypeValidator.non
3722
3727
 
3723
3728
  __decorate([declarativeTypeValidator.validateTypesAsync("string"), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], Message.prototype, "updateBody", null);
3724
3729
 
3725
- __decorate([declarativeTypeValidator.validateTypesAsync(attributesValidator), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Message.prototype, "updateAttributes", null);
3730
+ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Message.prototype, "updateAttributes", null);
3726
3731
 
3727
3732
  __decorate([deprecationDecorator.deprecated("attachTemporaryUrlsFor", "getTemporaryContentUrlsForMedia"), __metadata("design:type", Function), __metadata("design:paramtypes", [Array]), __metadata("design:returntype", Promise)], Message.prototype, "attachTemporaryUrlsFor", null);
3728
3733
 
@@ -4580,20 +4585,25 @@ var MessageBuilder = /*#__PURE__*/function () {
4580
4585
  value: function buildAndSend() {
4581
4586
  return this.build().send();
4582
4587
  }
4583
- }, {
4584
- key: "getPayloadContentType",
4585
- value: function getPayloadContentType(payload) {
4586
- if (typeof FormData !== "undefined" && payload instanceof FormData) {
4587
- return payload.get("Content-Type");
4588
- }
4589
-
4590
- return payload.contentType;
4591
- }
4592
4588
  }]);
4593
4589
 
4594
4590
  return MessageBuilder;
4595
4591
  }();
4596
4592
 
4593
+ __decorate([declarativeTypeValidator.validateTypes("string"), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "setBody", null);
4594
+
4595
+ __decorate([declarativeTypeValidator.validateTypes("string"), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "setSubject", null);
4596
+
4597
+ __decorate([declarativeTypeValidator.validateTypes(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "setAttributes", null);
4598
+
4599
+ __decorate([declarativeTypeValidator.validateTypes("string", [FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "setEmailBody", null);
4600
+
4601
+ __decorate([declarativeTypeValidator.validateTypes("string", [FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "setEmailHistory", null);
4602
+
4603
+ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeValidator.array("content variables", ContentTemplateVariable), "undefined"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Array]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "setContentTemplate", null);
4604
+
4605
+ __decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
4606
+
4597
4607
  function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4598
4608
 
4599
4609
  function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
@@ -6420,9 +6430,9 @@ _defineProperty__default["default"](Conversation, "removed", "removed");
6420
6430
 
6421
6431
  _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conversation"));
6422
6432
 
6423
- __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalAttributesValidator), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
6433
+ __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
6424
6434
 
6425
- __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalAttributesValidator), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
6435
+ __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
6426
6436
 
6427
6437
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
6428
6438
 
@@ -6445,13 +6455,13 @@ __decorate([declarativeTypeValidator.validateTypesAsync(["string", FormData, dec
6445
6455
 
6446
6456
  return [isValid, "a non-empty string, an instance of Buffer or an instance of Blob"];
6447
6457
  })
6448
- })], optionalAttributesValidator, ["undefined", declarativeTypeValidator.literal(null), declarativeTypeValidator.objectSchema("email attributes", {
6458
+ })], optionalJson, ["undefined", declarativeTypeValidator.literal(null), declarativeTypeValidator.objectSchema("email attributes", {
6449
6459
  subject: [declarativeTypeValidator.nonEmptyString, "undefined"]
6450
6460
  })]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "sendMessage", null);
6451
6461
 
6452
6462
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.literal("default", "muted")), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], Conversation.prototype, "setUserNotificationLevel", null);
6453
6463
 
6454
- __decorate([declarativeTypeValidator.validateTypesAsync(attributesValidator), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "updateAttributes", null);
6464
+ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "updateAttributes", null);
6455
6465
 
6456
6466
  __decorate([declarativeTypeValidator.validateTypesAsync("string"), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], Conversation.prototype, "updateFriendlyName", null);
6457
6467
 
@@ -7764,7 +7774,7 @@ function PushNotification(data) {
7764
7774
  this.data = data.data || {};
7765
7775
  });
7766
7776
 
7767
- var version = "2.3.0-rc.1";
7777
+ var version = "2.3.0-rc.2";
7768
7778
 
7769
7779
  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; }
7770
7780