@twilio/conversations 3.0.1-rc.102 → 3.0.1-rc.103
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/builds/browser.js +357 -87
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +124 -27
- package/builds/lib.js +357 -87
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +378 -108
- package/builds/twilio-conversations.min.js +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/configuration.js +8 -4
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +6 -0
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/message-recipients-client.js +237 -0
- package/dist/message-recipients-client.js.map +1 -0
- package/dist/message.js +6 -0
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/Conversation.html +23 -0
- package/docs/classes/EmailRecipientDescriptor.html +3098 -0
- package/docs/classes/Message.html +23 -0
- package/docs/classes/UnknownRecipientDescriptor.html +3067 -0
- package/docs/index.html +41 -1
- package/docs/interfaces/ClientOptions.html +16 -0
- package/docs/modules.html +40 -0
- package/package.json +2 -2
package/builds/browser.js
CHANGED
@@ -414,9 +414,11 @@ var MINIMUM_RETRY_DELAY = 1000;
|
|
414
414
|
var MAXIMUM_RETRY_DELAY = 4000;
|
415
415
|
var MAXIMUM_ATTEMPTS_COUNT = 3;
|
416
416
|
var RETRY_WHEN_THROTTLED = true;
|
417
|
+
var CHANNEL_METADATA_CACHE_CAPACITY = 100;
|
418
|
+
var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
|
417
419
|
|
418
420
|
var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
|
419
|
-
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
|
421
|
+
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad, _options$messageRecip;
|
420
422
|
|
421
423
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
422
424
|
var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
|
@@ -475,7 +477,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
|
|
475
477
|
this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
|
476
478
|
}
|
477
479
|
|
478
|
-
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad :
|
480
|
+
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : CHANNEL_METADATA_CACHE_CAPACITY;
|
481
|
+
this.messageRecipientsCacheCapacity = (_options$messageRecip = options.messageRecipientsCacheCapacity) !== null && _options$messageRecip !== void 0 ? _options$messageRecip : MESSAGE_RECIPIENTS_CACHE_CAPACITY;
|
479
482
|
});
|
480
483
|
|
481
484
|
/**
|
@@ -1093,11 +1096,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
|
|
1093
1096
|
|
1094
1097
|
__decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
|
1095
1098
|
|
1096
|
-
function _createForOfIteratorHelper$
|
1099
|
+
function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(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; } } }; }
|
1097
1100
|
|
1098
|
-
function _unsupportedIterableToArray$
|
1101
|
+
function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(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$5(o, minLen); }
|
1099
1102
|
|
1100
|
-
function _arrayLikeToArray$
|
1103
|
+
function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
1101
1104
|
|
1102
1105
|
var Network = /*#__PURE__*/function () {
|
1103
1106
|
function Network(configuration, services) {
|
@@ -1118,7 +1121,7 @@ var Network = /*#__PURE__*/function () {
|
|
1118
1121
|
}, {
|
1119
1122
|
key: "cleanupCache",
|
1120
1123
|
value: function cleanupCache() {
|
1121
|
-
var _iterator = _createForOfIteratorHelper$
|
1124
|
+
var _iterator = _createForOfIteratorHelper$5(this.cache),
|
1122
1125
|
_step;
|
1123
1126
|
|
1124
1127
|
try {
|
@@ -3762,6 +3765,38 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3762
3765
|
|
3763
3766
|
return getChannelMetadata;
|
3764
3767
|
}()
|
3768
|
+
/**
|
3769
|
+
* Get recipients of the message.
|
3770
|
+
*/
|
3771
|
+
|
3772
|
+
}, {
|
3773
|
+
key: "getMessageRecipients",
|
3774
|
+
value: function () {
|
3775
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11() {
|
3776
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context11) {
|
3777
|
+
while (1) {
|
3778
|
+
switch (_context11.prev = _context11.next) {
|
3779
|
+
case 0:
|
3780
|
+
_context11.next = 2;
|
3781
|
+
return this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid, this.sid);
|
3782
|
+
|
3783
|
+
case 2:
|
3784
|
+
return _context11.abrupt("return", _context11.sent);
|
3785
|
+
|
3786
|
+
case 3:
|
3787
|
+
case "end":
|
3788
|
+
return _context11.stop();
|
3789
|
+
}
|
3790
|
+
}
|
3791
|
+
}, _callee11, this);
|
3792
|
+
}));
|
3793
|
+
|
3794
|
+
function getMessageRecipients() {
|
3795
|
+
return _getMessageRecipients.apply(this, arguments);
|
3796
|
+
}
|
3797
|
+
|
3798
|
+
return getMessageRecipients;
|
3799
|
+
}()
|
3765
3800
|
}]);
|
3766
3801
|
|
3767
3802
|
return Message;
|
@@ -3789,11 +3824,11 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
3789
3824
|
|
3790
3825
|
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; }
|
3791
3826
|
|
3792
|
-
function _createForOfIteratorHelper$
|
3827
|
+
function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(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; } } }; }
|
3793
3828
|
|
3794
|
-
function _unsupportedIterableToArray$
|
3829
|
+
function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(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$4(o, minLen); }
|
3795
3830
|
|
3796
|
-
function _arrayLikeToArray$
|
3831
|
+
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
3797
3832
|
|
3798
3833
|
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); }; }
|
3799
3834
|
|
@@ -4001,7 +4036,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
4001
4036
|
return request.cancel();
|
4002
4037
|
});
|
4003
4038
|
});
|
4004
|
-
_iterator = _createForOfIteratorHelper$
|
4039
|
+
_iterator = _createForOfIteratorHelper$4(message.mediaContent);
|
4005
4040
|
_context3.prev = 4;
|
4006
4041
|
|
4007
4042
|
_iterator.s();
|
@@ -4654,11 +4689,11 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
|
|
4654
4689
|
|
4655
4690
|
__decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
|
4656
4691
|
|
4657
|
-
function _createForOfIteratorHelper$
|
4692
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(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; } } }; }
|
4658
4693
|
|
4659
|
-
function _unsupportedIterableToArray$
|
4694
|
+
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(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$3(o, minLen); }
|
4660
4695
|
|
4661
|
-
function _arrayLikeToArray$
|
4696
|
+
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
4662
4697
|
|
4663
4698
|
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); 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); }; }
|
4664
4699
|
|
@@ -5944,6 +5979,38 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
5944
5979
|
|
5945
5980
|
return updateUniqueName;
|
5946
5981
|
}()
|
5982
|
+
/**
|
5983
|
+
* Get recipients of all messages in the conversation.
|
5984
|
+
*/
|
5985
|
+
|
5986
|
+
}, {
|
5987
|
+
key: "getMessageRecipients",
|
5988
|
+
value: function () {
|
5989
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24() {
|
5990
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
|
5991
|
+
while (1) {
|
5992
|
+
switch (_context24.prev = _context24.next) {
|
5993
|
+
case 0:
|
5994
|
+
_context24.next = 2;
|
5995
|
+
return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid);
|
5996
|
+
|
5997
|
+
case 2:
|
5998
|
+
return _context24.abrupt("return", _context24.sent);
|
5999
|
+
|
6000
|
+
case 3:
|
6001
|
+
case "end":
|
6002
|
+
return _context24.stop();
|
6003
|
+
}
|
6004
|
+
}
|
6005
|
+
}, _callee24, this);
|
6006
|
+
}));
|
6007
|
+
|
6008
|
+
function getMessageRecipients() {
|
6009
|
+
return _getMessageRecipients.apply(this, arguments);
|
6010
|
+
}
|
6011
|
+
|
6012
|
+
return getMessageRecipients;
|
6013
|
+
}()
|
5947
6014
|
/**
|
5948
6015
|
* Load and subscribe to this conversation and do not subscribe to its
|
5949
6016
|
* participants and messages. This or _subscribeStreams will need to be called
|
@@ -5954,31 +6021,31 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
5954
6021
|
}, {
|
5955
6022
|
key: "_subscribe",
|
5956
6023
|
value: function () {
|
5957
|
-
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6024
|
+
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee25() {
|
5958
6025
|
var _this2 = this;
|
5959
6026
|
|
5960
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6027
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
|
5961
6028
|
while (1) {
|
5962
|
-
switch (
|
6029
|
+
switch (_context25.prev = _context25.next) {
|
5963
6030
|
case 0:
|
5964
6031
|
if (!this._entityPromise) {
|
5965
|
-
|
6032
|
+
_context25.next = 2;
|
5966
6033
|
break;
|
5967
6034
|
}
|
5968
6035
|
|
5969
|
-
return
|
6036
|
+
return _context25.abrupt("return", this._entityPromise);
|
5970
6037
|
|
5971
6038
|
case 2:
|
5972
6039
|
this._entityPromise = this._services.syncClient.document({
|
5973
6040
|
id: this._entityName,
|
5974
6041
|
mode: "open_existing"
|
5975
6042
|
});
|
5976
|
-
|
5977
|
-
|
6043
|
+
_context25.prev = 3;
|
6044
|
+
_context25.next = 6;
|
5978
6045
|
return this._entityPromise;
|
5979
6046
|
|
5980
6047
|
case 6:
|
5981
|
-
this._entity =
|
6048
|
+
this._entity = _context25.sent;
|
5982
6049
|
|
5983
6050
|
this._entity.on("updated", function (args) {
|
5984
6051
|
return _this2._update(args.data);
|
@@ -5990,28 +6057,28 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
5990
6057
|
|
5991
6058
|
this._update(this._entity.data);
|
5992
6059
|
|
5993
|
-
return
|
6060
|
+
return _context25.abrupt("return", this._entity);
|
5994
6061
|
|
5995
6062
|
case 13:
|
5996
|
-
|
5997
|
-
|
6063
|
+
_context25.prev = 13;
|
6064
|
+
_context25.t0 = _context25["catch"](3);
|
5998
6065
|
this._entity = null;
|
5999
6066
|
this._entityPromise = null;
|
6000
6067
|
|
6001
6068
|
if (this._services.syncClient.connectionState != "disconnected") {
|
6002
|
-
Conversation._logger.error("Failed to get conversation object",
|
6069
|
+
Conversation._logger.error("Failed to get conversation object", _context25.t0);
|
6003
6070
|
}
|
6004
6071
|
|
6005
|
-
Conversation._logger.debug("ERROR: Failed to get conversation object",
|
6072
|
+
Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
|
6006
6073
|
|
6007
|
-
throw
|
6074
|
+
throw _context25.t0;
|
6008
6075
|
|
6009
6076
|
case 20:
|
6010
6077
|
case "end":
|
6011
|
-
return
|
6078
|
+
return _context25.stop();
|
6012
6079
|
}
|
6013
6080
|
}
|
6014
|
-
},
|
6081
|
+
}, _callee25, this, [[3, 13]]);
|
6015
6082
|
}));
|
6016
6083
|
|
6017
6084
|
function _subscribe() {
|
@@ -6033,44 +6100,44 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6033
6100
|
}, {
|
6034
6101
|
key: "_fetchStreams",
|
6035
6102
|
value: function () {
|
6036
|
-
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6103
|
+
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26() {
|
6037
6104
|
var _this$_entity, _this$_entity2;
|
6038
6105
|
|
6039
6106
|
var data;
|
6040
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6107
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
|
6041
6108
|
while (1) {
|
6042
|
-
switch (
|
6109
|
+
switch (_context26.prev = _context26.next) {
|
6043
6110
|
case 0:
|
6044
|
-
|
6111
|
+
_context26.next = 2;
|
6045
6112
|
return this._subscribe();
|
6046
6113
|
|
6047
6114
|
case 2:
|
6048
6115
|
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
6049
6116
|
|
6050
6117
|
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
6051
|
-
|
6118
|
+
_context26.next = 6;
|
6052
6119
|
return this._services.syncClient.list({
|
6053
6120
|
id: data.messages,
|
6054
6121
|
mode: "open_existing"
|
6055
6122
|
});
|
6056
6123
|
|
6057
6124
|
case 6:
|
6058
|
-
this._messagesList =
|
6059
|
-
|
6125
|
+
this._messagesList = _context26.sent;
|
6126
|
+
_context26.next = 9;
|
6060
6127
|
return this._services.syncClient.map({
|
6061
6128
|
id: data.roster,
|
6062
6129
|
mode: "open_existing"
|
6063
6130
|
});
|
6064
6131
|
|
6065
6132
|
case 9:
|
6066
|
-
this._participantsMap =
|
6133
|
+
this._participantsMap = _context26.sent;
|
6067
6134
|
|
6068
6135
|
case 10:
|
6069
6136
|
case "end":
|
6070
|
-
return
|
6137
|
+
return _context26.stop();
|
6071
6138
|
}
|
6072
6139
|
}
|
6073
|
-
},
|
6140
|
+
}, _callee26, this);
|
6074
6141
|
}));
|
6075
6142
|
|
6076
6143
|
function _fetchStreams() {
|
@@ -6090,15 +6157,15 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6090
6157
|
}, {
|
6091
6158
|
key: "_subscribeStreams",
|
6092
6159
|
value: function () {
|
6093
|
-
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6160
|
+
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
|
6094
6161
|
var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
|
6095
6162
|
|
6096
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6163
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
|
6097
6164
|
while (1) {
|
6098
|
-
switch (
|
6165
|
+
switch (_context27.prev = _context27.next) {
|
6099
6166
|
case 0:
|
6100
|
-
|
6101
|
-
|
6167
|
+
_context27.prev = 0;
|
6168
|
+
_context27.next = 3;
|
6102
6169
|
return this._subscribe();
|
6103
6170
|
|
6104
6171
|
case 3:
|
@@ -6107,31 +6174,31 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6107
6174
|
data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
|
6108
6175
|
messagesObjectName = data.messages;
|
6109
6176
|
rosterObjectName = data.roster;
|
6110
|
-
|
6177
|
+
_context27.next = 9;
|
6111
6178
|
return Promise.all([this._messagesEntity.subscribe((_this$_messagesList = this._messagesList) !== null && _this$_messagesList !== void 0 ? _this$_messagesList : messagesObjectName), this._participantsEntity.subscribe((_this$_participantsMa = this._participantsMap) !== null && _this$_participantsMa !== void 0 ? _this$_participantsMa : rosterObjectName)]);
|
6112
6179
|
|
6113
6180
|
case 9:
|
6114
|
-
|
6181
|
+
_context27.next = 16;
|
6115
6182
|
break;
|
6116
6183
|
|
6117
6184
|
case 11:
|
6118
|
-
|
6119
|
-
|
6185
|
+
_context27.prev = 11;
|
6186
|
+
_context27.t0 = _context27["catch"](0);
|
6120
6187
|
|
6121
6188
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
6122
|
-
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid,
|
6189
|
+
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
6123
6190
|
}
|
6124
6191
|
|
6125
|
-
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid,
|
6192
|
+
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
6126
6193
|
|
6127
|
-
throw
|
6194
|
+
throw _context27.t0;
|
6128
6195
|
|
6129
6196
|
case 16:
|
6130
6197
|
case "end":
|
6131
|
-
return
|
6198
|
+
return _context27.stop();
|
6132
6199
|
}
|
6133
6200
|
}
|
6134
|
-
},
|
6201
|
+
}, _callee27, this, [[0, 11]]);
|
6135
6202
|
}));
|
6136
6203
|
|
6137
6204
|
function _subscribeStreams() {
|
@@ -6148,17 +6215,17 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6148
6215
|
}, {
|
6149
6216
|
key: "_unsubscribe",
|
6150
6217
|
value: function () {
|
6151
|
-
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6152
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6218
|
+
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
|
6219
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
|
6153
6220
|
while (1) {
|
6154
|
-
switch (
|
6221
|
+
switch (_context28.prev = _context28.next) {
|
6155
6222
|
case 0:
|
6156
6223
|
if (!this._entity) {
|
6157
|
-
|
6224
|
+
_context28.next = 5;
|
6158
6225
|
break;
|
6159
6226
|
}
|
6160
6227
|
|
6161
|
-
|
6228
|
+
_context28.next = 3;
|
6162
6229
|
return this._entity.close();
|
6163
6230
|
|
6164
6231
|
case 3:
|
@@ -6166,14 +6233,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6166
6233
|
this._entityPromise = null;
|
6167
6234
|
|
6168
6235
|
case 5:
|
6169
|
-
return
|
6236
|
+
return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
6170
6237
|
|
6171
6238
|
case 6:
|
6172
6239
|
case "end":
|
6173
|
-
return
|
6240
|
+
return _context28.stop();
|
6174
6241
|
}
|
6175
6242
|
}
|
6176
|
-
},
|
6243
|
+
}, _callee28, this);
|
6177
6244
|
}));
|
6178
6245
|
|
6179
6246
|
function _unsubscribe() {
|
@@ -6350,7 +6417,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6350
6417
|
}, {
|
6351
6418
|
key: "_onMessageAdded",
|
6352
6419
|
value: function _onMessageAdded(message) {
|
6353
|
-
var _iterator = _createForOfIteratorHelper$
|
6420
|
+
var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
|
6354
6421
|
_step;
|
6355
6422
|
|
6356
6423
|
try {
|
@@ -6379,27 +6446,27 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6379
6446
|
}, {
|
6380
6447
|
key: "_setLastReadMessageIndex",
|
6381
6448
|
value: function () {
|
6382
|
-
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6449
|
+
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29(index) {
|
6383
6450
|
var result;
|
6384
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6451
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
|
6385
6452
|
while (1) {
|
6386
|
-
switch (
|
6453
|
+
switch (_context29.prev = _context29.next) {
|
6387
6454
|
case 0:
|
6388
|
-
|
6455
|
+
_context29.next = 2;
|
6389
6456
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
6390
6457
|
last_read_message_index: index
|
6391
6458
|
});
|
6392
6459
|
|
6393
6460
|
case 2:
|
6394
|
-
result =
|
6395
|
-
return
|
6461
|
+
result = _context29.sent;
|
6462
|
+
return _context29.abrupt("return", result.unread_messages_count);
|
6396
6463
|
|
6397
6464
|
case 4:
|
6398
6465
|
case "end":
|
6399
|
-
return
|
6466
|
+
return _context29.stop();
|
6400
6467
|
}
|
6401
6468
|
}
|
6402
|
-
},
|
6469
|
+
}, _callee29, this);
|
6403
6470
|
}));
|
6404
6471
|
|
6405
6472
|
function _setLastReadMessageIndex(_x19) {
|
@@ -6558,11 +6625,11 @@ var Deferred = /*#__PURE__*/function () {
|
|
6558
6625
|
return Deferred;
|
6559
6626
|
}();
|
6560
6627
|
|
6561
|
-
function _createForOfIteratorHelper$
|
6628
|
+
function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(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; } } }; }
|
6562
6629
|
|
6563
|
-
function _unsupportedIterableToArray$
|
6630
|
+
function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(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$2(o, minLen); }
|
6564
6631
|
|
6565
|
-
function _arrayLikeToArray$
|
6632
|
+
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
6566
6633
|
|
6567
6634
|
function ownKeys$2(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; }
|
6568
6635
|
|
@@ -6742,7 +6809,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6742
6809
|
case 9:
|
6743
6810
|
myConversations = _context2.sent;
|
6744
6811
|
upserts = [];
|
6745
|
-
_iterator = _createForOfIteratorHelper$
|
6812
|
+
_iterator = _createForOfIteratorHelper$2(myConversations);
|
6746
6813
|
|
6747
6814
|
try {
|
6748
6815
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
@@ -7824,7 +7891,7 @@ function PushNotification(data) {
|
|
7824
7891
|
this.data = data.data || {};
|
7825
7892
|
});
|
7826
7893
|
|
7827
|
-
var version = "3.0.1-rc.
|
7894
|
+
var version = "3.0.1-rc.103";
|
7828
7895
|
|
7829
7896
|
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; }
|
7830
7897
|
|
@@ -8225,11 +8292,11 @@ var ContentClient = /*#__PURE__*/function () {
|
|
8225
8292
|
return ContentClient;
|
8226
8293
|
}();
|
8227
8294
|
|
8228
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(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; } } }; }
|
8295
|
+
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; } } }; }
|
8229
8296
|
|
8230
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(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(o, minLen); }
|
8297
|
+
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); }
|
8231
8298
|
|
8232
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
8299
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
8233
8300
|
|
8234
8301
|
var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
8235
8302
|
function QuickLRU() {
|
@@ -8258,7 +8325,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8258
8325
|
this._size = 0;
|
8259
8326
|
|
8260
8327
|
if (typeof this.onEviction === 'function') {
|
8261
|
-
var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
|
8328
|
+
var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
|
8262
8329
|
_step;
|
8263
8330
|
|
8264
8331
|
try {
|
@@ -8350,7 +8417,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8350
8417
|
while (1) {
|
8351
8418
|
switch (_context.prev = _context.next) {
|
8352
8419
|
case 0:
|
8353
|
-
_iterator2 = _createForOfIteratorHelper(this);
|
8420
|
+
_iterator2 = _createForOfIteratorHelper$1(this);
|
8354
8421
|
_context.prev = 1;
|
8355
8422
|
|
8356
8423
|
_iterator2.s();
|
@@ -8402,7 +8469,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8402
8469
|
while (1) {
|
8403
8470
|
switch (_context2.prev = _context2.next) {
|
8404
8471
|
case 0:
|
8405
|
-
_iterator3 = _createForOfIteratorHelper(this);
|
8472
|
+
_iterator3 = _createForOfIteratorHelper$1(this);
|
8406
8473
|
_context2.prev = 1;
|
8407
8474
|
|
8408
8475
|
_iterator3.s();
|
@@ -8454,7 +8521,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8454
8521
|
while (1) {
|
8455
8522
|
switch (_context3.prev = _context3.next) {
|
8456
8523
|
case 0:
|
8457
|
-
_iterator4 = _createForOfIteratorHelper(this.cache);
|
8524
|
+
_iterator4 = _createForOfIteratorHelper$1(this.cache);
|
8458
8525
|
_context3.prev = 1;
|
8459
8526
|
|
8460
8527
|
_iterator4.s();
|
@@ -8491,7 +8558,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8491
8558
|
return _context3.finish(14);
|
8492
8559
|
|
8493
8560
|
case 17:
|
8494
|
-
_iterator5 = _createForOfIteratorHelper(this.oldCache);
|
8561
|
+
_iterator5 = _createForOfIteratorHelper$1(this.oldCache);
|
8495
8562
|
_context3.prev = 18;
|
8496
8563
|
|
8497
8564
|
_iterator5.s();
|
@@ -8546,7 +8613,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8546
8613
|
get: function get() {
|
8547
8614
|
var oldCacheSize = 0;
|
8548
8615
|
|
8549
|
-
var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
|
8616
|
+
var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
|
8550
8617
|
_step6;
|
8551
8618
|
|
8552
8619
|
try {
|
@@ -8683,6 +8750,206 @@ var ChannelMetadataClient = /*#__PURE__*/function () {
|
|
8683
8750
|
return ChannelMetadataClient;
|
8684
8751
|
}();
|
8685
8752
|
|
8753
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(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; } } }; }
|
8754
|
+
|
8755
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(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(o, minLen); }
|
8756
|
+
|
8757
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
8758
|
+
/**
|
8759
|
+
* Email recipient descriptor.
|
8760
|
+
*/
|
8761
|
+
|
8762
|
+
var EmailRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
8763
|
+
/**
|
8764
|
+
* Type of recipient.
|
8765
|
+
*/
|
8766
|
+
|
8767
|
+
/**
|
8768
|
+
* @internal
|
8769
|
+
*/
|
8770
|
+
function EmailRecipientDescriptor(recipient) {
|
8771
|
+
_classCallCheck__default["default"](this, EmailRecipientDescriptor);
|
8772
|
+
|
8773
|
+
_defineProperty__default["default"](this, "type", "email");
|
8774
|
+
|
8775
|
+
this.messageSid = recipient.message_sid;
|
8776
|
+
this.level = recipient.level;
|
8777
|
+
this.name = recipient.name;
|
8778
|
+
this.address = recipient.address;
|
8779
|
+
});
|
8780
|
+
/**
|
8781
|
+
* Unknown recipient descriptor. Used to be able to handle recipient types that
|
8782
|
+
* are not supported by the current version of the SDK.
|
8783
|
+
*/
|
8784
|
+
|
8785
|
+
|
8786
|
+
var UnknownRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
8787
|
+
/**
|
8788
|
+
* Type of recipient.
|
8789
|
+
*/
|
8790
|
+
|
8791
|
+
/**
|
8792
|
+
* Sid of the message that this recipient belongs to.
|
8793
|
+
*/
|
8794
|
+
|
8795
|
+
/**
|
8796
|
+
* Recipient data as a JSON string.
|
8797
|
+
*/
|
8798
|
+
|
8799
|
+
/**
|
8800
|
+
* @internal
|
8801
|
+
*/
|
8802
|
+
function UnknownRecipientDescriptor(recipient) {
|
8803
|
+
_classCallCheck__default["default"](this, UnknownRecipientDescriptor);
|
8804
|
+
|
8805
|
+
this.type = recipient.type;
|
8806
|
+
this.messageSid = recipient.message_sid;
|
8807
|
+
this.rawData = JSON.stringify(recipient);
|
8808
|
+
});
|
8809
|
+
|
8810
|
+
var MessageRecipientsClient = /*#__PURE__*/function () {
|
8811
|
+
function MessageRecipientsClient(services, configuration) {
|
8812
|
+
_classCallCheck__default["default"](this, MessageRecipientsClient);
|
8813
|
+
|
8814
|
+
this._services = services;
|
8815
|
+
this._configuration = configuration;
|
8816
|
+
this._cache = new quickLru({
|
8817
|
+
maxSize: configuration.messageRecipientsCacheCapacity
|
8818
|
+
});
|
8819
|
+
}
|
8820
|
+
|
8821
|
+
_createClass__default["default"](MessageRecipientsClient, [{
|
8822
|
+
key: "getRecipientsFromMessage",
|
8823
|
+
value: function () {
|
8824
|
+
var _getRecipientsFromMessage = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(conversationSid, messageSid) {
|
8825
|
+
var _this = this;
|
8826
|
+
|
8827
|
+
var key, cachedItem, url, recipientsResponse, recipients;
|
8828
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
8829
|
+
while (1) {
|
8830
|
+
switch (_context.prev = _context.next) {
|
8831
|
+
case 0:
|
8832
|
+
key = "".concat(conversationSid, ",").concat(messageSid);
|
8833
|
+
cachedItem = this._cache.get(key);
|
8834
|
+
|
8835
|
+
if (!cachedItem) {
|
8836
|
+
_context.next = 4;
|
8837
|
+
break;
|
8838
|
+
}
|
8839
|
+
|
8840
|
+
return _context.abrupt("return", cachedItem.item);
|
8841
|
+
|
8842
|
+
case 4:
|
8843
|
+
url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("MessageSid", messageSid).build();
|
8844
|
+
_context.next = 7;
|
8845
|
+
return this._services.commandExecutor.fetchResource(url);
|
8846
|
+
|
8847
|
+
case 7:
|
8848
|
+
recipientsResponse = _context.sent;
|
8849
|
+
recipients = recipientsResponse.message_recipients.map(function (recipient) {
|
8850
|
+
return _this._wrapResponse(recipient);
|
8851
|
+
});
|
8852
|
+
|
8853
|
+
if (recipients.length > 0) {
|
8854
|
+
this._cache.set(key, {
|
8855
|
+
item: recipients
|
8856
|
+
});
|
8857
|
+
}
|
8858
|
+
|
8859
|
+
return _context.abrupt("return", recipients);
|
8860
|
+
|
8861
|
+
case 11:
|
8862
|
+
case "end":
|
8863
|
+
return _context.stop();
|
8864
|
+
}
|
8865
|
+
}
|
8866
|
+
}, _callee, this);
|
8867
|
+
}));
|
8868
|
+
|
8869
|
+
function getRecipientsFromMessage(_x, _x2) {
|
8870
|
+
return _getRecipientsFromMessage.apply(this, arguments);
|
8871
|
+
}
|
8872
|
+
|
8873
|
+
return getRecipientsFromMessage;
|
8874
|
+
}()
|
8875
|
+
}, {
|
8876
|
+
key: "getRecipientsFromConversation",
|
8877
|
+
value: function () {
|
8878
|
+
var _getRecipientsFromConversation = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(conversationSid, paginatorOptions) {
|
8879
|
+
var _paginatorOptions$pag,
|
8880
|
+
_paginatorOptions$pag2,
|
8881
|
+
_this2 = this;
|
8882
|
+
|
8883
|
+
var url, recipientsResponse, allRecipients, _iterator, _step, _this$_cache$get$item, _this$_cache$get, recipient, key, existingMessageRecipients;
|
8884
|
+
|
8885
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
8886
|
+
while (1) {
|
8887
|
+
switch (_context2.prev = _context2.next) {
|
8888
|
+
case 0:
|
8889
|
+
url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("PageToken", (_paginatorOptions$pag = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageToken) !== null && _paginatorOptions$pag !== void 0 ? _paginatorOptions$pag : "").arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : "").build();
|
8890
|
+
_context2.next = 3;
|
8891
|
+
return this._services.commandExecutor.fetchResource(url);
|
8892
|
+
|
8893
|
+
case 3:
|
8894
|
+
recipientsResponse = _context2.sent;
|
8895
|
+
allRecipients = recipientsResponse.message_recipients.map(function (recipient) {
|
8896
|
+
return _this2._wrapResponse(recipient);
|
8897
|
+
});
|
8898
|
+
_iterator = _createForOfIteratorHelper(allRecipients);
|
8899
|
+
|
8900
|
+
try {
|
8901
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
8902
|
+
recipient = _step.value;
|
8903
|
+
key = "".concat(conversationSid, ",").concat(recipient.messageSid);
|
8904
|
+
existingMessageRecipients = (_this$_cache$get$item = (_this$_cache$get = this._cache.get(key)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get.item) !== null && _this$_cache$get$item !== void 0 ? _this$_cache$get$item : [];
|
8905
|
+
|
8906
|
+
this._cache.set(key, {
|
8907
|
+
item: [].concat(_toConsumableArray__default["default"](existingMessageRecipients), [recipient])
|
8908
|
+
});
|
8909
|
+
}
|
8910
|
+
} catch (err) {
|
8911
|
+
_iterator.e(err);
|
8912
|
+
} finally {
|
8913
|
+
_iterator.f();
|
8914
|
+
}
|
8915
|
+
|
8916
|
+
return _context2.abrupt("return", new RestPaginator(allRecipients, function (pageToken, pageSize) {
|
8917
|
+
return _this2.getRecipientsFromConversation(conversationSid, {
|
8918
|
+
pageToken: pageToken,
|
8919
|
+
pageSize: pageSize
|
8920
|
+
});
|
8921
|
+
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
|
8922
|
+
|
8923
|
+
case 8:
|
8924
|
+
case "end":
|
8925
|
+
return _context2.stop();
|
8926
|
+
}
|
8927
|
+
}
|
8928
|
+
}, _callee2, this);
|
8929
|
+
}));
|
8930
|
+
|
8931
|
+
function getRecipientsFromConversation(_x3, _x4) {
|
8932
|
+
return _getRecipientsFromConversation.apply(this, arguments);
|
8933
|
+
}
|
8934
|
+
|
8935
|
+
return getRecipientsFromConversation;
|
8936
|
+
}()
|
8937
|
+
}, {
|
8938
|
+
key: "_wrapResponse",
|
8939
|
+
value: function _wrapResponse(recipient) {
|
8940
|
+
switch (recipient.type) {
|
8941
|
+
case "email":
|
8942
|
+
return new EmailRecipientDescriptor(recipient);
|
8943
|
+
|
8944
|
+
default:
|
8945
|
+
return new UnknownRecipientDescriptor(recipient);
|
8946
|
+
}
|
8947
|
+
}
|
8948
|
+
}]);
|
8949
|
+
|
8950
|
+
return MessageRecipientsClient;
|
8951
|
+
}();
|
8952
|
+
|
8686
8953
|
var _class;
|
8687
8954
|
|
8688
8955
|
function ownKeys(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; }
|
@@ -9904,6 +10171,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9904
10171
|
configurationResponse = _context17.sent;
|
9905
10172
|
this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
|
9906
10173
|
this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
|
10174
|
+
this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
|
9907
10175
|
|
9908
10176
|
this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
|
9909
10177
|
|
@@ -9982,10 +10250,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9982
10250
|
}).catch(function (error) {
|
9983
10251
|
throw error;
|
9984
10252
|
});
|
9985
|
-
_context17.next =
|
10253
|
+
_context17.next = 30;
|
9986
10254
|
return this._services.users.myself._ensureFetched();
|
9987
10255
|
|
9988
|
-
case
|
10256
|
+
case 30:
|
9989
10257
|
Client_1._supportedPushChannels.forEach(function (channelType) {
|
9990
10258
|
return _this3._subscribeToPushNotifications(channelType);
|
9991
10259
|
});
|
@@ -10001,7 +10269,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10001
10269
|
this.emit("stateChanged", "initialized");
|
10002
10270
|
this.emit("initialized");
|
10003
10271
|
|
10004
|
-
case
|
10272
|
+
case 36:
|
10005
10273
|
case "end":
|
10006
10274
|
return _context17.stop();
|
10007
10275
|
}
|
@@ -10261,6 +10529,7 @@ exports.ContentTemplate = ContentTemplate;
|
|
10261
10529
|
exports.ContentTemplateVariable = ContentTemplateVariable;
|
10262
10530
|
exports.Conversation = Conversation;
|
10263
10531
|
exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
|
10532
|
+
exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
|
10264
10533
|
exports.Media = Media;
|
10265
10534
|
exports.Message = Message;
|
10266
10535
|
exports.MessageBuilder = MessageBuilder;
|
@@ -10268,6 +10537,7 @@ exports.NotificationTypes = NotificationTypes;
|
|
10268
10537
|
exports.Participant = Participant;
|
10269
10538
|
exports.PushNotification = PushNotification;
|
10270
10539
|
exports.RestPaginator = RestPaginator;
|
10540
|
+
exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
|
10271
10541
|
exports.UnsentMessage = UnsentMessage;
|
10272
10542
|
exports.User = User;
|
10273
10543
|
//# sourceMappingURL=browser.js.map
|