@twilio/conversations 2.4.1 → 2.5.0-rc.0
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 +2 -2
- 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 +379 -109
- 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 +43 -3
- package/docs/interfaces/ClientOptions.html +16 -0
- package/docs/modules.html +42 -2
- package/package.json +8 -8
package/builds/browser.js
CHANGED
@@ -415,9 +415,11 @@ var MINIMUM_RETRY_DELAY = 1000;
|
|
415
415
|
var MAXIMUM_RETRY_DELAY = 4000;
|
416
416
|
var MAXIMUM_ATTEMPTS_COUNT = 3;
|
417
417
|
var RETRY_WHEN_THROTTLED = true;
|
418
|
+
var CHANNEL_METADATA_CACHE_CAPACITY = 100;
|
419
|
+
var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
|
418
420
|
|
419
421
|
var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
|
420
|
-
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
|
422
|
+
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad, _options$messageRecip;
|
421
423
|
|
422
424
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
423
425
|
var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
|
@@ -476,7 +478,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
|
|
476
478
|
this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
|
477
479
|
}
|
478
480
|
|
479
|
-
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad :
|
481
|
+
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : CHANNEL_METADATA_CACHE_CAPACITY;
|
482
|
+
this.messageRecipientsCacheCapacity = (_options$messageRecip = options.messageRecipientsCacheCapacity) !== null && _options$messageRecip !== void 0 ? _options$messageRecip : MESSAGE_RECIPIENTS_CACHE_CAPACITY;
|
480
483
|
});
|
481
484
|
|
482
485
|
/**
|
@@ -1094,11 +1097,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
|
|
1094
1097
|
|
1095
1098
|
__decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
|
1096
1099
|
|
1097
|
-
function _createForOfIteratorHelper$
|
1100
|
+
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; } } }; }
|
1098
1101
|
|
1099
|
-
function _unsupportedIterableToArray$
|
1102
|
+
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); }
|
1100
1103
|
|
1101
|
-
function _arrayLikeToArray$
|
1104
|
+
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; }
|
1102
1105
|
|
1103
1106
|
var Network = /*#__PURE__*/function () {
|
1104
1107
|
function Network(configuration, services) {
|
@@ -1119,7 +1122,7 @@ var Network = /*#__PURE__*/function () {
|
|
1119
1122
|
}, {
|
1120
1123
|
key: "cleanupCache",
|
1121
1124
|
value: function cleanupCache() {
|
1122
|
-
var _iterator = _createForOfIteratorHelper$
|
1125
|
+
var _iterator = _createForOfIteratorHelper$5(this.cache),
|
1123
1126
|
_step;
|
1124
1127
|
|
1125
1128
|
try {
|
@@ -3803,6 +3806,38 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3803
3806
|
|
3804
3807
|
return getChannelMetadata;
|
3805
3808
|
}()
|
3809
|
+
/**
|
3810
|
+
* Get recipients of the message.
|
3811
|
+
*/
|
3812
|
+
|
3813
|
+
}, {
|
3814
|
+
key: "getMessageRecipients",
|
3815
|
+
value: function () {
|
3816
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11() {
|
3817
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context11) {
|
3818
|
+
while (1) {
|
3819
|
+
switch (_context11.prev = _context11.next) {
|
3820
|
+
case 0:
|
3821
|
+
_context11.next = 2;
|
3822
|
+
return this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid, this.sid);
|
3823
|
+
|
3824
|
+
case 2:
|
3825
|
+
return _context11.abrupt("return", _context11.sent);
|
3826
|
+
|
3827
|
+
case 3:
|
3828
|
+
case "end":
|
3829
|
+
return _context11.stop();
|
3830
|
+
}
|
3831
|
+
}
|
3832
|
+
}, _callee11, this);
|
3833
|
+
}));
|
3834
|
+
|
3835
|
+
function getMessageRecipients() {
|
3836
|
+
return _getMessageRecipients.apply(this, arguments);
|
3837
|
+
}
|
3838
|
+
|
3839
|
+
return getMessageRecipients;
|
3840
|
+
}()
|
3806
3841
|
}]);
|
3807
3842
|
|
3808
3843
|
return Message;
|
@@ -3852,11 +3887,11 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
3852
3887
|
|
3853
3888
|
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; }
|
3854
3889
|
|
3855
|
-
function _createForOfIteratorHelper$
|
3890
|
+
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; } } }; }
|
3856
3891
|
|
3857
|
-
function _unsupportedIterableToArray$
|
3892
|
+
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); }
|
3858
3893
|
|
3859
|
-
function _arrayLikeToArray$
|
3894
|
+
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; }
|
3860
3895
|
|
3861
3896
|
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); }; }
|
3862
3897
|
|
@@ -4064,7 +4099,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
4064
4099
|
return request.cancel();
|
4065
4100
|
});
|
4066
4101
|
});
|
4067
|
-
_iterator = _createForOfIteratorHelper$
|
4102
|
+
_iterator = _createForOfIteratorHelper$4(message.mediaContent);
|
4068
4103
|
_context3.prev = 4;
|
4069
4104
|
|
4070
4105
|
_iterator.s();
|
@@ -4717,11 +4752,11 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
|
|
4717
4752
|
|
4718
4753
|
__decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
|
4719
4754
|
|
4720
|
-
function _createForOfIteratorHelper$
|
4755
|
+
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; } } }; }
|
4721
4756
|
|
4722
|
-
function _unsupportedIterableToArray$
|
4757
|
+
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); }
|
4723
4758
|
|
4724
|
-
function _arrayLikeToArray$
|
4759
|
+
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; }
|
4725
4760
|
|
4726
4761
|
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); }; }
|
4727
4762
|
|
@@ -6007,6 +6042,38 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6007
6042
|
|
6008
6043
|
return updateUniqueName;
|
6009
6044
|
}()
|
6045
|
+
/**
|
6046
|
+
* Get recipients of all messages in the conversation.
|
6047
|
+
*/
|
6048
|
+
|
6049
|
+
}, {
|
6050
|
+
key: "getMessageRecipients",
|
6051
|
+
value: function () {
|
6052
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24() {
|
6053
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
|
6054
|
+
while (1) {
|
6055
|
+
switch (_context24.prev = _context24.next) {
|
6056
|
+
case 0:
|
6057
|
+
_context24.next = 2;
|
6058
|
+
return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid);
|
6059
|
+
|
6060
|
+
case 2:
|
6061
|
+
return _context24.abrupt("return", _context24.sent);
|
6062
|
+
|
6063
|
+
case 3:
|
6064
|
+
case "end":
|
6065
|
+
return _context24.stop();
|
6066
|
+
}
|
6067
|
+
}
|
6068
|
+
}, _callee24, this);
|
6069
|
+
}));
|
6070
|
+
|
6071
|
+
function getMessageRecipients() {
|
6072
|
+
return _getMessageRecipients.apply(this, arguments);
|
6073
|
+
}
|
6074
|
+
|
6075
|
+
return getMessageRecipients;
|
6076
|
+
}()
|
6010
6077
|
/**
|
6011
6078
|
* Load and subscribe to this conversation and do not subscribe to its
|
6012
6079
|
* participants and messages. This or _subscribeStreams will need to be called
|
@@ -6017,31 +6084,31 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6017
6084
|
}, {
|
6018
6085
|
key: "_subscribe",
|
6019
6086
|
value: function () {
|
6020
|
-
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6087
|
+
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee25() {
|
6021
6088
|
var _this2 = this;
|
6022
6089
|
|
6023
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6090
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
|
6024
6091
|
while (1) {
|
6025
|
-
switch (
|
6092
|
+
switch (_context25.prev = _context25.next) {
|
6026
6093
|
case 0:
|
6027
6094
|
if (!this._entityPromise) {
|
6028
|
-
|
6095
|
+
_context25.next = 2;
|
6029
6096
|
break;
|
6030
6097
|
}
|
6031
6098
|
|
6032
|
-
return
|
6099
|
+
return _context25.abrupt("return", this._entityPromise);
|
6033
6100
|
|
6034
6101
|
case 2:
|
6035
6102
|
this._entityPromise = this._services.syncClient.document({
|
6036
6103
|
id: this._entityName,
|
6037
6104
|
mode: "open_existing"
|
6038
6105
|
});
|
6039
|
-
|
6040
|
-
|
6106
|
+
_context25.prev = 3;
|
6107
|
+
_context25.next = 6;
|
6041
6108
|
return this._entityPromise;
|
6042
6109
|
|
6043
6110
|
case 6:
|
6044
|
-
this._entity =
|
6111
|
+
this._entity = _context25.sent;
|
6045
6112
|
|
6046
6113
|
this._entity.on("updated", function (args) {
|
6047
6114
|
return _this2._update(args.data);
|
@@ -6053,28 +6120,28 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6053
6120
|
|
6054
6121
|
this._update(this._entity.data);
|
6055
6122
|
|
6056
|
-
return
|
6123
|
+
return _context25.abrupt("return", this._entity);
|
6057
6124
|
|
6058
6125
|
case 13:
|
6059
|
-
|
6060
|
-
|
6126
|
+
_context25.prev = 13;
|
6127
|
+
_context25.t0 = _context25["catch"](3);
|
6061
6128
|
this._entity = null;
|
6062
6129
|
this._entityPromise = null;
|
6063
6130
|
|
6064
6131
|
if (this._services.syncClient.connectionState != "disconnected") {
|
6065
|
-
Conversation._logger.error("Failed to get conversation object",
|
6132
|
+
Conversation._logger.error("Failed to get conversation object", _context25.t0);
|
6066
6133
|
}
|
6067
6134
|
|
6068
|
-
Conversation._logger.debug("ERROR: Failed to get conversation object",
|
6135
|
+
Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
|
6069
6136
|
|
6070
|
-
throw
|
6137
|
+
throw _context25.t0;
|
6071
6138
|
|
6072
6139
|
case 20:
|
6073
6140
|
case "end":
|
6074
|
-
return
|
6141
|
+
return _context25.stop();
|
6075
6142
|
}
|
6076
6143
|
}
|
6077
|
-
},
|
6144
|
+
}, _callee25, this, [[3, 13]]);
|
6078
6145
|
}));
|
6079
6146
|
|
6080
6147
|
function _subscribe() {
|
@@ -6096,44 +6163,44 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6096
6163
|
}, {
|
6097
6164
|
key: "_fetchStreams",
|
6098
6165
|
value: function () {
|
6099
|
-
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6166
|
+
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26() {
|
6100
6167
|
var _this$_entity, _this$_entity2;
|
6101
6168
|
|
6102
6169
|
var data;
|
6103
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6170
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
|
6104
6171
|
while (1) {
|
6105
|
-
switch (
|
6172
|
+
switch (_context26.prev = _context26.next) {
|
6106
6173
|
case 0:
|
6107
|
-
|
6174
|
+
_context26.next = 2;
|
6108
6175
|
return this._subscribe();
|
6109
6176
|
|
6110
6177
|
case 2:
|
6111
6178
|
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
6112
6179
|
|
6113
6180
|
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
6114
|
-
|
6181
|
+
_context26.next = 6;
|
6115
6182
|
return this._services.syncClient.list({
|
6116
6183
|
id: data.messages,
|
6117
6184
|
mode: "open_existing"
|
6118
6185
|
});
|
6119
6186
|
|
6120
6187
|
case 6:
|
6121
|
-
this._messagesList =
|
6122
|
-
|
6188
|
+
this._messagesList = _context26.sent;
|
6189
|
+
_context26.next = 9;
|
6123
6190
|
return this._services.syncClient.map({
|
6124
6191
|
id: data.roster,
|
6125
6192
|
mode: "open_existing"
|
6126
6193
|
});
|
6127
6194
|
|
6128
6195
|
case 9:
|
6129
|
-
this._participantsMap =
|
6196
|
+
this._participantsMap = _context26.sent;
|
6130
6197
|
|
6131
6198
|
case 10:
|
6132
6199
|
case "end":
|
6133
|
-
return
|
6200
|
+
return _context26.stop();
|
6134
6201
|
}
|
6135
6202
|
}
|
6136
|
-
},
|
6203
|
+
}, _callee26, this);
|
6137
6204
|
}));
|
6138
6205
|
|
6139
6206
|
function _fetchStreams() {
|
@@ -6153,15 +6220,15 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6153
6220
|
}, {
|
6154
6221
|
key: "_subscribeStreams",
|
6155
6222
|
value: function () {
|
6156
|
-
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6223
|
+
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
|
6157
6224
|
var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
|
6158
6225
|
|
6159
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6226
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
|
6160
6227
|
while (1) {
|
6161
|
-
switch (
|
6228
|
+
switch (_context27.prev = _context27.next) {
|
6162
6229
|
case 0:
|
6163
|
-
|
6164
|
-
|
6230
|
+
_context27.prev = 0;
|
6231
|
+
_context27.next = 3;
|
6165
6232
|
return this._subscribe();
|
6166
6233
|
|
6167
6234
|
case 3:
|
@@ -6170,31 +6237,31 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6170
6237
|
data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
|
6171
6238
|
messagesObjectName = data.messages;
|
6172
6239
|
rosterObjectName = data.roster;
|
6173
|
-
|
6240
|
+
_context27.next = 9;
|
6174
6241
|
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)]);
|
6175
6242
|
|
6176
6243
|
case 9:
|
6177
|
-
|
6244
|
+
_context27.next = 16;
|
6178
6245
|
break;
|
6179
6246
|
|
6180
6247
|
case 11:
|
6181
|
-
|
6182
|
-
|
6248
|
+
_context27.prev = 11;
|
6249
|
+
_context27.t0 = _context27["catch"](0);
|
6183
6250
|
|
6184
6251
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
6185
|
-
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid,
|
6252
|
+
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
6186
6253
|
}
|
6187
6254
|
|
6188
|
-
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid,
|
6255
|
+
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
6189
6256
|
|
6190
|
-
throw
|
6257
|
+
throw _context27.t0;
|
6191
6258
|
|
6192
6259
|
case 16:
|
6193
6260
|
case "end":
|
6194
|
-
return
|
6261
|
+
return _context27.stop();
|
6195
6262
|
}
|
6196
6263
|
}
|
6197
|
-
},
|
6264
|
+
}, _callee27, this, [[0, 11]]);
|
6198
6265
|
}));
|
6199
6266
|
|
6200
6267
|
function _subscribeStreams() {
|
@@ -6211,17 +6278,17 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6211
6278
|
}, {
|
6212
6279
|
key: "_unsubscribe",
|
6213
6280
|
value: function () {
|
6214
|
-
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6215
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6281
|
+
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
|
6282
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
|
6216
6283
|
while (1) {
|
6217
|
-
switch (
|
6284
|
+
switch (_context28.prev = _context28.next) {
|
6218
6285
|
case 0:
|
6219
6286
|
if (!this._entity) {
|
6220
|
-
|
6287
|
+
_context28.next = 5;
|
6221
6288
|
break;
|
6222
6289
|
}
|
6223
6290
|
|
6224
|
-
|
6291
|
+
_context28.next = 3;
|
6225
6292
|
return this._entity.close();
|
6226
6293
|
|
6227
6294
|
case 3:
|
@@ -6229,14 +6296,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6229
6296
|
this._entityPromise = null;
|
6230
6297
|
|
6231
6298
|
case 5:
|
6232
|
-
return
|
6299
|
+
return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
6233
6300
|
|
6234
6301
|
case 6:
|
6235
6302
|
case "end":
|
6236
|
-
return
|
6303
|
+
return _context28.stop();
|
6237
6304
|
}
|
6238
6305
|
}
|
6239
|
-
},
|
6306
|
+
}, _callee28, this);
|
6240
6307
|
}));
|
6241
6308
|
|
6242
6309
|
function _unsubscribe() {
|
@@ -6413,7 +6480,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6413
6480
|
}, {
|
6414
6481
|
key: "_onMessageAdded",
|
6415
6482
|
value: function _onMessageAdded(message) {
|
6416
|
-
var _iterator = _createForOfIteratorHelper$
|
6483
|
+
var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
|
6417
6484
|
_step;
|
6418
6485
|
|
6419
6486
|
try {
|
@@ -6442,27 +6509,27 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6442
6509
|
}, {
|
6443
6510
|
key: "_setLastReadMessageIndex",
|
6444
6511
|
value: function () {
|
6445
|
-
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6512
|
+
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29(index) {
|
6446
6513
|
var result;
|
6447
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6514
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
|
6448
6515
|
while (1) {
|
6449
|
-
switch (
|
6516
|
+
switch (_context29.prev = _context29.next) {
|
6450
6517
|
case 0:
|
6451
|
-
|
6518
|
+
_context29.next = 2;
|
6452
6519
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
6453
6520
|
last_read_message_index: index
|
6454
6521
|
});
|
6455
6522
|
|
6456
6523
|
case 2:
|
6457
|
-
result =
|
6458
|
-
return
|
6524
|
+
result = _context29.sent;
|
6525
|
+
return _context29.abrupt("return", result.unread_messages_count);
|
6459
6526
|
|
6460
6527
|
case 4:
|
6461
6528
|
case "end":
|
6462
|
-
return
|
6529
|
+
return _context29.stop();
|
6463
6530
|
}
|
6464
6531
|
}
|
6465
|
-
},
|
6532
|
+
}, _callee29, this);
|
6466
6533
|
}));
|
6467
6534
|
|
6468
6535
|
function _setLastReadMessageIndex(_x19) {
|
@@ -6621,11 +6688,11 @@ var Deferred = /*#__PURE__*/function () {
|
|
6621
6688
|
return Deferred;
|
6622
6689
|
}();
|
6623
6690
|
|
6624
|
-
function _createForOfIteratorHelper$
|
6691
|
+
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; } } }; }
|
6625
6692
|
|
6626
|
-
function _unsupportedIterableToArray$
|
6693
|
+
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); }
|
6627
6694
|
|
6628
|
-
function _arrayLikeToArray$
|
6695
|
+
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; }
|
6629
6696
|
|
6630
6697
|
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; }
|
6631
6698
|
|
@@ -6805,7 +6872,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6805
6872
|
case 9:
|
6806
6873
|
myConversations = _context2.sent;
|
6807
6874
|
upserts = [];
|
6808
|
-
_iterator = _createForOfIteratorHelper$
|
6875
|
+
_iterator = _createForOfIteratorHelper$2(myConversations);
|
6809
6876
|
|
6810
6877
|
try {
|
6811
6878
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
@@ -7887,7 +7954,7 @@ function PushNotification(data) {
|
|
7887
7954
|
this.data = data.data || {};
|
7888
7955
|
});
|
7889
7956
|
|
7890
|
-
var version = "2.
|
7957
|
+
var version = "2.5.0-rc.0";
|
7891
7958
|
|
7892
7959
|
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; }
|
7893
7960
|
|
@@ -8288,11 +8355,11 @@ var ContentClient = /*#__PURE__*/function () {
|
|
8288
8355
|
return ContentClient;
|
8289
8356
|
}();
|
8290
8357
|
|
8291
|
-
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; } } }; }
|
8358
|
+
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; } } }; }
|
8292
8359
|
|
8293
|
-
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); }
|
8360
|
+
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); }
|
8294
8361
|
|
8295
|
-
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; }
|
8362
|
+
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; }
|
8296
8363
|
|
8297
8364
|
var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
8298
8365
|
function QuickLRU() {
|
@@ -8321,7 +8388,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8321
8388
|
this._size = 0;
|
8322
8389
|
|
8323
8390
|
if (typeof this.onEviction === 'function') {
|
8324
|
-
var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
|
8391
|
+
var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
|
8325
8392
|
_step;
|
8326
8393
|
|
8327
8394
|
try {
|
@@ -8413,7 +8480,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8413
8480
|
while (1) {
|
8414
8481
|
switch (_context.prev = _context.next) {
|
8415
8482
|
case 0:
|
8416
|
-
_iterator2 = _createForOfIteratorHelper(this);
|
8483
|
+
_iterator2 = _createForOfIteratorHelper$1(this);
|
8417
8484
|
_context.prev = 1;
|
8418
8485
|
|
8419
8486
|
_iterator2.s();
|
@@ -8465,7 +8532,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8465
8532
|
while (1) {
|
8466
8533
|
switch (_context2.prev = _context2.next) {
|
8467
8534
|
case 0:
|
8468
|
-
_iterator3 = _createForOfIteratorHelper(this);
|
8535
|
+
_iterator3 = _createForOfIteratorHelper$1(this);
|
8469
8536
|
_context2.prev = 1;
|
8470
8537
|
|
8471
8538
|
_iterator3.s();
|
@@ -8517,7 +8584,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8517
8584
|
while (1) {
|
8518
8585
|
switch (_context3.prev = _context3.next) {
|
8519
8586
|
case 0:
|
8520
|
-
_iterator4 = _createForOfIteratorHelper(this.cache);
|
8587
|
+
_iterator4 = _createForOfIteratorHelper$1(this.cache);
|
8521
8588
|
_context3.prev = 1;
|
8522
8589
|
|
8523
8590
|
_iterator4.s();
|
@@ -8554,7 +8621,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8554
8621
|
return _context3.finish(14);
|
8555
8622
|
|
8556
8623
|
case 17:
|
8557
|
-
_iterator5 = _createForOfIteratorHelper(this.oldCache);
|
8624
|
+
_iterator5 = _createForOfIteratorHelper$1(this.oldCache);
|
8558
8625
|
_context3.prev = 18;
|
8559
8626
|
|
8560
8627
|
_iterator5.s();
|
@@ -8609,7 +8676,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8609
8676
|
get: function get() {
|
8610
8677
|
var oldCacheSize = 0;
|
8611
8678
|
|
8612
|
-
var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
|
8679
|
+
var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
|
8613
8680
|
_step6;
|
8614
8681
|
|
8615
8682
|
try {
|
@@ -8746,6 +8813,206 @@ var ChannelMetadataClient = /*#__PURE__*/function () {
|
|
8746
8813
|
return ChannelMetadataClient;
|
8747
8814
|
}();
|
8748
8815
|
|
8816
|
+
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; } } }; }
|
8817
|
+
|
8818
|
+
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); }
|
8819
|
+
|
8820
|
+
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; }
|
8821
|
+
/**
|
8822
|
+
* Email recipient descriptor.
|
8823
|
+
*/
|
8824
|
+
|
8825
|
+
var EmailRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
8826
|
+
/**
|
8827
|
+
* Type of recipient.
|
8828
|
+
*/
|
8829
|
+
|
8830
|
+
/**
|
8831
|
+
* @internal
|
8832
|
+
*/
|
8833
|
+
function EmailRecipientDescriptor(recipient) {
|
8834
|
+
_classCallCheck__default["default"](this, EmailRecipientDescriptor);
|
8835
|
+
|
8836
|
+
_defineProperty__default["default"](this, "type", "email");
|
8837
|
+
|
8838
|
+
this.messageSid = recipient.message_sid;
|
8839
|
+
this.level = recipient.level;
|
8840
|
+
this.name = recipient.name;
|
8841
|
+
this.address = recipient.address;
|
8842
|
+
});
|
8843
|
+
/**
|
8844
|
+
* Unknown recipient descriptor. Used to be able to handle recipient types that
|
8845
|
+
* are not supported by the current version of the SDK.
|
8846
|
+
*/
|
8847
|
+
|
8848
|
+
|
8849
|
+
var UnknownRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
8850
|
+
/**
|
8851
|
+
* Type of recipient.
|
8852
|
+
*/
|
8853
|
+
|
8854
|
+
/**
|
8855
|
+
* Sid of the message that this recipient belongs to.
|
8856
|
+
*/
|
8857
|
+
|
8858
|
+
/**
|
8859
|
+
* Recipient data as a JSON string.
|
8860
|
+
*/
|
8861
|
+
|
8862
|
+
/**
|
8863
|
+
* @internal
|
8864
|
+
*/
|
8865
|
+
function UnknownRecipientDescriptor(recipient) {
|
8866
|
+
_classCallCheck__default["default"](this, UnknownRecipientDescriptor);
|
8867
|
+
|
8868
|
+
this.type = recipient.type;
|
8869
|
+
this.messageSid = recipient.message_sid;
|
8870
|
+
this.rawData = JSON.stringify(recipient);
|
8871
|
+
});
|
8872
|
+
|
8873
|
+
var MessageRecipientsClient = /*#__PURE__*/function () {
|
8874
|
+
function MessageRecipientsClient(services, configuration) {
|
8875
|
+
_classCallCheck__default["default"](this, MessageRecipientsClient);
|
8876
|
+
|
8877
|
+
this._services = services;
|
8878
|
+
this._configuration = configuration;
|
8879
|
+
this._cache = new quickLru({
|
8880
|
+
maxSize: configuration.messageRecipientsCacheCapacity
|
8881
|
+
});
|
8882
|
+
}
|
8883
|
+
|
8884
|
+
_createClass__default["default"](MessageRecipientsClient, [{
|
8885
|
+
key: "getRecipientsFromMessage",
|
8886
|
+
value: function () {
|
8887
|
+
var _getRecipientsFromMessage = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(conversationSid, messageSid) {
|
8888
|
+
var _this = this;
|
8889
|
+
|
8890
|
+
var key, cachedItem, url, recipientsResponse, recipients;
|
8891
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
8892
|
+
while (1) {
|
8893
|
+
switch (_context.prev = _context.next) {
|
8894
|
+
case 0:
|
8895
|
+
key = "".concat(conversationSid, ",").concat(messageSid);
|
8896
|
+
cachedItem = this._cache.get(key);
|
8897
|
+
|
8898
|
+
if (!cachedItem) {
|
8899
|
+
_context.next = 4;
|
8900
|
+
break;
|
8901
|
+
}
|
8902
|
+
|
8903
|
+
return _context.abrupt("return", cachedItem.item);
|
8904
|
+
|
8905
|
+
case 4:
|
8906
|
+
url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("MessageSid", messageSid).build();
|
8907
|
+
_context.next = 7;
|
8908
|
+
return this._services.commandExecutor.fetchResource(url);
|
8909
|
+
|
8910
|
+
case 7:
|
8911
|
+
recipientsResponse = _context.sent;
|
8912
|
+
recipients = recipientsResponse.message_recipients.map(function (recipient) {
|
8913
|
+
return _this._wrapResponse(recipient);
|
8914
|
+
});
|
8915
|
+
|
8916
|
+
if (recipients.length > 0) {
|
8917
|
+
this._cache.set(key, {
|
8918
|
+
item: recipients
|
8919
|
+
});
|
8920
|
+
}
|
8921
|
+
|
8922
|
+
return _context.abrupt("return", recipients);
|
8923
|
+
|
8924
|
+
case 11:
|
8925
|
+
case "end":
|
8926
|
+
return _context.stop();
|
8927
|
+
}
|
8928
|
+
}
|
8929
|
+
}, _callee, this);
|
8930
|
+
}));
|
8931
|
+
|
8932
|
+
function getRecipientsFromMessage(_x, _x2) {
|
8933
|
+
return _getRecipientsFromMessage.apply(this, arguments);
|
8934
|
+
}
|
8935
|
+
|
8936
|
+
return getRecipientsFromMessage;
|
8937
|
+
}()
|
8938
|
+
}, {
|
8939
|
+
key: "getRecipientsFromConversation",
|
8940
|
+
value: function () {
|
8941
|
+
var _getRecipientsFromConversation = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(conversationSid, paginatorOptions) {
|
8942
|
+
var _paginatorOptions$pag,
|
8943
|
+
_paginatorOptions$pag2,
|
8944
|
+
_this2 = this;
|
8945
|
+
|
8946
|
+
var url, recipientsResponse, allRecipients, _iterator, _step, _this$_cache$get$item, _this$_cache$get, recipient, key, existingMessageRecipients;
|
8947
|
+
|
8948
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
8949
|
+
while (1) {
|
8950
|
+
switch (_context2.prev = _context2.next) {
|
8951
|
+
case 0:
|
8952
|
+
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();
|
8953
|
+
_context2.next = 3;
|
8954
|
+
return this._services.commandExecutor.fetchResource(url);
|
8955
|
+
|
8956
|
+
case 3:
|
8957
|
+
recipientsResponse = _context2.sent;
|
8958
|
+
allRecipients = recipientsResponse.message_recipients.map(function (recipient) {
|
8959
|
+
return _this2._wrapResponse(recipient);
|
8960
|
+
});
|
8961
|
+
_iterator = _createForOfIteratorHelper(allRecipients);
|
8962
|
+
|
8963
|
+
try {
|
8964
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
8965
|
+
recipient = _step.value;
|
8966
|
+
key = "".concat(conversationSid, ",").concat(recipient.messageSid);
|
8967
|
+
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 : [];
|
8968
|
+
|
8969
|
+
this._cache.set(key, {
|
8970
|
+
item: [].concat(_toConsumableArray__default["default"](existingMessageRecipients), [recipient])
|
8971
|
+
});
|
8972
|
+
}
|
8973
|
+
} catch (err) {
|
8974
|
+
_iterator.e(err);
|
8975
|
+
} finally {
|
8976
|
+
_iterator.f();
|
8977
|
+
}
|
8978
|
+
|
8979
|
+
return _context2.abrupt("return", new RestPaginator(allRecipients, function (pageToken, pageSize) {
|
8980
|
+
return _this2.getRecipientsFromConversation(conversationSid, {
|
8981
|
+
pageToken: pageToken,
|
8982
|
+
pageSize: pageSize
|
8983
|
+
});
|
8984
|
+
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
|
8985
|
+
|
8986
|
+
case 8:
|
8987
|
+
case "end":
|
8988
|
+
return _context2.stop();
|
8989
|
+
}
|
8990
|
+
}
|
8991
|
+
}, _callee2, this);
|
8992
|
+
}));
|
8993
|
+
|
8994
|
+
function getRecipientsFromConversation(_x3, _x4) {
|
8995
|
+
return _getRecipientsFromConversation.apply(this, arguments);
|
8996
|
+
}
|
8997
|
+
|
8998
|
+
return getRecipientsFromConversation;
|
8999
|
+
}()
|
9000
|
+
}, {
|
9001
|
+
key: "_wrapResponse",
|
9002
|
+
value: function _wrapResponse(recipient) {
|
9003
|
+
switch (recipient.type) {
|
9004
|
+
case "email":
|
9005
|
+
return new EmailRecipientDescriptor(recipient);
|
9006
|
+
|
9007
|
+
default:
|
9008
|
+
return new UnknownRecipientDescriptor(recipient);
|
9009
|
+
}
|
9010
|
+
}
|
9011
|
+
}]);
|
9012
|
+
|
9013
|
+
return MessageRecipientsClient;
|
9014
|
+
}();
|
9015
|
+
|
8749
9016
|
var _class;
|
8750
9017
|
|
8751
9018
|
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; }
|
@@ -9967,6 +10234,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9967
10234
|
configurationResponse = _context17.sent;
|
9968
10235
|
this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
|
9969
10236
|
this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
|
10237
|
+
this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
|
9970
10238
|
|
9971
10239
|
this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
|
9972
10240
|
|
@@ -10045,10 +10313,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10045
10313
|
}).catch(function (error) {
|
10046
10314
|
throw error;
|
10047
10315
|
});
|
10048
|
-
_context17.next =
|
10316
|
+
_context17.next = 30;
|
10049
10317
|
return this._services.users.myself._ensureFetched();
|
10050
10318
|
|
10051
|
-
case
|
10319
|
+
case 30:
|
10052
10320
|
Client_1._supportedPushChannels.forEach(function (channelType) {
|
10053
10321
|
return _this3._subscribeToPushNotifications(channelType);
|
10054
10322
|
});
|
@@ -10064,7 +10332,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10064
10332
|
this.emit("stateChanged", "initialized");
|
10065
10333
|
this.emit("initialized");
|
10066
10334
|
|
10067
|
-
case
|
10335
|
+
case 36:
|
10068
10336
|
case "end":
|
10069
10337
|
return _context17.stop();
|
10070
10338
|
}
|
@@ -10324,6 +10592,7 @@ exports.ContentTemplate = ContentTemplate;
|
|
10324
10592
|
exports.ContentTemplateVariable = ContentTemplateVariable;
|
10325
10593
|
exports.Conversation = Conversation;
|
10326
10594
|
exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
|
10595
|
+
exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
|
10327
10596
|
exports.Media = Media;
|
10328
10597
|
exports.Message = Message;
|
10329
10598
|
exports.MessageBuilder = MessageBuilder;
|
@@ -10331,6 +10600,7 @@ exports.NotificationTypes = NotificationTypes;
|
|
10331
10600
|
exports.Participant = Participant;
|
10332
10601
|
exports.PushNotification = PushNotification;
|
10333
10602
|
exports.RestPaginator = RestPaginator;
|
10603
|
+
exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
|
10334
10604
|
exports.UnsentMessage = UnsentMessage;
|
10335
10605
|
exports.User = User;
|
10336
10606
|
//# sourceMappingURL=browser.js.map
|