@twilio/conversations 3.0.0-canary.9 → 3.0.0-rc.6

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 (54) hide show
  1. package/CHANGELOG.md +485 -0
  2. package/builds/browser.js +38 -23
  3. package/builds/browser.js.map +1 -1
  4. package/builds/lib.d.ts +1 -3
  5. package/builds/lib.js +38 -23
  6. package/builds/lib.js.map +1 -1
  7. package/builds/twilio-conversations.js +272 -61
  8. package/builds/twilio-conversations.min.js +1 -1
  9. package/dist/client.js +13 -5
  10. package/dist/client.js.map +1 -1
  11. package/dist/conversation.js +0 -4
  12. package/dist/conversation.js.map +1 -1
  13. package/dist/index.js +5 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/message.js +7 -3
  16. package/dist/message.js.map +1 -1
  17. package/dist/packages/conversations/package.json.js +1 -1
  18. package/docs/assets/css/main.css +2660 -0
  19. package/docs/assets/images/icons.png +0 -0
  20. package/docs/assets/images/icons@2x.png +0 -0
  21. package/docs/assets/images/widgets.png +0 -0
  22. package/docs/assets/images/widgets@2x.png +0 -0
  23. package/docs/assets/js/main.js +248 -0
  24. package/docs/assets/js/search.js +1 -0
  25. package/docs/classes/AggregatedDeliveryReceipt.html +3184 -0
  26. package/docs/classes/CancellablePromise.html +3213 -0
  27. package/docs/classes/Client.html +4239 -0
  28. package/docs/classes/Conversation.html +4354 -0
  29. package/docs/classes/DetailedDeliveryReceipt.html +3163 -0
  30. package/docs/classes/Media.html +3167 -0
  31. package/docs/classes/Message.html +3732 -0
  32. package/docs/classes/MessageBuilder.html +3277 -0
  33. package/docs/classes/Participant.html +3444 -0
  34. package/docs/classes/PushNotification.html +3130 -0
  35. package/docs/classes/RestPaginator.html +3160 -0
  36. package/docs/classes/UnsentMessage.html +3042 -0
  37. package/docs/classes/User.html +3349 -0
  38. package/docs/index.html +3509 -0
  39. package/docs/interfaces/ClientOptions.html +3034 -0
  40. package/docs/interfaces/ConversationBindings.html +3001 -0
  41. package/docs/interfaces/ConversationEmailBinding.html +3001 -0
  42. package/docs/interfaces/ConversationLimits.html +3098 -0
  43. package/docs/interfaces/ConversationState.html +3050 -0
  44. package/docs/interfaces/ConversationUpdatedEventArgs.html +3001 -0
  45. package/docs/interfaces/CreateConversationOptions.html +3066 -0
  46. package/docs/interfaces/LastMessage.html +3050 -0
  47. package/docs/interfaces/Paginator.html +3141 -0
  48. package/docs/interfaces/ParticipantBindings.html +3001 -0
  49. package/docs/interfaces/ParticipantEmailBinding.html +3001 -0
  50. package/docs/interfaces/PushNotificationData.html +3114 -0
  51. package/docs/interfaces/SendEmailOptions.html +3034 -0
  52. package/docs/interfaces/SendMediaOptions.html +3068 -0
  53. package/docs/modules.html +3510 -0
  54. package/package.json +11 -12
package/builds/lib.d.ts CHANGED
@@ -1692,8 +1692,6 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
1692
1692
  * argument, it will assume that the string is an identity or SID.
1693
1693
  * @param participant Identity, SID or the participant object to remove.
1694
1694
  */
1695
- /* eslint-disable @typescript-eslint/ban-ts-comment */
1696
- // @ts-ignore TODO: fix validateTypesAsync typing
1697
1695
  removeParticipant(participant: string | Participant): Promise<void>;
1698
1696
  /**
1699
1697
  * Send a message to the conversation.
@@ -2442,4 +2440,4 @@ declare class NotificationTypes {
2442
2440
  static readonly REMOVED_FROM_CONVERSATION = "twilio.conversations.removed_from_conversation";
2443
2441
  static readonly CONSUMPTION_UPDATE = "twilio.channel.consumption_update";
2444
2442
  }
2445
- export { Conversation, ConversationBindings, ConversationEmailBinding, ConversationUpdateReason, ConversationStatus, NotificationLevel, ConversationState, ConversationUpdatedEventArgs, SendMediaOptions, SendEmailOptions, LastMessage, Participant, ParticipantUpdateReason, ParticipantType, ParticipantUpdatedEventArgs, ParticipantBindings, ParticipantEmailBinding, ParticipantEmailLevel, Message, MessageUpdateReason, MessageType, MessageUpdatedEventArgs, Media, MediaCategory$0 as MediaCategory, AggregatedDeliveryReceipt, DeliveryAmount, DetailedDeliveryReceipt, DeliveryStatus, RestPaginator, MessageBuilder, UnsentMessage, Paginator, ParticipantBindingOptions, User, UserUpdateReason, UserUpdatedEventArgs, PushNotification, PushNotificationType, PushNotificationDescriptor, PushNotificationData, NotificationTypes, Client, State, ConnectionState, NotificationsChannelType, ClientOptions, CreateConversationOptions, ConversationLimits, JSONValue, JSONObject, JSONArray };
2443
+ export { Conversation, ConversationBindings, ConversationEmailBinding, ConversationUpdateReason, ConversationStatus, NotificationLevel, ConversationState, ConversationUpdatedEventArgs, SendMediaOptions, SendEmailOptions, LastMessage, Participant, ParticipantUpdateReason, ParticipantType, ParticipantUpdatedEventArgs, ParticipantBindings, ParticipantEmailBinding, ParticipantEmailLevel, Message, MessageUpdateReason, MessageType, MessageUpdatedEventArgs, Media, MediaCategory$0 as MediaCategory, AggregatedDeliveryReceipt, DeliveryAmount, DetailedDeliveryReceipt, DeliveryStatus, RestPaginator, MessageBuilder, UnsentMessage, Paginator, ParticipantBindingOptions, User, UserUpdateReason, UserUpdatedEventArgs, PushNotification, PushNotificationType, PushNotificationDescriptor, PushNotificationData, NotificationTypes, Client, State, ConnectionState, NotificationsChannelType, ClientOptions, CreateConversationOptions, ConversationLimits, JSONValue, JSONObject, JSONArray, CancellablePromise };
package/builds/lib.js CHANGED
@@ -389,9 +389,9 @@ var Logger = /*#__PURE__*/function () {
389
389
  return Logger;
390
390
  }();
391
391
 
392
- function ownKeys$3(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; }
392
+ function ownKeys$4(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; }
393
393
 
394
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
394
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
395
395
  var TYPING_TIMEOUT = 5;
396
396
  var HTTP_CACHE_LIFETIME = "PT5S";
397
397
  var CONSUMPTION_HORIZON_SENDING_INTERVAL = "PT5S";
@@ -432,7 +432,7 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
432
432
  emailBodiesAllowedContentTypes: configurationResponse.options.email_bodies_allowed_mime_types
433
433
  };
434
434
  this.typingIndicatorTimeoutOverride = constructorOptions.typingIndicatorTimeoutOverride;
435
- this.backoffConfiguration = _objectSpread$3({
435
+ this.backoffConfiguration = _objectSpread$4({
436
436
  min: MINIMUM_RETRY_DELAY,
437
437
  max: MAXIMUM_RETRY_DELAY,
438
438
  maxAttemptsCount: MAXIMUM_ATTEMPTS_COUNT
@@ -2557,6 +2557,10 @@ function DetailedDeliveryReceipt(descriptor) {
2557
2557
  this.dateUpdated = descriptor.date_updated;
2558
2558
  });
2559
2559
 
2560
+ function ownKeys$3(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; }
2561
+
2562
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2563
+
2560
2564
  function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); 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); }; }
2561
2565
 
2562
2566
  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; } }
@@ -2600,10 +2604,12 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2600
2604
  lastUpdatedBy: (_data$lastUpdatedBy = data.lastUpdatedBy) !== null && _data$lastUpdatedBy !== void 0 ? _data$lastUpdatedBy : null,
2601
2605
  attributes: parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(data.sid), log$3),
2602
2606
  type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type : "text",
2603
- media: data.type && data.type === "media" && data.media ? new Media(data.media, _this.services) : null,
2604
- medias: data.type && data.type === "media" && data.medias ? data.medias.map(function (m) {
2607
+ media: data.type === "media" && data.media ? new Media(data.media, _this.services) : null,
2608
+ medias: data.type === "media" && data.medias ? data.medias.map(function (m) {
2605
2609
  return new Media(m, _this.services);
2606
- }) : null,
2610
+ }) : data.type === "media" && data.media && !data.medias ? [new Media(_objectSpread$3(_objectSpread$3({}, data.media), {}, {
2611
+ category: "media"
2612
+ }), _this.services)] : null,
2607
2613
  participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
2608
2614
  aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null
2609
2615
  };
@@ -5005,9 +5011,6 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
5005
5011
  * @param participant Identity, SID or the participant object to remove.
5006
5012
  */
5007
5013
 
5008
- /* eslint-disable @typescript-eslint/ban-ts-comment */
5009
- // @ts-ignore TODO: fix validateTypesAsync typing
5010
-
5011
5014
  }, {
5012
5015
  key: "removeParticipant",
5013
5016
  value: function () {
@@ -5869,10 +5872,7 @@ __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator
5869
5872
 
5870
5873
  __decorate([declarativeTypeValidator.validateTypesAsync([declarativeTypeValidator.nonEmptyString, Participant]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "removeParticipant", null);
5871
5874
 
5872
- __decorate([declarativeTypeValidator.validateTypesAsync(["string",
5873
- /* eslint-disable @typescript-eslint/ban-ts-comment */
5874
- // @ts-ignore TODO: fix validateTypesAsync typing
5875
- FormData, declarativeTypeValidator.literal(null), declarativeTypeValidator.objectSchema("media options", {
5875
+ __decorate([declarativeTypeValidator.validateTypesAsync(["string", FormData, declarativeTypeValidator.literal(null), declarativeTypeValidator.objectSchema("media options", {
5876
5876
  contentType: declarativeTypeValidator.nonEmptyString,
5877
5877
  media: declarativeTypeValidator.custom(function (value) {
5878
5878
  var isValid = typeof value === "string" && value.length > 0 || value instanceof Uint8Array || value instanceof ArrayBuffer;
@@ -7170,7 +7170,7 @@ function PushNotification(data) {
7170
7170
  this.data = data.data || {};
7171
7171
  });
7172
7172
 
7173
- var version = "3.0.0-rc.2";
7173
+ var version = "3.0.0-rc.6";
7174
7174
 
7175
7175
  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; }
7176
7176
 
@@ -7761,10 +7761,15 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
7761
7761
 
7762
7762
  _this._services.twilsockClient.onceWithReplay("connectionError", emitFailed);
7763
7763
 
7764
- _this._services.twilsockClient.onceWithReplay("disconnected", emitFailed);
7764
+ _this._services.twilsockClient.onceWithReplay("disconnected", function () {
7765
+ return emitFailed({
7766
+ terminal: true,
7767
+ message: "Twilsock has disconnected."
7768
+ });
7769
+ });
7765
7770
 
7766
7771
  _this._services.twilsockClient.onceWithReplay("connected", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
7767
- var startupEvent;
7772
+ var startupEvent, connectionError;
7768
7773
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
7769
7774
  while (1) {
7770
7775
  switch (_context.prev = _context.next) {
@@ -7786,22 +7791,26 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
7786
7791
  case 8:
7787
7792
  _this._services.twilsockClient.addPartialTelemetryEvent(new twilsock.TelemetryEventDescription("", "", new Date()), startupEvent, twilsock.TelemetryPoint.End);
7788
7793
 
7789
- _context.next = 15;
7794
+ _context.next = 16;
7790
7795
  break;
7791
7796
 
7792
7797
  case 11:
7793
7798
  _context.prev = 11;
7794
7799
  _context.t0 = _context["catch"](3);
7795
-
7796
7800
  // Fail ChatClient if initialization is incomplete
7797
- _this._rejectEnsureReady(_context.t0);
7801
+ connectionError = {
7802
+ terminal: true,
7803
+ message: _context.t0.message
7804
+ };
7805
+
7806
+ _this._rejectEnsureReady(connectionError);
7798
7807
 
7799
7808
  _this.emit("stateChanged", {
7800
7809
  state: "failed",
7801
- error: _context.t0
7810
+ error: connectionError
7802
7811
  });
7803
7812
 
7804
- case 15:
7813
+ case 16:
7805
7814
  case "end":
7806
7815
  return _context.stop();
7807
7816
  }
@@ -8706,8 +8715,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
8706
8715
  if (typeof apsPayload.alert === "string") {
8707
8716
  body = apsPayload.alert || null;
8708
8717
  } else {
8709
- body = apsPayload.alert.body || null;
8710
- title = apsPayload.alert.title || null;
8718
+ var _apsPayload$alert, _apsPayload$alert2;
8719
+
8720
+ body = ((_apsPayload$alert = apsPayload.alert) === null || _apsPayload$alert === void 0 ? void 0 : _apsPayload$alert.body) || null;
8721
+ title = ((_apsPayload$alert2 = apsPayload.alert) === null || _apsPayload$alert2 === void 0 ? void 0 : _apsPayload$alert2.title) || null;
8711
8722
  }
8712
8723
 
8713
8724
  return new PushNotification({
@@ -8846,6 +8857,10 @@ __decorate([declarativeTypeValidator.validateTypes(declarativeTypeValidator.pure
8846
8857
 
8847
8858
  exports.Client = Client_1 = __decorate([declarativeTypeValidator.validateConstructorTypes(declarativeTypeValidator.nonEmptyString, [declarativeTypeValidator.pureObject, "undefined"]), __metadata("design:paramtypes", [String, Object])], exports.Client);
8848
8859
 
8860
+ Object.defineProperty(exports, 'CancellablePromise', {
8861
+ enumerable: true,
8862
+ get: function () { return mcsClient.CancellablePromise; }
8863
+ });
8849
8864
  exports.AggregatedDeliveryReceipt = AggregatedDeliveryReceipt;
8850
8865
  exports.Conversation = Conversation;
8851
8866
  exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;