@twilio/conversations 3.0.1-rc.102 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/builds/browser.esm.js +10846 -0
- package/builds/browser.esm.js.map +1 -0
- package/builds/browser.js +891 -260
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +162 -52
- package/builds/lib.esm.d.ts +3178 -0
- package/builds/lib.esm.js +10845 -0
- package/builds/lib.js +900 -260
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +9407 -10424
- package/builds/twilio-conversations.js.map +1 -0
- package/builds/twilio-conversations.min.js +2 -1
- package/builds/twilio-conversations.min.js.map +1 -0
- package/dist/aggregated-delivery-receipt.js +1 -5
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/channel-metadata-client.js +5 -10
- package/dist/channel-metadata-client.js.map +1 -1
- package/dist/client.js +218 -204
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +6 -10
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +14 -14
- package/dist/configuration.js.map +1 -1
- package/dist/content-client.js +5 -9
- package/dist/content-client.js.map +1 -1
- package/dist/content-template.js +1 -7
- package/dist/content-template.js.map +1 -1
- package/dist/conversation.js +170 -134
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +44 -46
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +18 -22
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +22 -25
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +10 -14
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +1 -5
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/index.js +17 -46
- package/dist/index.js.map +1 -1
- package/dist/interfaces/notification-types.js +1 -5
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/interfaces/rules.js +7 -13
- package/dist/interfaces/rules.js.map +1 -1
- package/dist/logger.js +9 -29
- package/dist/logger.js.map +1 -1
- package/dist/media.js +32 -25
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +43 -47
- package/dist/message-builder.js.map +1 -1
- package/dist/message-recipients-client.js +231 -0
- package/dist/message-recipients-client.js.map +1 -0
- package/dist/message.js +120 -98
- package/dist/message.js.map +1 -1
- package/dist/node_modules/quick-lru/index.js +1 -5
- package/dist/node_modules/quick-lru/index.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +7 -6
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/conversations/package.json.js +2 -6
- package/dist/packages/conversations/package.json.js.map +1 -1
- package/dist/participant.js +32 -37
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js +1 -5
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +1 -5
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js +3 -7
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +7 -10
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js +5 -9
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +21 -30
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +1 -5
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +36 -9
- package/dist/util/index.js.map +1 -1
- package/dist/utils/uuid.js +145 -0
- package/dist/utils/uuid.js.map +1 -0
- package/package.json +14 -17
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/docs/classes/AggregatedDeliveryReceipt.html +0 -3184
- package/docs/classes/CancellablePromise.html +0 -3213
- package/docs/classes/ChannelMetadata.html +0 -3050
- package/docs/classes/Client.html +0 -4278
- package/docs/classes/ContentTemplate.html +0 -3116
- package/docs/classes/ContentTemplateVariable.html +0 -3116
- package/docs/classes/Conversation.html +0 -4359
- package/docs/classes/DetailedDeliveryReceipt.html +0 -3163
- package/docs/classes/Media.html +0 -3167
- package/docs/classes/Message.html +0 -3803
- package/docs/classes/MessageBuilder.html +0 -3318
- package/docs/classes/Participant.html +0 -3444
- package/docs/classes/PushNotification.html +0 -3130
- package/docs/classes/RestPaginator.html +0 -3160
- package/docs/classes/UnsentMessage.html +0 -3042
- package/docs/classes/User.html +0 -3349
- package/docs/index.html +0 -4333
- package/docs/interfaces/ClientOptions.html +0 -3050
- package/docs/interfaces/ConversationBindings.html +0 -3001
- package/docs/interfaces/ConversationEmailBinding.html +0 -3001
- package/docs/interfaces/ConversationLimits.html +0 -3098
- package/docs/interfaces/ConversationState.html +0 -3050
- package/docs/interfaces/ConversationUpdatedEventArgs.html +0 -3001
- package/docs/interfaces/CreateConversationOptions.html +0 -3066
- package/docs/interfaces/LastMessage.html +0 -3050
- package/docs/interfaces/Paginator.html +0 -3141
- package/docs/interfaces/ParticipantBindings.html +0 -3001
- package/docs/interfaces/ParticipantEmailBinding.html +0 -3001
- package/docs/interfaces/PushNotificationData.html +0 -3114
- package/docs/interfaces/SendEmailOptions.html +0 -3034
- package/docs/interfaces/SendMediaOptions.html +0 -3068
- package/docs/modules.html +0 -4334
package/builds/browser.js
CHANGED
|
@@ -154,10 +154,10 @@ var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
|
154
154
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
155
155
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
156
156
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
157
|
-
require('core-js/modules/es.object.to-string.js');
|
|
158
|
-
require('core-js/modules/es.promise.js');
|
|
159
157
|
require('core-js/modules/es.array.map.js');
|
|
158
|
+
require('core-js/modules/es.object.to-string.js');
|
|
160
159
|
require('core-js/modules/web.dom-collections.for-each.js');
|
|
160
|
+
require('core-js/modules/es.promise.js');
|
|
161
161
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
162
162
|
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
163
163
|
require('core-js/modules/es.array.concat.js');
|
|
@@ -176,7 +176,6 @@ var declarativeTypeValidator = require('@twilio/declarative-type-validator');
|
|
|
176
176
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
177
177
|
require('core-js/modules/es.array.includes.js');
|
|
178
178
|
var replayEventEmitter = require('@twilio/replay-event-emitter');
|
|
179
|
-
var isEqual = require('lodash.isequal');
|
|
180
179
|
require('core-js/modules/es.array.slice.js');
|
|
181
180
|
require('core-js/modules/es.function.name.js');
|
|
182
181
|
require('core-js/modules/es.regexp.test.js');
|
|
@@ -217,16 +216,15 @@ require('core-js/modules/es.typed-array.subarray.js');
|
|
|
217
216
|
require('core-js/modules/es.typed-array.to-locale-string.js');
|
|
218
217
|
require('core-js/modules/es.typed-array.to-string.js');
|
|
219
218
|
require('core-js/modules/es.array-buffer.constructor.js');
|
|
220
|
-
require('isomorphic-form-data');
|
|
221
219
|
require('core-js/modules/es.array.sort.js');
|
|
222
220
|
require('core-js/modules/es.string.includes.js');
|
|
223
221
|
require('core-js/modules/es.string.starts-with.js');
|
|
222
|
+
require('core-js/modules/es.weak-set.js');
|
|
224
223
|
var deprecationDecorator = require('@twilio/deprecation-decorator');
|
|
225
224
|
require('core-js/modules/es.object.entries.js');
|
|
226
225
|
require('core-js/modules/es.array.find.js');
|
|
227
226
|
require('core-js/modules/es.array.splice.js');
|
|
228
227
|
var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
|
|
229
|
-
var uuid = require('uuid');
|
|
230
228
|
require('core-js/modules/es.object.freeze.js');
|
|
231
229
|
|
|
232
230
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -261,7 +259,6 @@ var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regenerat
|
|
|
261
259
|
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
262
260
|
var loglevelLog__namespace = /*#__PURE__*/_interopNamespace(loglevelLog);
|
|
263
261
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
264
|
-
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
265
262
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
266
263
|
var _wrapNativeSuper__default = /*#__PURE__*/_interopDefaultLegacy(_wrapNativeSuper);
|
|
267
264
|
|
|
@@ -301,11 +298,13 @@ var Logger = /*#__PURE__*/function () {
|
|
|
301
298
|
}, {
|
|
302
299
|
key: "trace",
|
|
303
300
|
value: function trace() {
|
|
304
|
-
|
|
305
|
-
args
|
|
306
|
-
|
|
301
|
+
if (log$7.getLevel() == log$7.levels.TRACE) {
|
|
302
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
303
|
+
args[_key] = arguments[_key];
|
|
304
|
+
}
|
|
307
305
|
|
|
308
|
-
|
|
306
|
+
log$7.debug.apply(null, prepareLine(this.prefix + "T", args));
|
|
307
|
+
}
|
|
309
308
|
}
|
|
310
309
|
}, {
|
|
311
310
|
key: "debug",
|
|
@@ -356,11 +355,13 @@ var Logger = /*#__PURE__*/function () {
|
|
|
356
355
|
}, {
|
|
357
356
|
key: "trace",
|
|
358
357
|
value: function trace() {
|
|
359
|
-
|
|
360
|
-
args
|
|
361
|
-
|
|
358
|
+
if (log$7.getLevel() == log$7.levels.TRACE) {
|
|
359
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
360
|
+
args[_key6] = arguments[_key6];
|
|
361
|
+
}
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
log$7.debug.apply(null, prepareLine("T", args));
|
|
364
|
+
}
|
|
364
365
|
}
|
|
365
366
|
}, {
|
|
366
367
|
key: "debug",
|
|
@@ -414,9 +415,11 @@ var MINIMUM_RETRY_DELAY = 1000;
|
|
|
414
415
|
var MAXIMUM_RETRY_DELAY = 4000;
|
|
415
416
|
var MAXIMUM_ATTEMPTS_COUNT = 3;
|
|
416
417
|
var RETRY_WHEN_THROTTLED = true;
|
|
418
|
+
var CHANNEL_METADATA_CACHE_CAPACITY = 100;
|
|
419
|
+
var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
|
|
417
420
|
|
|
418
421
|
var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
|
|
419
|
-
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;
|
|
420
423
|
|
|
421
424
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
422
425
|
var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -475,7 +478,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
|
|
|
475
478
|
this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
|
|
476
479
|
}
|
|
477
480
|
|
|
478
|
-
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;
|
|
479
483
|
});
|
|
480
484
|
|
|
481
485
|
/**
|
|
@@ -567,6 +571,56 @@ var UriBuilder = /*#__PURE__*/function () {
|
|
|
567
571
|
|
|
568
572
|
return UriBuilder;
|
|
569
573
|
}();
|
|
574
|
+
/**
|
|
575
|
+
* Deep equality check for objects
|
|
576
|
+
* @param a - first value to compare
|
|
577
|
+
* @param b - second value to compare
|
|
578
|
+
* @returns true if values are deeply equal
|
|
579
|
+
*/
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
function isEqual(a, b) {
|
|
583
|
+
if (a === b) {
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (a === null || b === null || a === undefined || b === undefined) {
|
|
588
|
+
return a === b;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
if (_typeof__default["default"](a) !== _typeof__default["default"](b)) {
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (_typeof__default["default"](a) !== "object") {
|
|
596
|
+
return a === b;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
600
|
+
if (a.length !== b.length) {
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return a.every(function (item, index) {
|
|
605
|
+
return isEqual(item, b[index]);
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
var aKeys = Object.keys(a);
|
|
614
|
+
var bKeys = Object.keys(b);
|
|
615
|
+
|
|
616
|
+
if (aKeys.length !== bKeys.length) {
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
return aKeys.every(function (key) {
|
|
621
|
+
return isEqual(a[key], b[key]);
|
|
622
|
+
});
|
|
623
|
+
}
|
|
570
624
|
|
|
571
625
|
var json = declarativeTypeValidator.custom(function (value) {
|
|
572
626
|
return [["string", "number", "boolean", "object"].includes(_typeof__default["default"](value)), "a JSON type"];
|
|
@@ -647,6 +701,22 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
647
701
|
* @event
|
|
648
702
|
*/
|
|
649
703
|
|
|
704
|
+
/**
|
|
705
|
+
* Fired when the client has subscribed to the user.
|
|
706
|
+
*
|
|
707
|
+
* Parameters:
|
|
708
|
+
* 1. {@link User} `user` - the user in question
|
|
709
|
+
* @event
|
|
710
|
+
*/
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Fired when the client has unsubscribed from the user.
|
|
714
|
+
*
|
|
715
|
+
* Parameters:
|
|
716
|
+
* 1. {@link User} `user` - the user in question
|
|
717
|
+
* @event
|
|
718
|
+
*/
|
|
719
|
+
|
|
650
720
|
|
|
651
721
|
_createClass__default["default"](User, [{
|
|
652
722
|
key: "identity",
|
|
@@ -741,7 +811,7 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
741
811
|
case 9:
|
|
742
812
|
updateAttributes = parseAttributes(value.value, "Retrieved malformed attributes from the server for user: ".concat(this.state.identity), log$6);
|
|
743
813
|
|
|
744
|
-
if (!
|
|
814
|
+
if (!isEqual(this.state.attributes, updateAttributes)) {
|
|
745
815
|
this.state.attributes = updateAttributes;
|
|
746
816
|
updateReasons.push("attributes");
|
|
747
817
|
}
|
|
@@ -1093,11 +1163,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
|
|
|
1093
1163
|
|
|
1094
1164
|
__decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
|
|
1095
1165
|
|
|
1096
|
-
function _createForOfIteratorHelper$
|
|
1166
|
+
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
1167
|
|
|
1098
|
-
function _unsupportedIterableToArray$
|
|
1168
|
+
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
1169
|
|
|
1100
|
-
function _arrayLikeToArray$
|
|
1170
|
+
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
1171
|
|
|
1102
1172
|
var Network = /*#__PURE__*/function () {
|
|
1103
1173
|
function Network(configuration, services) {
|
|
@@ -1118,7 +1188,7 @@ var Network = /*#__PURE__*/function () {
|
|
|
1118
1188
|
}, {
|
|
1119
1189
|
key: "cleanupCache",
|
|
1120
1190
|
value: function cleanupCache() {
|
|
1121
|
-
var _iterator = _createForOfIteratorHelper$
|
|
1191
|
+
var _iterator = _createForOfIteratorHelper$5(this.cache),
|
|
1122
1192
|
_step;
|
|
1123
1193
|
|
|
1124
1194
|
try {
|
|
@@ -1319,6 +1389,24 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1319
1389
|
* @event
|
|
1320
1390
|
*/
|
|
1321
1391
|
|
|
1392
|
+
/**
|
|
1393
|
+
* Fired when the participant has stopped typing.
|
|
1394
|
+
*
|
|
1395
|
+
* Parameters:
|
|
1396
|
+
* 1. {@link Participant} `participant` - the participant in question
|
|
1397
|
+
* @event
|
|
1398
|
+
*/
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Fired when the fields of the participant have been updated.
|
|
1402
|
+
*
|
|
1403
|
+
* Parameters:
|
|
1404
|
+
* 1. object `data` - info object provided with the event. It has the following properties:
|
|
1405
|
+
* * {@link Participant} participant - the participant in question
|
|
1406
|
+
* * {@link ParticipantUpdateReason}[] updateReasons - array of reasons for the update
|
|
1407
|
+
* @event
|
|
1408
|
+
*/
|
|
1409
|
+
|
|
1322
1410
|
|
|
1323
1411
|
_createClass__default["default"](Participant, [{
|
|
1324
1412
|
key: "sid",
|
|
@@ -1445,8 +1533,9 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1445
1533
|
}
|
|
1446
1534
|
|
|
1447
1535
|
this.state.isTyping = true;
|
|
1448
|
-
this.emit(
|
|
1449
|
-
this.conversation.emit(
|
|
1536
|
+
this.emit(Participant.typingStarted, this);
|
|
1537
|
+
this.conversation.emit(Conversation.typingStarted, this); // @fixme layering violation
|
|
1538
|
+
|
|
1450
1539
|
this.state.typingTimeout = Number(setTimeout(function () {
|
|
1451
1540
|
return _this2._endTyping();
|
|
1452
1541
|
}, timeout));
|
|
@@ -1465,8 +1554,8 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1465
1554
|
}
|
|
1466
1555
|
|
|
1467
1556
|
this.state.isTyping = false;
|
|
1468
|
-
this.emit(
|
|
1469
|
-
this.conversation.emit(
|
|
1557
|
+
this.emit(Participant.typingEnded, this);
|
|
1558
|
+
this.conversation.emit(Conversation.typingEnded, this);
|
|
1470
1559
|
clearInterval(this.state.typingTimeout);
|
|
1471
1560
|
this.state.typingTimeout = null;
|
|
1472
1561
|
}
|
|
@@ -1481,7 +1570,7 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1481
1570
|
var updateReasons = [];
|
|
1482
1571
|
var updateAttributes = parseAttributes(data.attributes, "Retrieved malformed attributes from the server for participant: " + this.state.sid, log$5);
|
|
1483
1572
|
|
|
1484
|
-
if (data.attributes && !
|
|
1573
|
+
if (data.attributes && !isEqual(this.state.attributes, updateAttributes)) {
|
|
1485
1574
|
this.state.attributes = updateAttributes;
|
|
1486
1575
|
updateReasons.push("attributes");
|
|
1487
1576
|
}
|
|
@@ -1519,13 +1608,13 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1519
1608
|
}
|
|
1520
1609
|
}
|
|
1521
1610
|
|
|
1522
|
-
if (data.bindings && !
|
|
1611
|
+
if (data.bindings && !isEqual(this.state.bindings, data.bindings)) {
|
|
1523
1612
|
this.state.bindings = data.bindings;
|
|
1524
1613
|
updateReasons.push("bindings");
|
|
1525
1614
|
}
|
|
1526
1615
|
|
|
1527
1616
|
if (updateReasons.length > 0) {
|
|
1528
|
-
this.emit(
|
|
1617
|
+
this.emit(Participant.updated, {
|
|
1529
1618
|
participant: this,
|
|
1530
1619
|
updateReasons: updateReasons
|
|
1531
1620
|
});
|
|
@@ -1661,7 +1750,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1661
1750
|
|
|
1662
1751
|
var _super = _createSuper$7(Participants);
|
|
1663
1752
|
|
|
1664
|
-
|
|
1753
|
+
// passed in from Conversation
|
|
1754
|
+
function Participants(conversation, participants, links, services) {
|
|
1665
1755
|
var _this;
|
|
1666
1756
|
|
|
1667
1757
|
_classCallCheck__default["default"](this, Participants);
|
|
@@ -1673,7 +1763,6 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1673
1763
|
_this.conversation = conversation;
|
|
1674
1764
|
_this.participants = participants;
|
|
1675
1765
|
_this.links = links;
|
|
1676
|
-
_this.configuration = configuration;
|
|
1677
1766
|
_this.services = services;
|
|
1678
1767
|
return _this;
|
|
1679
1768
|
}
|
|
@@ -1724,14 +1813,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1724
1813
|
mode: "open_existing"
|
|
1725
1814
|
}) : Promise.resolve(arg);
|
|
1726
1815
|
return this.rosterEntityPromise = this.rosterEntityPromise || participantsMapPromise.then(function (rosterMap) {
|
|
1727
|
-
rosterMap.on(
|
|
1816
|
+
rosterMap.on(twilioSync.SyncMap.itemAdded, function (args) {
|
|
1728
1817
|
log$4.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
|
|
1729
1818
|
|
|
1730
1819
|
_this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
|
|
1731
|
-
_this2.emit(
|
|
1820
|
+
_this2.emit(Conversation.participantJoined, participant);
|
|
1732
1821
|
});
|
|
1733
1822
|
});
|
|
1734
|
-
rosterMap.on(
|
|
1823
|
+
rosterMap.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
|
1735
1824
|
log$4.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
|
|
1736
1825
|
var participantSid = args.key;
|
|
1737
1826
|
|
|
@@ -1747,12 +1836,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1747
1836
|
return;
|
|
1748
1837
|
}
|
|
1749
1838
|
|
|
1750
|
-
_this2.emit(
|
|
1839
|
+
_this2.emit(Conversation.participantLeft, leftParticipant);
|
|
1751
1840
|
});
|
|
1752
|
-
rosterMap.on(
|
|
1841
|
+
rosterMap.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
|
1753
1842
|
log$4.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
|
|
1754
1843
|
|
|
1755
|
-
_this2.upsertParticipant(args.item.key, args.item.data)
|
|
1844
|
+
_this2.upsertParticipant(args.item.key, args.item.data).catch(function (e) {
|
|
1845
|
+
return log$4.error(e);
|
|
1846
|
+
});
|
|
1756
1847
|
});
|
|
1757
1848
|
var participantsPromises = [];
|
|
1758
1849
|
|
|
@@ -1846,8 +1937,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1846
1937
|
};
|
|
1847
1938
|
participant = new Participant(data, participantSid, this.conversation, links, this.services);
|
|
1848
1939
|
this.participants.set(participantSid, participant);
|
|
1849
|
-
participant.on(
|
|
1850
|
-
return _this3.emit(
|
|
1940
|
+
participant.on(Participant.updated, function (args) {
|
|
1941
|
+
return _this3.emit(Conversation.participantUpdated, args);
|
|
1851
1942
|
});
|
|
1852
1943
|
return _context3.abrupt("return", participant);
|
|
1853
1944
|
|
|
@@ -2111,6 +2202,8 @@ var Media = /*#__PURE__*/function () {
|
|
|
2111
2202
|
* @internal
|
|
2112
2203
|
*/
|
|
2113
2204
|
function Media(data, services) {
|
|
2205
|
+
var _data$filename;
|
|
2206
|
+
|
|
2114
2207
|
_classCallCheck__default["default"](this, Media);
|
|
2115
2208
|
|
|
2116
2209
|
_defineProperty__default["default"](this, "mcsMedia", null);
|
|
@@ -2124,7 +2217,7 @@ var Media = /*#__PURE__*/function () {
|
|
|
2124
2217
|
this.state = {
|
|
2125
2218
|
sid: data.sid,
|
|
2126
2219
|
category: data.category,
|
|
2127
|
-
filename: data.filename,
|
|
2220
|
+
filename: (_data$filename = data.filename) !== null && _data$filename !== void 0 ? _data$filename : null,
|
|
2128
2221
|
contentType: data.contentType,
|
|
2129
2222
|
size: data.size
|
|
2130
2223
|
};
|
|
@@ -2197,10 +2290,12 @@ var Media = /*#__PURE__*/function () {
|
|
|
2197
2290
|
while (1) {
|
|
2198
2291
|
switch (_context.prev = _context.next) {
|
|
2199
2292
|
case 0:
|
|
2200
|
-
fetchMediaRequest = _this._fetchMcsMedia();
|
|
2293
|
+
fetchMediaRequest = _this.mcsMedia ? undefined : _this._fetchMcsMedia();
|
|
2201
2294
|
contentUrlRequest = (_this$mcsMedia = _this.mcsMedia) === null || _this$mcsMedia === void 0 ? void 0 : _this$mcsMedia.getContentUrl();
|
|
2202
2295
|
onCancel(function () {
|
|
2203
|
-
fetchMediaRequest
|
|
2296
|
+
if (fetchMediaRequest) {
|
|
2297
|
+
fetchMediaRequest.cancel();
|
|
2298
|
+
}
|
|
2204
2299
|
|
|
2205
2300
|
if (contentUrlRequest) {
|
|
2206
2301
|
contentUrlRequest.cancel();
|
|
@@ -2208,7 +2303,7 @@ var Media = /*#__PURE__*/function () {
|
|
|
2208
2303
|
});
|
|
2209
2304
|
_context.prev = 3;
|
|
2210
2305
|
|
|
2211
|
-
if (
|
|
2306
|
+
if (contentUrlRequest) {
|
|
2212
2307
|
_context.next = 9;
|
|
2213
2308
|
break;
|
|
2214
2309
|
}
|
|
@@ -2218,7 +2313,7 @@ var Media = /*#__PURE__*/function () {
|
|
|
2218
2313
|
|
|
2219
2314
|
case 7:
|
|
2220
2315
|
mcsMedia = _context.sent;
|
|
2221
|
-
contentUrlRequest = mcsMedia.getContentUrl();
|
|
2316
|
+
contentUrlRequest = mcsMedia === null || mcsMedia === void 0 ? void 0 : mcsMedia.getContentUrl();
|
|
2222
2317
|
|
|
2223
2318
|
case 9:
|
|
2224
2319
|
_context.t0 = resolve;
|
|
@@ -2275,13 +2370,11 @@ var Media = /*#__PURE__*/function () {
|
|
|
2275
2370
|
while (1) {
|
|
2276
2371
|
switch (_context2.prev = _context2.next) {
|
|
2277
2372
|
case 0:
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
if (!_this2.services.mcsClient) {
|
|
2281
|
-
_context2.next = 14;
|
|
2282
|
-
break;
|
|
2373
|
+
if (_this2.services.mcsClient === null) {
|
|
2374
|
+
reject(new Error("Media Content Service is unavailable"));
|
|
2283
2375
|
}
|
|
2284
2376
|
|
|
2377
|
+
request = _this2.services.mcsClient.get(_this2.state.sid);
|
|
2285
2378
|
onCancel(function () {
|
|
2286
2379
|
return request.cancel();
|
|
2287
2380
|
});
|
|
@@ -2291,27 +2384,22 @@ var Media = /*#__PURE__*/function () {
|
|
|
2291
2384
|
|
|
2292
2385
|
case 6:
|
|
2293
2386
|
_this2.mcsMedia = _context2.sent;
|
|
2387
|
+
_this2.state = _this2.mcsMedia._state();
|
|
2294
2388
|
resolve(_this2.mcsMedia);
|
|
2295
|
-
_context2.next =
|
|
2389
|
+
_context2.next = 14;
|
|
2296
2390
|
break;
|
|
2297
2391
|
|
|
2298
|
-
case
|
|
2299
|
-
_context2.prev =
|
|
2392
|
+
case 11:
|
|
2393
|
+
_context2.prev = 11;
|
|
2300
2394
|
_context2.t0 = _context2["catch"](3);
|
|
2301
2395
|
reject(_context2.t0);
|
|
2302
2396
|
|
|
2303
|
-
case 13:
|
|
2304
|
-
return _context2.abrupt("return");
|
|
2305
|
-
|
|
2306
2397
|
case 14:
|
|
2307
|
-
reject(new Error("Media Content Service is unavailable"));
|
|
2308
|
-
|
|
2309
|
-
case 15:
|
|
2310
2398
|
case "end":
|
|
2311
2399
|
return _context2.stop();
|
|
2312
2400
|
}
|
|
2313
2401
|
}
|
|
2314
|
-
}, _callee2, null, [[3,
|
|
2402
|
+
}, _callee2, null, [[3, 11]]);
|
|
2315
2403
|
}));
|
|
2316
2404
|
|
|
2317
2405
|
return function (_x4, _x5, _x6) {
|
|
@@ -2319,6 +2407,15 @@ var Media = /*#__PURE__*/function () {
|
|
|
2319
2407
|
};
|
|
2320
2408
|
}());
|
|
2321
2409
|
}
|
|
2410
|
+
/**
|
|
2411
|
+
* @internal
|
|
2412
|
+
*/
|
|
2413
|
+
|
|
2414
|
+
}, {
|
|
2415
|
+
key: "_state",
|
|
2416
|
+
value: function _state() {
|
|
2417
|
+
return this.state;
|
|
2418
|
+
}
|
|
2322
2419
|
}]);
|
|
2323
2420
|
|
|
2324
2421
|
return Media;
|
|
@@ -2816,6 +2913,12 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
2816
2913
|
function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
|
|
2817
2914
|
|
|
2818
2915
|
function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2916
|
+
|
|
2917
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
2918
|
+
|
|
2919
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
2920
|
+
|
|
2921
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
2819
2922
|
var log$3 = Logger.scope("Message");
|
|
2820
2923
|
|
|
2821
2924
|
var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -2825,6 +2928,10 @@ global["XMLHttpRequest"] || {};
|
|
|
2825
2928
|
*/
|
|
2826
2929
|
|
|
2827
2930
|
|
|
2931
|
+
var _wrapMedia = /*#__PURE__*/new WeakSet();
|
|
2932
|
+
|
|
2933
|
+
var _assignMedias = /*#__PURE__*/new WeakSet();
|
|
2934
|
+
|
|
2828
2935
|
var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
2829
2936
|
_inherits__default["default"](Message, _ReplayEventEmitter);
|
|
2830
2937
|
|
|
@@ -2838,13 +2945,18 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
2838
2945
|
* @internal
|
|
2839
2946
|
*/
|
|
2840
2947
|
function Message(index, data, conversation, links, configuration, services) {
|
|
2841
|
-
var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid, _data$channelMetadata;
|
|
2948
|
+
var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid, _data$channelMetadata, _data$medias, _data$media;
|
|
2842
2949
|
|
|
2843
2950
|
var _this;
|
|
2844
2951
|
|
|
2845
2952
|
_classCallCheck__default["default"](this, Message);
|
|
2846
2953
|
|
|
2847
2954
|
_this = _super.call(this);
|
|
2955
|
+
|
|
2956
|
+
_classPrivateMethodInitSpec(_assertThisInitialized__default["default"](_this), _assignMedias);
|
|
2957
|
+
|
|
2958
|
+
_classPrivateMethodInitSpec(_assertThisInitialized__default["default"](_this), _wrapMedia);
|
|
2959
|
+
|
|
2848
2960
|
_this.conversation = conversation;
|
|
2849
2961
|
_this.links = links;
|
|
2850
2962
|
_this.configuration = configuration;
|
|
@@ -2861,16 +2973,15 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
2861
2973
|
lastUpdatedBy: (_data$lastUpdatedBy = data.lastUpdatedBy) !== null && _data$lastUpdatedBy !== void 0 ? _data$lastUpdatedBy : null,
|
|
2862
2974
|
attributes: parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(data.sid), log$3),
|
|
2863
2975
|
type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type : "text",
|
|
2864
|
-
media:
|
|
2865
|
-
medias:
|
|
2866
|
-
return new Media(m, _this.services);
|
|
2867
|
-
}) : data.type === "media" && data.media && !data.medias ? [new Media(_objectSpread$4(_objectSpread$4({}, data.media), {}, {
|
|
2868
|
-
category: "media"
|
|
2869
|
-
}), _this.services)] : null,
|
|
2976
|
+
media: null,
|
|
2977
|
+
medias: null,
|
|
2870
2978
|
participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
|
|
2871
2979
|
aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null,
|
|
2872
2980
|
hasChannelMetadata: (_data$channelMetadata = data.channelMetadata) !== null && _data$channelMetadata !== void 0 ? _data$channelMetadata : false
|
|
2873
2981
|
};
|
|
2982
|
+
|
|
2983
|
+
_classPrivateMethodGet(_assertThisInitialized__default["default"](_this), _assignMedias, _assignMedias2).call(_assertThisInitialized__default["default"](_this), (_data$medias = data.medias) !== null && _data$medias !== void 0 ? _data$medias : null, (_data$media = data.media) !== null && _data$media !== void 0 ? _data$media : null);
|
|
2984
|
+
|
|
2874
2985
|
return _this;
|
|
2875
2986
|
}
|
|
2876
2987
|
/**
|
|
@@ -3092,6 +3203,12 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3092
3203
|
}, {
|
|
3093
3204
|
key: "_update",
|
|
3094
3205
|
value: function _update(data) {
|
|
3206
|
+
var _data$medias2,
|
|
3207
|
+
_this2 = this,
|
|
3208
|
+
_this$state$medias2,
|
|
3209
|
+
_classPrivateMethodGe2,
|
|
3210
|
+
_this$state$media;
|
|
3211
|
+
|
|
3095
3212
|
var updateReasons = [];
|
|
3096
3213
|
|
|
3097
3214
|
if ((data.text || typeof data.text === "string") && data.text !== this.state.body) {
|
|
@@ -3126,7 +3243,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3126
3243
|
|
|
3127
3244
|
var updatedAttributes = parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(this.sid), log$3);
|
|
3128
3245
|
|
|
3129
|
-
if (!
|
|
3246
|
+
if (!isEqual(this.state.attributes, updatedAttributes)) {
|
|
3130
3247
|
this.state.attributes = updatedAttributes;
|
|
3131
3248
|
updateReasons.push("attributes");
|
|
3132
3249
|
}
|
|
@@ -3144,6 +3261,29 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3144
3261
|
|
|
3145
3262
|
updateReasons.push("deliveryReceipt");
|
|
3146
3263
|
}
|
|
3264
|
+
} // @fixme: This is a fairly heavy check.
|
|
3265
|
+
// Map data back and forth to perform a necessary field massage.
|
|
3266
|
+
|
|
3267
|
+
|
|
3268
|
+
var input = ((_data$medias2 = data.medias) !== null && _data$medias2 !== void 0 ? _data$medias2 : []).map(function (value) {
|
|
3269
|
+
var _classPrivateMethodGe;
|
|
3270
|
+
|
|
3271
|
+
return (_classPrivateMethodGe = _classPrivateMethodGet(_this2, _wrapMedia, _wrapMedia2).call(_this2, value)) === null || _classPrivateMethodGe === void 0 ? void 0 : _classPrivateMethodGe._state();
|
|
3272
|
+
}).filter(function (el) {
|
|
3273
|
+
return !(el === null);
|
|
3274
|
+
});
|
|
3275
|
+
var current = ((_this$state$medias2 = this.state.medias) !== null && _this$state$medias2 !== void 0 ? _this$state$medias2 : []).map(function (value) {
|
|
3276
|
+
return value._state();
|
|
3277
|
+
}).filter(function (el) {
|
|
3278
|
+
return !(el === null);
|
|
3279
|
+
});
|
|
3280
|
+
|
|
3281
|
+
if (!isEqual(input, current) || !isEqual((_classPrivateMethodGe2 = _classPrivateMethodGet(this, _wrapMedia, _wrapMedia2).call(this, data.media)) === null || _classPrivateMethodGe2 === void 0 ? void 0 : _classPrivateMethodGe2._state(), (_this$state$media = this.state.media) === null || _this$state$media === void 0 ? void 0 : _this$state$media._state())) {
|
|
3282
|
+
var _data$medias3, _data$media2;
|
|
3283
|
+
|
|
3284
|
+
_classPrivateMethodGet(this, _assignMedias, _assignMedias2).call(this, (_data$medias3 = data.medias) !== null && _data$medias3 !== void 0 ? _data$medias3 : null, (_data$media2 = data.media) !== null && _data$media2 !== void 0 ? _data$media2 : null);
|
|
3285
|
+
|
|
3286
|
+
updateReasons.push("media");
|
|
3147
3287
|
}
|
|
3148
3288
|
|
|
3149
3289
|
if (updateReasons.length > 0) {
|
|
@@ -3161,9 +3301,9 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3161
3301
|
key: "getParticipant",
|
|
3162
3302
|
value: function () {
|
|
3163
3303
|
var _getParticipant = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
3164
|
-
var
|
|
3304
|
+
var _this3 = this;
|
|
3165
3305
|
|
|
3166
|
-
var participant,
|
|
3306
|
+
var participant, errorMessage;
|
|
3167
3307
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
3168
3308
|
while (1) {
|
|
3169
3309
|
switch (_context.prev = _context.next) {
|
|
@@ -3177,7 +3317,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3177
3317
|
|
|
3178
3318
|
_context.next = 4;
|
|
3179
3319
|
return this.conversation.getParticipantBySid(this.state.participantSid).catch(function () {
|
|
3180
|
-
log$3.debug("Participant with sid \"".concat(
|
|
3320
|
+
log$3.debug("Participant with sid \"".concat(_this3.participantSid, "\" not found for message ").concat(_this3.sid));
|
|
3181
3321
|
return null;
|
|
3182
3322
|
});
|
|
3183
3323
|
|
|
@@ -3192,7 +3332,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3192
3332
|
|
|
3193
3333
|
_context.next = 8;
|
|
3194
3334
|
return this.conversation.getParticipantByIdentity(this.state.author).catch(function () {
|
|
3195
|
-
log$3.debug("Participant with identity \"".concat(
|
|
3335
|
+
log$3.debug("Participant with identity \"".concat(_this3.author, "\" not found for message ").concat(_this3.sid));
|
|
3196
3336
|
return null;
|
|
3197
3337
|
});
|
|
3198
3338
|
|
|
@@ -3208,26 +3348,26 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3208
3348
|
return _context.abrupt("return", participant);
|
|
3209
3349
|
|
|
3210
3350
|
case 11:
|
|
3211
|
-
|
|
3351
|
+
errorMessage = "Participant with ";
|
|
3212
3352
|
|
|
3213
3353
|
if (this.state.participantSid) {
|
|
3214
|
-
|
|
3354
|
+
errorMessage += "SID '" + this.state.participantSid + "' ";
|
|
3215
3355
|
}
|
|
3216
3356
|
|
|
3217
3357
|
if (this.state.author) {
|
|
3218
3358
|
if (this.state.participantSid) {
|
|
3219
|
-
|
|
3359
|
+
errorMessage += "or ";
|
|
3220
3360
|
}
|
|
3221
3361
|
|
|
3222
|
-
|
|
3362
|
+
errorMessage += "identity '" + this.state.author + "' ";
|
|
3223
3363
|
}
|
|
3224
3364
|
|
|
3225
|
-
if (
|
|
3226
|
-
|
|
3365
|
+
if (errorMessage === "Participant with ") {
|
|
3366
|
+
errorMessage = "Participant ";
|
|
3227
3367
|
}
|
|
3228
3368
|
|
|
3229
|
-
|
|
3230
|
-
throw new Error(
|
|
3369
|
+
errorMessage += "was not found";
|
|
3370
|
+
throw new Error(errorMessage);
|
|
3231
3371
|
|
|
3232
3372
|
case 17:
|
|
3233
3373
|
case "end":
|
|
@@ -3407,7 +3547,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3407
3547
|
key: "attachTemporaryUrlsFor",
|
|
3408
3548
|
value: function () {
|
|
3409
3549
|
var _attachTemporaryUrlsFor = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(contentSet) {
|
|
3410
|
-
var
|
|
3550
|
+
var _this4 = this;
|
|
3411
3551
|
|
|
3412
3552
|
var sids;
|
|
3413
3553
|
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context6) {
|
|
@@ -3430,7 +3570,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3430
3570
|
|
|
3431
3571
|
case 4:
|
|
3432
3572
|
return _context6.abrupt("return", _context6.sent.map(function (item) {
|
|
3433
|
-
return new Media(item,
|
|
3573
|
+
return new Media(item, _this4.services);
|
|
3434
3574
|
}));
|
|
3435
3575
|
|
|
3436
3576
|
case 7:
|
|
@@ -3473,7 +3613,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3473
3613
|
}, {
|
|
3474
3614
|
key: "getTemporaryContentUrlsForMediaSids",
|
|
3475
3615
|
value: function getTemporaryContentUrlsForMediaSids(mediaSids) {
|
|
3476
|
-
var
|
|
3616
|
+
var _this5 = this;
|
|
3477
3617
|
|
|
3478
3618
|
return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
|
|
3479
3619
|
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7(resolve, reject, onCancel) {
|
|
@@ -3482,9 +3622,9 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3482
3622
|
while (1) {
|
|
3483
3623
|
switch (_context7.prev = _context7.next) {
|
|
3484
3624
|
case 0:
|
|
3485
|
-
mediaGetRequest =
|
|
3625
|
+
mediaGetRequest = _this5.services.mcsClient.mediaSetGetContentUrls(mediaSids !== null && mediaSids !== void 0 ? mediaSids : []);
|
|
3486
3626
|
|
|
3487
|
-
if (!(!
|
|
3627
|
+
if (!(!_this5.services.mcsClient || !mediaSids)) {
|
|
3488
3628
|
_context7.next = 4;
|
|
3489
3629
|
break;
|
|
3490
3630
|
}
|
|
@@ -3543,7 +3683,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3543
3683
|
key: "_getDetailedDeliveryReceiptsPaginator",
|
|
3544
3684
|
value: function () {
|
|
3545
3685
|
var _getDetailedDeliveryReceiptsPaginator2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8(options) {
|
|
3546
|
-
var
|
|
3686
|
+
var _this6 = this;
|
|
3547
3687
|
|
|
3548
3688
|
var messagesReceiptsUrl, url, response;
|
|
3549
3689
|
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context8) {
|
|
@@ -3560,7 +3700,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3560
3700
|
return _context8.abrupt("return", new RestPaginator(response.body.delivery_receipts.map(function (x) {
|
|
3561
3701
|
return new DetailedDeliveryReceipt(x);
|
|
3562
3702
|
}), function (pageToken, pageSize) {
|
|
3563
|
-
return
|
|
3703
|
+
return _this6._getDetailedDeliveryReceiptsPaginator({
|
|
3564
3704
|
pageToken: pageToken,
|
|
3565
3705
|
pageSize: pageSize
|
|
3566
3706
|
});
|
|
@@ -3588,7 +3728,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3588
3728
|
}, {
|
|
3589
3729
|
key: "getContentData",
|
|
3590
3730
|
value: function getContentData() {
|
|
3591
|
-
var
|
|
3731
|
+
var _this7 = this;
|
|
3592
3732
|
|
|
3593
3733
|
return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
|
|
3594
3734
|
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9(resolve, reject, onCancel) {
|
|
@@ -3597,7 +3737,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3597
3737
|
while (1) {
|
|
3598
3738
|
switch (_context9.prev = _context9.next) {
|
|
3599
3739
|
case 0:
|
|
3600
|
-
if (!(
|
|
3740
|
+
if (!(_this7.state.contentSid === null)) {
|
|
3601
3741
|
_context9.next = 3;
|
|
3602
3742
|
break;
|
|
3603
3743
|
}
|
|
@@ -3606,7 +3746,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3606
3746
|
return _context9.abrupt("return");
|
|
3607
3747
|
|
|
3608
3748
|
case 3:
|
|
3609
|
-
bodies =
|
|
3749
|
+
bodies = _this7.getMediaByCategories(["body"]);
|
|
3610
3750
|
|
|
3611
3751
|
if (!(bodies === null)) {
|
|
3612
3752
|
_context9.next = 7;
|
|
@@ -3762,11 +3902,65 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3762
3902
|
|
|
3763
3903
|
return getChannelMetadata;
|
|
3764
3904
|
}()
|
|
3905
|
+
/**
|
|
3906
|
+
* Get recipients of the message.
|
|
3907
|
+
*/
|
|
3908
|
+
|
|
3909
|
+
}, {
|
|
3910
|
+
key: "getMessageRecipients",
|
|
3911
|
+
value: function () {
|
|
3912
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11() {
|
|
3913
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context11) {
|
|
3914
|
+
while (1) {
|
|
3915
|
+
switch (_context11.prev = _context11.next) {
|
|
3916
|
+
case 0:
|
|
3917
|
+
_context11.next = 2;
|
|
3918
|
+
return this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid, this.sid);
|
|
3919
|
+
|
|
3920
|
+
case 2:
|
|
3921
|
+
return _context11.abrupt("return", _context11.sent);
|
|
3922
|
+
|
|
3923
|
+
case 3:
|
|
3924
|
+
case "end":
|
|
3925
|
+
return _context11.stop();
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
}, _callee11, this);
|
|
3929
|
+
}));
|
|
3930
|
+
|
|
3931
|
+
function getMessageRecipients() {
|
|
3932
|
+
return _getMessageRecipients.apply(this, arguments);
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
return getMessageRecipients;
|
|
3936
|
+
}()
|
|
3765
3937
|
}]);
|
|
3766
3938
|
|
|
3767
3939
|
return Message;
|
|
3768
3940
|
}(replayEventEmitter.ReplayEventEmitter);
|
|
3769
3941
|
|
|
3942
|
+
function _wrapMedia2(media) {
|
|
3943
|
+
var category = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3944
|
+
return media ? category ? new Media(_objectSpread$4(_objectSpread$4({}, media), {}, {
|
|
3945
|
+
category: category
|
|
3946
|
+
}), this.services) : new Media(media, this.services) : null;
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
function _assignMedias2(medias, media) {
|
|
3950
|
+
var _this8 = this;
|
|
3951
|
+
|
|
3952
|
+
this.state.media = _classPrivateMethodGet(this, _wrapMedia, _wrapMedia2).call(this, media); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3953
|
+
// @ts-ignore
|
|
3954
|
+
|
|
3955
|
+
this.state.medias = medias ? medias.map(function (m) {
|
|
3956
|
+
return _classPrivateMethodGet(_this8, _wrapMedia, _wrapMedia2).call(_this8, m);
|
|
3957
|
+
}).filter(function (el) {
|
|
3958
|
+
return el !== null;
|
|
3959
|
+
}) : media && !medias ? [_classPrivateMethodGet(this, _wrapMedia, _wrapMedia2).call(this, media, "media")].filter(function (el) {
|
|
3960
|
+
return el !== null;
|
|
3961
|
+
}) : null;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3770
3964
|
_defineProperty__default["default"](Message, "updated", "updated");
|
|
3771
3965
|
|
|
3772
3966
|
__decorate([deprecationDecorator.deprecated("getMediaByCategory", "getMediaByCategories"), __metadata("design:type", Function), __metadata("design:paramtypes", [Array]), __metadata("design:returntype", Array)], Message.prototype, "getMediaByCategory", null);
|
|
@@ -3789,11 +3983,11 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
3789
3983
|
|
|
3790
3984
|
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
3985
|
|
|
3792
|
-
function _createForOfIteratorHelper$
|
|
3986
|
+
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
3987
|
|
|
3794
|
-
function _unsupportedIterableToArray$
|
|
3988
|
+
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
3989
|
|
|
3796
|
-
function _arrayLikeToArray$
|
|
3990
|
+
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
3991
|
|
|
3798
3992
|
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
3993
|
|
|
@@ -4001,7 +4195,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4001
4195
|
return request.cancel();
|
|
4002
4196
|
});
|
|
4003
4197
|
});
|
|
4004
|
-
_iterator = _createForOfIteratorHelper$
|
|
4198
|
+
_iterator = _createForOfIteratorHelper$4(message.mediaContent);
|
|
4005
4199
|
_context3.prev = 4;
|
|
4006
4200
|
|
|
4007
4201
|
_iterator.s();
|
|
@@ -4654,11 +4848,11 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
|
|
|
4654
4848
|
|
|
4655
4849
|
__decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
|
|
4656
4850
|
|
|
4657
|
-
function _createForOfIteratorHelper$
|
|
4851
|
+
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
4852
|
|
|
4659
|
-
function _unsupportedIterableToArray$
|
|
4853
|
+
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
4854
|
|
|
4661
|
-
function _arrayLikeToArray$
|
|
4855
|
+
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
4856
|
|
|
4663
4857
|
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
4858
|
|
|
@@ -4795,6 +4989,68 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4795
4989
|
* Logger instance.
|
|
4796
4990
|
*/
|
|
4797
4991
|
|
|
4992
|
+
/**
|
|
4993
|
+
* Unique system identifier of the conversation.
|
|
4994
|
+
*/
|
|
4995
|
+
|
|
4996
|
+
/**
|
|
4997
|
+
* Conversation links for REST requests.
|
|
4998
|
+
* @internal
|
|
4999
|
+
*/
|
|
5000
|
+
|
|
5001
|
+
/**
|
|
5002
|
+
* Configuration of the client that the conversation belongs to.
|
|
5003
|
+
*/
|
|
5004
|
+
|
|
5005
|
+
/**
|
|
5006
|
+
* Conversation service objects.
|
|
5007
|
+
*/
|
|
5008
|
+
|
|
5009
|
+
/**
|
|
5010
|
+
* Internal state of the conversation.
|
|
5011
|
+
*/
|
|
5012
|
+
|
|
5013
|
+
/**
|
|
5014
|
+
* Name of the conversation entity document.
|
|
5015
|
+
*/
|
|
5016
|
+
|
|
5017
|
+
/**
|
|
5018
|
+
* Messages entity.
|
|
5019
|
+
*/
|
|
5020
|
+
|
|
5021
|
+
/**
|
|
5022
|
+
* Sync list containing messages.
|
|
5023
|
+
*/
|
|
5024
|
+
|
|
5025
|
+
/**
|
|
5026
|
+
* Map of participants.
|
|
5027
|
+
* @internal
|
|
5028
|
+
*/
|
|
5029
|
+
|
|
5030
|
+
/**
|
|
5031
|
+
* Participants entity.
|
|
5032
|
+
*/
|
|
5033
|
+
|
|
5034
|
+
/**
|
|
5035
|
+
* Sync map containing participants.
|
|
5036
|
+
*/
|
|
5037
|
+
|
|
5038
|
+
/**
|
|
5039
|
+
* Source of the most recent update.
|
|
5040
|
+
*/
|
|
5041
|
+
|
|
5042
|
+
/**
|
|
5043
|
+
* Promise for the conversation entity document.
|
|
5044
|
+
*/
|
|
5045
|
+
|
|
5046
|
+
/**
|
|
5047
|
+
* Promise for the messages list.
|
|
5048
|
+
*/
|
|
5049
|
+
|
|
5050
|
+
/**
|
|
5051
|
+
* Conversation entity document.
|
|
5052
|
+
*/
|
|
5053
|
+
|
|
4798
5054
|
/**
|
|
4799
5055
|
* @param descriptor Conversation descriptor.
|
|
4800
5056
|
* @param sid Conversation SID.
|
|
@@ -4836,32 +5092,39 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4836
5092
|
participants: _this._links.participants
|
|
4837
5093
|
};
|
|
4838
5094
|
_this._participants = new Map();
|
|
4839
|
-
_this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants,
|
|
5095
|
+
_this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants, // state leak
|
|
5096
|
+
participantsLinks, _this._services);
|
|
4840
5097
|
|
|
4841
|
-
_this._participantsEntity.on(
|
|
4842
|
-
return
|
|
5098
|
+
_this._participantsEntity.on(Conversation.participantJoined, function (participant) {
|
|
5099
|
+
return (// @todo update participants map here??
|
|
5100
|
+
_this.emit(Conversation.participantJoined, participant)
|
|
5101
|
+
);
|
|
4843
5102
|
});
|
|
4844
5103
|
|
|
4845
|
-
_this._participantsEntity.on(
|
|
4846
|
-
return
|
|
5104
|
+
_this._participantsEntity.on(Conversation.participantLeft, function (participant) {
|
|
5105
|
+
return (// @todo update participants map here??
|
|
5106
|
+
_this.emit(Conversation.participantLeft, participant)
|
|
5107
|
+
);
|
|
4847
5108
|
});
|
|
4848
5109
|
|
|
4849
|
-
_this._participantsEntity.on(
|
|
4850
|
-
return
|
|
5110
|
+
_this._participantsEntity.on(Conversation.participantUpdated, function (args) {
|
|
5111
|
+
return (// @todo update participants map here??
|
|
5112
|
+
_this.emit(Conversation.participantUpdated, args)
|
|
5113
|
+
);
|
|
4851
5114
|
});
|
|
4852
5115
|
|
|
4853
5116
|
_this._messagesEntity = new Messages(_assertThisInitialized__default["default"](_this), configuration, services);
|
|
4854
5117
|
|
|
4855
|
-
_this._messagesEntity.on(
|
|
5118
|
+
_this._messagesEntity.on(Conversation.messageAdded, function (message) {
|
|
4856
5119
|
return _this._onMessageAdded(message);
|
|
4857
5120
|
});
|
|
4858
5121
|
|
|
4859
|
-
_this._messagesEntity.on(
|
|
4860
|
-
return _this.emit(
|
|
5122
|
+
_this._messagesEntity.on(Conversation.messageUpdated, function (args) {
|
|
5123
|
+
return _this.emit(Conversation.messageUpdated, args);
|
|
4861
5124
|
});
|
|
4862
5125
|
|
|
4863
|
-
_this._messagesEntity.on(
|
|
4864
|
-
return _this.emit(
|
|
5126
|
+
_this._messagesEntity.on(Conversation.messageRemoved, function (message) {
|
|
5127
|
+
return _this.emit(Conversation.messageRemoved, message);
|
|
4865
5128
|
});
|
|
4866
5129
|
|
|
4867
5130
|
return _this;
|
|
@@ -4964,7 +5227,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4964
5227
|
return (_this$_internalState$3 = this._internalState.notificationLevel) !== null && _this$_internalState$3 !== void 0 ? _this$_internalState$3 : "default";
|
|
4965
5228
|
}
|
|
4966
5229
|
/**
|
|
4967
|
-
* Conversation bindings.
|
|
5230
|
+
* Conversation bindings. An undocumented feature (for now).
|
|
4968
5231
|
* @internal
|
|
4969
5232
|
*/
|
|
4970
5233
|
|
|
@@ -5944,74 +6207,107 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
5944
6207
|
|
|
5945
6208
|
return updateUniqueName;
|
|
5946
6209
|
}()
|
|
6210
|
+
/**
|
|
6211
|
+
* Get recipients of all messages in the conversation.
|
|
6212
|
+
* @param options Optional configuration, set pageSize to request a specific pagination page size. Page size specifies a number of messages to include in a single batch. Each message may include multiple recipients.
|
|
6213
|
+
*/
|
|
6214
|
+
|
|
6215
|
+
}, {
|
|
6216
|
+
key: "getMessageRecipients",
|
|
6217
|
+
value: function () {
|
|
6218
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24(options) {
|
|
6219
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
|
|
6220
|
+
while (1) {
|
|
6221
|
+
switch (_context24.prev = _context24.next) {
|
|
6222
|
+
case 0:
|
|
6223
|
+
_context24.next = 2;
|
|
6224
|
+
return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid, options);
|
|
6225
|
+
|
|
6226
|
+
case 2:
|
|
6227
|
+
return _context24.abrupt("return", _context24.sent);
|
|
6228
|
+
|
|
6229
|
+
case 3:
|
|
6230
|
+
case "end":
|
|
6231
|
+
return _context24.stop();
|
|
6232
|
+
}
|
|
6233
|
+
}
|
|
6234
|
+
}, _callee24, this);
|
|
6235
|
+
}));
|
|
6236
|
+
|
|
6237
|
+
function getMessageRecipients(_x19) {
|
|
6238
|
+
return _getMessageRecipients.apply(this, arguments);
|
|
6239
|
+
}
|
|
6240
|
+
|
|
6241
|
+
return getMessageRecipients;
|
|
6242
|
+
}()
|
|
5947
6243
|
/**
|
|
5948
6244
|
* Load and subscribe to this conversation and do not subscribe to its
|
|
5949
6245
|
* participants and messages. This or _subscribeStreams will need to be called
|
|
5950
|
-
* before any events
|
|
6246
|
+
* before any events in the conversation will fire.
|
|
5951
6247
|
* @internal
|
|
5952
6248
|
*/
|
|
5953
6249
|
|
|
5954
6250
|
}, {
|
|
5955
6251
|
key: "_subscribe",
|
|
5956
6252
|
value: function () {
|
|
5957
|
-
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6253
|
+
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee25() {
|
|
5958
6254
|
var _this2 = this;
|
|
5959
6255
|
|
|
5960
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6256
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
|
|
5961
6257
|
while (1) {
|
|
5962
|
-
switch (
|
|
6258
|
+
switch (_context25.prev = _context25.next) {
|
|
5963
6259
|
case 0:
|
|
5964
6260
|
if (!this._entityPromise) {
|
|
5965
|
-
|
|
6261
|
+
_context25.next = 2;
|
|
5966
6262
|
break;
|
|
5967
6263
|
}
|
|
5968
6264
|
|
|
5969
|
-
return
|
|
6265
|
+
return _context25.abrupt("return", this._entityPromise);
|
|
5970
6266
|
|
|
5971
6267
|
case 2:
|
|
5972
6268
|
this._entityPromise = this._services.syncClient.document({
|
|
5973
6269
|
id: this._entityName,
|
|
5974
6270
|
mode: "open_existing"
|
|
5975
6271
|
});
|
|
5976
|
-
|
|
5977
|
-
|
|
6272
|
+
_context25.prev = 3;
|
|
6273
|
+
_context25.next = 6;
|
|
5978
6274
|
return this._entityPromise;
|
|
5979
6275
|
|
|
5980
6276
|
case 6:
|
|
5981
|
-
this._entity =
|
|
6277
|
+
this._entity = _context25.sent;
|
|
5982
6278
|
|
|
5983
|
-
this._entity.on(
|
|
6279
|
+
this._entity.on(twilioSync.SyncDocument.updated, function (args) {
|
|
5984
6280
|
return _this2._update(args.data);
|
|
5985
6281
|
});
|
|
5986
6282
|
|
|
5987
|
-
this._entity.on(
|
|
5988
|
-
return _this2.emit(
|
|
6283
|
+
this._entity.on(twilioSync.SyncDocument.removed, function () {
|
|
6284
|
+
return _this2.emit(Conversation.removed, _this2);
|
|
5989
6285
|
});
|
|
5990
6286
|
|
|
5991
6287
|
this._update(this._entity.data);
|
|
5992
6288
|
|
|
5993
|
-
return
|
|
6289
|
+
return _context25.abrupt("return", this._entity);
|
|
5994
6290
|
|
|
5995
6291
|
case 13:
|
|
5996
|
-
|
|
5997
|
-
|
|
6292
|
+
_context25.prev = 13;
|
|
6293
|
+
_context25.t0 = _context25["catch"](3);
|
|
5998
6294
|
this._entity = null;
|
|
5999
6295
|
this._entityPromise = null;
|
|
6000
6296
|
|
|
6001
6297
|
if (this._services.syncClient.connectionState != "disconnected") {
|
|
6002
|
-
Conversation._logger.error("Failed to get conversation object",
|
|
6298
|
+
Conversation._logger.error("Failed to get conversation object", _context25.t0);
|
|
6003
6299
|
}
|
|
6004
6300
|
|
|
6005
|
-
Conversation._logger.debug("ERROR: Failed to get conversation object",
|
|
6301
|
+
Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
|
|
6006
6302
|
|
|
6007
|
-
throw
|
|
6303
|
+
throw _context25.t0;
|
|
6008
6304
|
|
|
6009
6305
|
case 20:
|
|
6010
6306
|
case "end":
|
|
6011
|
-
return
|
|
6307
|
+
return _context25.stop();
|
|
6012
6308
|
}
|
|
6013
6309
|
}
|
|
6014
|
-
},
|
|
6310
|
+
}, _callee25, this, [[3, 13]]);
|
|
6015
6311
|
}));
|
|
6016
6312
|
|
|
6017
6313
|
function _subscribe() {
|
|
@@ -6033,44 +6329,95 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6033
6329
|
}, {
|
|
6034
6330
|
key: "_fetchStreams",
|
|
6035
6331
|
value: function () {
|
|
6036
|
-
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6037
|
-
var
|
|
6332
|
+
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
|
|
6333
|
+
var _this3 = this;
|
|
6038
6334
|
|
|
6039
|
-
|
|
6040
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
|
|
6335
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
|
|
6041
6336
|
while (1) {
|
|
6042
|
-
switch (
|
|
6337
|
+
switch (_context27.prev = _context27.next) {
|
|
6043
6338
|
case 0:
|
|
6044
|
-
|
|
6045
|
-
|
|
6339
|
+
if (!this._streamsPromise) {
|
|
6340
|
+
_context27.next = 2;
|
|
6341
|
+
break;
|
|
6342
|
+
}
|
|
6046
6343
|
|
|
6047
|
-
|
|
6048
|
-
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
|
6344
|
+
return _context27.abrupt("return", this._streamsPromise);
|
|
6049
6345
|
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6346
|
+
case 2:
|
|
6347
|
+
this._streamsPromise = new Promise( /*#__PURE__*/function () {
|
|
6348
|
+
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26(resolve, reject) {
|
|
6349
|
+
var _this3$_entity, _this3$_entity2;
|
|
6350
|
+
|
|
6351
|
+
var data, messagesPromise, participantsPromise;
|
|
6352
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
|
|
6353
|
+
while (1) {
|
|
6354
|
+
switch (_context26.prev = _context26.next) {
|
|
6355
|
+
case 0:
|
|
6356
|
+
_context26.prev = 0;
|
|
6357
|
+
_context26.next = 3;
|
|
6358
|
+
return _this3._subscribe();
|
|
6359
|
+
|
|
6360
|
+
case 3:
|
|
6361
|
+
_context26.next = 9;
|
|
6362
|
+
break;
|
|
6056
6363
|
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6364
|
+
case 5:
|
|
6365
|
+
_context26.prev = 5;
|
|
6366
|
+
_context26.t0 = _context26["catch"](0);
|
|
6367
|
+
|
|
6368
|
+
Conversation._logger.trace("Failed to subscribe to conversation", _context26.t0);
|
|
6369
|
+
|
|
6370
|
+
return _context26.abrupt("return", reject(_context26.t0));
|
|
6371
|
+
|
|
6372
|
+
case 9:
|
|
6373
|
+
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this3$_entity = _this3._entity) === null || _this3$_entity === void 0 ? void 0 : _this3$_entity.data);
|
|
6374
|
+
|
|
6375
|
+
data = (_this3$_entity2 = _this3._entity) === null || _this3$_entity2 === void 0 ? void 0 : _this3$_entity2.data;
|
|
6376
|
+
messagesPromise = _this3._services.syncClient.list({
|
|
6377
|
+
id: data.messages,
|
|
6378
|
+
mode: "open_existing"
|
|
6379
|
+
}).then(function (list) {
|
|
6380
|
+
_this3._messagesList = list;
|
|
6381
|
+
return list;
|
|
6382
|
+
});
|
|
6383
|
+
participantsPromise = _this3._services.syncClient.map({
|
|
6384
|
+
id: data.roster,
|
|
6385
|
+
mode: "open_existing"
|
|
6386
|
+
}).then(function (map) {
|
|
6387
|
+
_this3._participantsMap = map;
|
|
6388
|
+
return map;
|
|
6389
|
+
});
|
|
6390
|
+
Promise.all([messagesPromise, participantsPromise]).then(function () {
|
|
6391
|
+
return resolve(true);
|
|
6392
|
+
}).catch(function (err) {
|
|
6393
|
+
Conversation._logger.trace("Failed to fetch conversation streams for conversation", _this3.sid, err);
|
|
6394
|
+
|
|
6395
|
+
reject(err);
|
|
6396
|
+
});
|
|
6397
|
+
|
|
6398
|
+
case 14:
|
|
6399
|
+
case "end":
|
|
6400
|
+
return _context26.stop();
|
|
6401
|
+
}
|
|
6402
|
+
}
|
|
6403
|
+
}, _callee26, null, [[0, 5]]);
|
|
6404
|
+
}));
|
|
6064
6405
|
|
|
6065
|
-
|
|
6066
|
-
|
|
6406
|
+
return function (_x20, _x21) {
|
|
6407
|
+
return _ref.apply(this, arguments);
|
|
6408
|
+
};
|
|
6409
|
+
}());
|
|
6410
|
+
return _context27.abrupt("return", this._streamsPromise.catch(function (err) {
|
|
6411
|
+
_this3._streamsPromise = null;
|
|
6412
|
+
throw err;
|
|
6413
|
+
}));
|
|
6067
6414
|
|
|
6068
|
-
case
|
|
6415
|
+
case 4:
|
|
6069
6416
|
case "end":
|
|
6070
|
-
return
|
|
6417
|
+
return _context27.stop();
|
|
6071
6418
|
}
|
|
6072
6419
|
}
|
|
6073
|
-
},
|
|
6420
|
+
}, _callee27, this);
|
|
6074
6421
|
}));
|
|
6075
6422
|
|
|
6076
6423
|
function _fetchStreams() {
|
|
@@ -6090,48 +6437,48 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6090
6437
|
}, {
|
|
6091
6438
|
key: "_subscribeStreams",
|
|
6092
6439
|
value: function () {
|
|
6093
|
-
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6094
|
-
var _this$
|
|
6440
|
+
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
|
|
6441
|
+
var _this$_entity, _this$_entity2, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
|
|
6095
6442
|
|
|
6096
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6443
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
|
|
6097
6444
|
while (1) {
|
|
6098
|
-
switch (
|
|
6445
|
+
switch (_context28.prev = _context28.next) {
|
|
6099
6446
|
case 0:
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
return this.
|
|
6447
|
+
_context28.prev = 0;
|
|
6448
|
+
_context28.next = 3;
|
|
6449
|
+
return this._fetchStreams();
|
|
6103
6450
|
|
|
6104
6451
|
case 3:
|
|
6105
|
-
Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$
|
|
6452
|
+
Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
|
6106
6453
|
|
|
6107
|
-
data = (_this$
|
|
6454
|
+
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
|
6108
6455
|
messagesObjectName = data.messages;
|
|
6109
6456
|
rosterObjectName = data.roster;
|
|
6110
|
-
|
|
6457
|
+
_context28.next = 9;
|
|
6111
6458
|
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
6459
|
|
|
6113
6460
|
case 9:
|
|
6114
|
-
|
|
6461
|
+
_context28.next = 16;
|
|
6115
6462
|
break;
|
|
6116
6463
|
|
|
6117
6464
|
case 11:
|
|
6118
|
-
|
|
6119
|
-
|
|
6465
|
+
_context28.prev = 11;
|
|
6466
|
+
_context28.t0 = _context28["catch"](0);
|
|
6120
6467
|
|
|
6121
6468
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
|
6122
|
-
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid,
|
|
6469
|
+
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context28.t0);
|
|
6123
6470
|
}
|
|
6124
6471
|
|
|
6125
|
-
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid,
|
|
6472
|
+
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context28.t0);
|
|
6126
6473
|
|
|
6127
|
-
throw
|
|
6474
|
+
throw _context28.t0;
|
|
6128
6475
|
|
|
6129
6476
|
case 16:
|
|
6130
6477
|
case "end":
|
|
6131
|
-
return
|
|
6478
|
+
return _context28.stop();
|
|
6132
6479
|
}
|
|
6133
6480
|
}
|
|
6134
|
-
},
|
|
6481
|
+
}, _callee28, this, [[0, 11]]);
|
|
6135
6482
|
}));
|
|
6136
6483
|
|
|
6137
6484
|
function _subscribeStreams() {
|
|
@@ -6148,32 +6495,26 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6148
6495
|
}, {
|
|
6149
6496
|
key: "_unsubscribe",
|
|
6150
6497
|
value: function () {
|
|
6151
|
-
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6152
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6498
|
+
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29() {
|
|
6499
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
|
|
6153
6500
|
while (1) {
|
|
6154
|
-
switch (
|
|
6501
|
+
switch (_context29.prev = _context29.next) {
|
|
6155
6502
|
case 0:
|
|
6156
|
-
if (
|
|
6157
|
-
|
|
6158
|
-
break;
|
|
6159
|
-
}
|
|
6503
|
+
if (this._entity) {
|
|
6504
|
+
this._entity.close();
|
|
6160
6505
|
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
case 3:
|
|
6165
|
-
this._entity = null;
|
|
6166
|
-
this._entityPromise = null;
|
|
6506
|
+
this._entity = null;
|
|
6507
|
+
this._entityPromise = null;
|
|
6508
|
+
}
|
|
6167
6509
|
|
|
6168
|
-
|
|
6169
|
-
return _context27.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
|
6510
|
+
return _context29.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
|
6170
6511
|
|
|
6171
|
-
case
|
|
6512
|
+
case 2:
|
|
6172
6513
|
case "end":
|
|
6173
|
-
return
|
|
6514
|
+
return _context29.stop();
|
|
6174
6515
|
}
|
|
6175
6516
|
}
|
|
6176
|
-
},
|
|
6517
|
+
}, _callee29, this);
|
|
6177
6518
|
}));
|
|
6178
6519
|
|
|
6179
6520
|
function _unsubscribe() {
|
|
@@ -6190,7 +6531,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6190
6531
|
}, {
|
|
6191
6532
|
key: "_setStatus",
|
|
6192
6533
|
value: function _setStatus(status, source) {
|
|
6193
|
-
var
|
|
6534
|
+
var _this4 = this;
|
|
6194
6535
|
|
|
6195
6536
|
this._dataSource = source;
|
|
6196
6537
|
|
|
@@ -6204,7 +6545,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6204
6545
|
this._subscribeStreams().catch(function (err) {
|
|
6205
6546
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6206
6547
|
|
|
6207
|
-
if (
|
|
6548
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6208
6549
|
throw err;
|
|
6209
6550
|
}
|
|
6210
6551
|
});
|
|
@@ -6216,7 +6557,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6216
6557
|
this._unsubscribe().catch(function (err) {
|
|
6217
6558
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6218
6559
|
|
|
6219
|
-
if (
|
|
6560
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6220
6561
|
throw err;
|
|
6221
6562
|
}
|
|
6222
6563
|
});
|
|
@@ -6256,7 +6597,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6256
6597
|
break;
|
|
6257
6598
|
|
|
6258
6599
|
case fieldMappings.attributes:
|
|
6259
|
-
if (
|
|
6600
|
+
if (isEqual(this._internalState.attributes, update.attributes)) {
|
|
6260
6601
|
break;
|
|
6261
6602
|
}
|
|
6262
6603
|
|
|
@@ -6292,7 +6633,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6292
6633
|
updateReasons.add(localKey);
|
|
6293
6634
|
}
|
|
6294
6635
|
|
|
6295
|
-
if (
|
|
6636
|
+
if (isEqual(this._internalState.lastMessage, {})) {
|
|
6296
6637
|
delete this._internalState.lastMessage;
|
|
6297
6638
|
}
|
|
6298
6639
|
|
|
@@ -6305,7 +6646,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6305
6646
|
state.dateUpdated = new Date(state.dateUpdated);
|
|
6306
6647
|
}
|
|
6307
6648
|
|
|
6308
|
-
if (
|
|
6649
|
+
if (isEqual(this._internalState.state, state)) {
|
|
6309
6650
|
break;
|
|
6310
6651
|
}
|
|
6311
6652
|
|
|
@@ -6314,7 +6655,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6314
6655
|
break;
|
|
6315
6656
|
|
|
6316
6657
|
case fieldMappings.bindings:
|
|
6317
|
-
if (
|
|
6658
|
+
if (isEqual(this._internalState.bindings, update.bindings)) {
|
|
6318
6659
|
break;
|
|
6319
6660
|
}
|
|
6320
6661
|
|
|
@@ -6337,7 +6678,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6337
6678
|
}
|
|
6338
6679
|
|
|
6339
6680
|
if (updateReasons.size > 0) {
|
|
6340
|
-
this.emit(
|
|
6681
|
+
this.emit(Conversation.updated, {
|
|
6341
6682
|
conversation: this,
|
|
6342
6683
|
updateReasons: _toConsumableArray__default["default"](updateReasons)
|
|
6343
6684
|
});
|
|
@@ -6350,7 +6691,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6350
6691
|
}, {
|
|
6351
6692
|
key: "_onMessageAdded",
|
|
6352
6693
|
value: function _onMessageAdded(message) {
|
|
6353
|
-
var _iterator = _createForOfIteratorHelper$
|
|
6694
|
+
var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
|
|
6354
6695
|
_step;
|
|
6355
6696
|
|
|
6356
6697
|
try {
|
|
@@ -6369,7 +6710,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6369
6710
|
_iterator.f();
|
|
6370
6711
|
}
|
|
6371
6712
|
|
|
6372
|
-
this.emit(
|
|
6713
|
+
this.emit(Conversation.messageAdded, message);
|
|
6373
6714
|
}
|
|
6374
6715
|
/**
|
|
6375
6716
|
* Set last read message index.
|
|
@@ -6379,30 +6720,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6379
6720
|
}, {
|
|
6380
6721
|
key: "_setLastReadMessageIndex",
|
|
6381
6722
|
value: function () {
|
|
6382
|
-
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6723
|
+
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee30(index) {
|
|
6383
6724
|
var result;
|
|
6384
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6725
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee30$(_context30) {
|
|
6385
6726
|
while (1) {
|
|
6386
|
-
switch (
|
|
6727
|
+
switch (_context30.prev = _context30.next) {
|
|
6387
6728
|
case 0:
|
|
6388
|
-
|
|
6729
|
+
_context30.next = 2;
|
|
6389
6730
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
|
6390
6731
|
last_read_message_index: index
|
|
6391
6732
|
});
|
|
6392
6733
|
|
|
6393
6734
|
case 2:
|
|
6394
|
-
result =
|
|
6395
|
-
return
|
|
6735
|
+
result = _context30.sent;
|
|
6736
|
+
return _context30.abrupt("return", result.unread_messages_count);
|
|
6396
6737
|
|
|
6397
6738
|
case 4:
|
|
6398
6739
|
case "end":
|
|
6399
|
-
return
|
|
6740
|
+
return _context30.stop();
|
|
6400
6741
|
}
|
|
6401
6742
|
}
|
|
6402
|
-
},
|
|
6743
|
+
}, _callee30, this);
|
|
6403
6744
|
}));
|
|
6404
6745
|
|
|
6405
|
-
function _setLastReadMessageIndex(
|
|
6746
|
+
function _setLastReadMessageIndex(_x22) {
|
|
6406
6747
|
return _setLastReadMessageIndex2.apply(this, arguments);
|
|
6407
6748
|
}
|
|
6408
6749
|
|
|
@@ -6482,7 +6823,7 @@ _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conve
|
|
|
6482
6823
|
|
|
6483
6824
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
|
|
6484
6825
|
|
|
6485
|
-
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
|
|
6826
|
+
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
|
|
6486
6827
|
|
|
6487
6828
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
|
|
6488
6829
|
|
|
@@ -6558,11 +6899,11 @@ var Deferred = /*#__PURE__*/function () {
|
|
|
6558
6899
|
return Deferred;
|
|
6559
6900
|
}();
|
|
6560
6901
|
|
|
6561
|
-
function _createForOfIteratorHelper$
|
|
6902
|
+
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
6903
|
|
|
6563
|
-
function _unsupportedIterableToArray$
|
|
6904
|
+
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
6905
|
|
|
6565
|
-
function _arrayLikeToArray$
|
|
6906
|
+
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
6907
|
|
|
6567
6908
|
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
6909
|
|
|
@@ -6618,6 +6959,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6618
6959
|
return this.services.commandExecutor.mutateResource("post", this.configuration.links.conversations, {
|
|
6619
6960
|
friendly_name: options.friendlyName,
|
|
6620
6961
|
unique_name: options.uniqueName,
|
|
6962
|
+
access: options.access,
|
|
6621
6963
|
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
|
|
6622
6964
|
});
|
|
6623
6965
|
|
|
@@ -6679,7 +7021,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6679
7021
|
return addConversation;
|
|
6680
7022
|
}()
|
|
6681
7023
|
/**
|
|
6682
|
-
* Fetch conversations list and instantiate all necessary objects
|
|
7024
|
+
* Fetch conversations' list and instantiate all necessary objects
|
|
6683
7025
|
*/
|
|
6684
7026
|
|
|
6685
7027
|
}, {
|
|
@@ -6700,12 +7042,12 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6700
7042
|
|
|
6701
7043
|
case 3:
|
|
6702
7044
|
map = _context2.sent;
|
|
6703
|
-
map.on(
|
|
7045
|
+
map.on(twilioSync.SyncMap.itemAdded, function (args) {
|
|
6704
7046
|
log$1.debug("itemAdded: ".concat(args.item.key));
|
|
6705
7047
|
|
|
6706
7048
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
|
6707
7049
|
});
|
|
6708
|
-
map.on(
|
|
7050
|
+
map.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
|
6709
7051
|
log$1.debug("itemRemoved: ".concat(args.key));
|
|
6710
7052
|
var sid = args.key;
|
|
6711
7053
|
|
|
@@ -6731,7 +7073,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6731
7073
|
|
|
6732
7074
|
conversation.emit("removed", conversation);
|
|
6733
7075
|
});
|
|
6734
|
-
map.on(
|
|
7076
|
+
map.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
|
6735
7077
|
log$1.debug("itemUpdated: ".concat(args.item.key));
|
|
6736
7078
|
|
|
6737
7079
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
|
@@ -6742,7 +7084,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6742
7084
|
case 9:
|
|
6743
7085
|
myConversations = _context2.sent;
|
|
6744
7086
|
upserts = [];
|
|
6745
|
-
_iterator = _createForOfIteratorHelper$
|
|
7087
|
+
_iterator = _createForOfIteratorHelper$2(myConversations);
|
|
6746
7088
|
|
|
6747
7089
|
try {
|
|
6748
7090
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
@@ -6902,6 +7244,8 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6902
7244
|
createdBy: body.created_by,
|
|
6903
7245
|
attributes: body.attributes,
|
|
6904
7246
|
channel: body.sync_objects.conversation,
|
|
7247
|
+
roster: body.sync_objects.participants,
|
|
7248
|
+
messages: body.sync_objects.messages,
|
|
6905
7249
|
notificationLevel: body === null || body === void 0 ? void 0 : body.notification_level,
|
|
6906
7250
|
sid: sid
|
|
6907
7251
|
};
|
|
@@ -6947,8 +7291,10 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6947
7291
|
uniqueName: body.unique_name,
|
|
6948
7292
|
createdBy: body.created_by,
|
|
6949
7293
|
attributes: body.attributes,
|
|
6950
|
-
channel: "".concat(sid, ".channel"),
|
|
6951
|
-
|
|
7294
|
+
channel: body.sync_objects.conversation || "".concat(sid, ".channel"),
|
|
7295
|
+
roster: body.sync_objects.participants,
|
|
7296
|
+
messages: body.sync_objects.messages,
|
|
7297
|
+
notificationLevel: body === null || body === void 0 ? void 0 : body.notification_level,
|
|
6952
7298
|
sid: sid
|
|
6953
7299
|
};
|
|
6954
7300
|
return _context6.abrupt("return", this._upsertConversation("sync", sid, data));
|
|
@@ -7088,7 +7434,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
7088
7434
|
updateData.lastConsumedMessageIndex = data.lastConsumedMessageIndex;
|
|
7089
7435
|
}
|
|
7090
7436
|
|
|
7091
|
-
if (!
|
|
7437
|
+
if (!isEqual(updateData, {})) {
|
|
7092
7438
|
conversation._update(updateData);
|
|
7093
7439
|
}
|
|
7094
7440
|
|
|
@@ -7285,7 +7631,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
7285
7631
|
status: conversationDescriptor.status,
|
|
7286
7632
|
channel: conversationDescriptor.sync_objects.conversation,
|
|
7287
7633
|
messages: conversationDescriptor.sync_objects.messages,
|
|
7288
|
-
roster: "".concat(conversationDescriptor.conversation_sid, ".roster"),
|
|
7634
|
+
roster: conversationDescriptor.sync_objects.participants || "".concat(conversationDescriptor.conversation_sid, ".roster"),
|
|
7289
7635
|
lastConsumedMessageIndex: conversationDescriptor.last_read_message_index,
|
|
7290
7636
|
notificationLevel: conversationDescriptor.notification_level
|
|
7291
7637
|
};
|
|
@@ -7708,7 +8054,7 @@ var TypingIndicator = /*#__PURE__*/function () {
|
|
|
7708
8054
|
}
|
|
7709
8055
|
|
|
7710
8056
|
conversation._participants.forEach(function (participant) {
|
|
7711
|
-
if (participant.identity !== message.identity) {
|
|
8057
|
+
if (participant.identity !== message.identity && participant.type !== "apple") {
|
|
7712
8058
|
return;
|
|
7713
8059
|
}
|
|
7714
8060
|
|
|
@@ -7824,7 +8170,15 @@ function PushNotification(data) {
|
|
|
7824
8170
|
this.data = data.data || {};
|
|
7825
8171
|
});
|
|
7826
8172
|
|
|
7827
|
-
var version = "3.0.1
|
|
8173
|
+
var version = "3.0.1";
|
|
8174
|
+
|
|
8175
|
+
/**
|
|
8176
|
+
* Generate a random UUID using the Web Crypto API.
|
|
8177
|
+
* Available in Node.js 14.17+, modern browsers, and React Native.
|
|
8178
|
+
*/
|
|
8179
|
+
var randomUUID = function randomUUID() {
|
|
8180
|
+
return crypto.randomUUID();
|
|
8181
|
+
};
|
|
7828
8182
|
|
|
7829
8183
|
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
8184
|
|
|
@@ -7833,6 +8187,7 @@ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
7833
8187
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); 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); }; }
|
|
7834
8188
|
|
|
7835
8189
|
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
8190
|
+
var uuidv4 = randomUUID;
|
|
7836
8191
|
|
|
7837
8192
|
var trimSlashes = function trimSlashes(url) {
|
|
7838
8193
|
return url.replace(/(^\/+|\/+$)/g, "");
|
|
@@ -8057,7 +8412,7 @@ var CommandExecutor = /*#__PURE__*/function () {
|
|
|
8057
8412
|
case 0:
|
|
8058
8413
|
_context4.next = 2;
|
|
8059
8414
|
return this._makeRequest(method, url, requestBody, {
|
|
8060
|
-
"X-Twilio-Mutation-Id":
|
|
8415
|
+
"X-Twilio-Mutation-Id": uuidv4()
|
|
8061
8416
|
});
|
|
8062
8417
|
|
|
8063
8418
|
case 2:
|
|
@@ -8225,11 +8580,11 @@ var ContentClient = /*#__PURE__*/function () {
|
|
|
8225
8580
|
return ContentClient;
|
|
8226
8581
|
}();
|
|
8227
8582
|
|
|
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; } } }; }
|
|
8583
|
+
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
8584
|
|
|
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); }
|
|
8585
|
+
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
8586
|
|
|
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; }
|
|
8587
|
+
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
8588
|
|
|
8234
8589
|
var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8235
8590
|
function QuickLRU() {
|
|
@@ -8258,7 +8613,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8258
8613
|
this._size = 0;
|
|
8259
8614
|
|
|
8260
8615
|
if (typeof this.onEviction === 'function') {
|
|
8261
|
-
var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
|
|
8616
|
+
var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
|
|
8262
8617
|
_step;
|
|
8263
8618
|
|
|
8264
8619
|
try {
|
|
@@ -8350,7 +8705,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8350
8705
|
while (1) {
|
|
8351
8706
|
switch (_context.prev = _context.next) {
|
|
8352
8707
|
case 0:
|
|
8353
|
-
_iterator2 = _createForOfIteratorHelper(this);
|
|
8708
|
+
_iterator2 = _createForOfIteratorHelper$1(this);
|
|
8354
8709
|
_context.prev = 1;
|
|
8355
8710
|
|
|
8356
8711
|
_iterator2.s();
|
|
@@ -8402,7 +8757,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8402
8757
|
while (1) {
|
|
8403
8758
|
switch (_context2.prev = _context2.next) {
|
|
8404
8759
|
case 0:
|
|
8405
|
-
_iterator3 = _createForOfIteratorHelper(this);
|
|
8760
|
+
_iterator3 = _createForOfIteratorHelper$1(this);
|
|
8406
8761
|
_context2.prev = 1;
|
|
8407
8762
|
|
|
8408
8763
|
_iterator3.s();
|
|
@@ -8454,7 +8809,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8454
8809
|
while (1) {
|
|
8455
8810
|
switch (_context3.prev = _context3.next) {
|
|
8456
8811
|
case 0:
|
|
8457
|
-
_iterator4 = _createForOfIteratorHelper(this.cache);
|
|
8812
|
+
_iterator4 = _createForOfIteratorHelper$1(this.cache);
|
|
8458
8813
|
_context3.prev = 1;
|
|
8459
8814
|
|
|
8460
8815
|
_iterator4.s();
|
|
@@ -8491,7 +8846,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8491
8846
|
return _context3.finish(14);
|
|
8492
8847
|
|
|
8493
8848
|
case 17:
|
|
8494
|
-
_iterator5 = _createForOfIteratorHelper(this.oldCache);
|
|
8849
|
+
_iterator5 = _createForOfIteratorHelper$1(this.oldCache);
|
|
8495
8850
|
_context3.prev = 18;
|
|
8496
8851
|
|
|
8497
8852
|
_iterator5.s();
|
|
@@ -8546,7 +8901,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8546
8901
|
get: function get() {
|
|
8547
8902
|
var oldCacheSize = 0;
|
|
8548
8903
|
|
|
8549
|
-
var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
|
|
8904
|
+
var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
|
|
8550
8905
|
_step6;
|
|
8551
8906
|
|
|
8552
8907
|
try {
|
|
@@ -8683,6 +9038,222 @@ var ChannelMetadataClient = /*#__PURE__*/function () {
|
|
|
8683
9038
|
return ChannelMetadataClient;
|
|
8684
9039
|
}();
|
|
8685
9040
|
|
|
9041
|
+
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; } } }; }
|
|
9042
|
+
|
|
9043
|
+
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); }
|
|
9044
|
+
|
|
9045
|
+
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; }
|
|
9046
|
+
/**
|
|
9047
|
+
* Email recipient descriptor.
|
|
9048
|
+
*/
|
|
9049
|
+
|
|
9050
|
+
var EmailRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
|
9051
|
+
/**
|
|
9052
|
+
* Type of recipient.
|
|
9053
|
+
*/
|
|
9054
|
+
|
|
9055
|
+
/**
|
|
9056
|
+
* Sid of the message that this recipient belongs to.
|
|
9057
|
+
*/
|
|
9058
|
+
|
|
9059
|
+
/**
|
|
9060
|
+
* Email recipient level.
|
|
9061
|
+
*/
|
|
9062
|
+
|
|
9063
|
+
/**
|
|
9064
|
+
* Name of the recipient.
|
|
9065
|
+
*/
|
|
9066
|
+
|
|
9067
|
+
/**
|
|
9068
|
+
* Address of the recipient.
|
|
9069
|
+
*/
|
|
9070
|
+
|
|
9071
|
+
/**
|
|
9072
|
+
* @internal
|
|
9073
|
+
*/
|
|
9074
|
+
function EmailRecipientDescriptor(recipient) {
|
|
9075
|
+
_classCallCheck__default["default"](this, EmailRecipientDescriptor);
|
|
9076
|
+
|
|
9077
|
+
_defineProperty__default["default"](this, "type", "email");
|
|
9078
|
+
|
|
9079
|
+
this.messageSid = recipient.message_sid;
|
|
9080
|
+
this.level = recipient.level;
|
|
9081
|
+
this.name = recipient.name;
|
|
9082
|
+
this.address = recipient.address;
|
|
9083
|
+
});
|
|
9084
|
+
/**
|
|
9085
|
+
* Unknown recipient descriptor. Used to be able to handle recipient types that
|
|
9086
|
+
* are not supported by the current version of the SDK.
|
|
9087
|
+
*/
|
|
9088
|
+
|
|
9089
|
+
|
|
9090
|
+
var UnknownRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
|
9091
|
+
/**
|
|
9092
|
+
* Type of recipient.
|
|
9093
|
+
*/
|
|
9094
|
+
|
|
9095
|
+
/**
|
|
9096
|
+
* Sid of the message that this recipient belongs to.
|
|
9097
|
+
*/
|
|
9098
|
+
|
|
9099
|
+
/**
|
|
9100
|
+
* Recipient data as a JSON string.
|
|
9101
|
+
*/
|
|
9102
|
+
|
|
9103
|
+
/**
|
|
9104
|
+
* @internal
|
|
9105
|
+
*/
|
|
9106
|
+
function UnknownRecipientDescriptor(recipient) {
|
|
9107
|
+
_classCallCheck__default["default"](this, UnknownRecipientDescriptor);
|
|
9108
|
+
|
|
9109
|
+
this.type = recipient.type;
|
|
9110
|
+
this.messageSid = recipient.message_sid;
|
|
9111
|
+
this.rawData = JSON.stringify(recipient);
|
|
9112
|
+
});
|
|
9113
|
+
|
|
9114
|
+
var MessageRecipientsClient = /*#__PURE__*/function () {
|
|
9115
|
+
function MessageRecipientsClient(services, configuration) {
|
|
9116
|
+
_classCallCheck__default["default"](this, MessageRecipientsClient);
|
|
9117
|
+
|
|
9118
|
+
this._services = services;
|
|
9119
|
+
this._configuration = configuration;
|
|
9120
|
+
this._cache = new quickLru({
|
|
9121
|
+
maxSize: configuration.messageRecipientsCacheCapacity
|
|
9122
|
+
});
|
|
9123
|
+
}
|
|
9124
|
+
|
|
9125
|
+
_createClass__default["default"](MessageRecipientsClient, [{
|
|
9126
|
+
key: "getRecipientsFromMessage",
|
|
9127
|
+
value: function () {
|
|
9128
|
+
var _getRecipientsFromMessage = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(conversationSid, messageSid) {
|
|
9129
|
+
var _this = this;
|
|
9130
|
+
|
|
9131
|
+
var key, cachedItem, url, recipientsResponse, recipients;
|
|
9132
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
9133
|
+
while (1) {
|
|
9134
|
+
switch (_context.prev = _context.next) {
|
|
9135
|
+
case 0:
|
|
9136
|
+
key = "".concat(conversationSid, ",").concat(messageSid);
|
|
9137
|
+
cachedItem = this._cache.get(key);
|
|
9138
|
+
|
|
9139
|
+
if (!cachedItem) {
|
|
9140
|
+
_context.next = 4;
|
|
9141
|
+
break;
|
|
9142
|
+
}
|
|
9143
|
+
|
|
9144
|
+
return _context.abrupt("return", cachedItem.item);
|
|
9145
|
+
|
|
9146
|
+
case 4:
|
|
9147
|
+
url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("MessageSid", messageSid).build();
|
|
9148
|
+
_context.next = 7;
|
|
9149
|
+
return this._services.commandExecutor.fetchResource(url);
|
|
9150
|
+
|
|
9151
|
+
case 7:
|
|
9152
|
+
recipientsResponse = _context.sent;
|
|
9153
|
+
recipients = recipientsResponse.message_recipients.map(function (recipient) {
|
|
9154
|
+
return _this._wrapResponse(recipient);
|
|
9155
|
+
});
|
|
9156
|
+
|
|
9157
|
+
if (recipients.length > 0) {
|
|
9158
|
+
this._cache.set(key, {
|
|
9159
|
+
item: recipients
|
|
9160
|
+
});
|
|
9161
|
+
}
|
|
9162
|
+
|
|
9163
|
+
return _context.abrupt("return", recipients);
|
|
9164
|
+
|
|
9165
|
+
case 11:
|
|
9166
|
+
case "end":
|
|
9167
|
+
return _context.stop();
|
|
9168
|
+
}
|
|
9169
|
+
}
|
|
9170
|
+
}, _callee, this);
|
|
9171
|
+
}));
|
|
9172
|
+
|
|
9173
|
+
function getRecipientsFromMessage(_x, _x2) {
|
|
9174
|
+
return _getRecipientsFromMessage.apply(this, arguments);
|
|
9175
|
+
}
|
|
9176
|
+
|
|
9177
|
+
return getRecipientsFromMessage;
|
|
9178
|
+
}()
|
|
9179
|
+
}, {
|
|
9180
|
+
key: "getRecipientsFromConversation",
|
|
9181
|
+
value: function () {
|
|
9182
|
+
var _getRecipientsFromConversation = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(conversationSid, paginatorOptions) {
|
|
9183
|
+
var _paginatorOptions$pag,
|
|
9184
|
+
_paginatorOptions$pag2,
|
|
9185
|
+
_this2 = this;
|
|
9186
|
+
|
|
9187
|
+
var url, recipientsResponse, allRecipients, _iterator, _step, _this$_cache$get$item, _this$_cache$get, recipient, key, existingMessageRecipients;
|
|
9188
|
+
|
|
9189
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
9190
|
+
while (1) {
|
|
9191
|
+
switch (_context2.prev = _context2.next) {
|
|
9192
|
+
case 0:
|
|
9193
|
+
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 : undefined).arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : undefined).build();
|
|
9194
|
+
_context2.next = 3;
|
|
9195
|
+
return this._services.commandExecutor.fetchResource(url);
|
|
9196
|
+
|
|
9197
|
+
case 3:
|
|
9198
|
+
recipientsResponse = _context2.sent;
|
|
9199
|
+
allRecipients = recipientsResponse.message_recipients.map(function (recipient) {
|
|
9200
|
+
return _this2._wrapResponse(recipient);
|
|
9201
|
+
});
|
|
9202
|
+
_iterator = _createForOfIteratorHelper(allRecipients);
|
|
9203
|
+
|
|
9204
|
+
try {
|
|
9205
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
9206
|
+
recipient = _step.value;
|
|
9207
|
+
key = "".concat(conversationSid, ",").concat(recipient.messageSid);
|
|
9208
|
+
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 : [];
|
|
9209
|
+
|
|
9210
|
+
this._cache.set(key, {
|
|
9211
|
+
item: [].concat(_toConsumableArray__default["default"](existingMessageRecipients), [recipient])
|
|
9212
|
+
});
|
|
9213
|
+
}
|
|
9214
|
+
} catch (err) {
|
|
9215
|
+
_iterator.e(err);
|
|
9216
|
+
} finally {
|
|
9217
|
+
_iterator.f();
|
|
9218
|
+
}
|
|
9219
|
+
|
|
9220
|
+
return _context2.abrupt("return", new RestPaginator(allRecipients, function (pageToken, pageSize) {
|
|
9221
|
+
return _this2.getRecipientsFromConversation(conversationSid, {
|
|
9222
|
+
pageToken: pageToken,
|
|
9223
|
+
pageSize: pageSize
|
|
9224
|
+
});
|
|
9225
|
+
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
|
|
9226
|
+
|
|
9227
|
+
case 8:
|
|
9228
|
+
case "end":
|
|
9229
|
+
return _context2.stop();
|
|
9230
|
+
}
|
|
9231
|
+
}
|
|
9232
|
+
}, _callee2, this);
|
|
9233
|
+
}));
|
|
9234
|
+
|
|
9235
|
+
function getRecipientsFromConversation(_x3, _x4) {
|
|
9236
|
+
return _getRecipientsFromConversation.apply(this, arguments);
|
|
9237
|
+
}
|
|
9238
|
+
|
|
9239
|
+
return getRecipientsFromConversation;
|
|
9240
|
+
}()
|
|
9241
|
+
}, {
|
|
9242
|
+
key: "_wrapResponse",
|
|
9243
|
+
value: function _wrapResponse(recipient) {
|
|
9244
|
+
switch (recipient.type) {
|
|
9245
|
+
case "email":
|
|
9246
|
+
return new EmailRecipientDescriptor(recipient);
|
|
9247
|
+
|
|
9248
|
+
default:
|
|
9249
|
+
return new UnknownRecipientDescriptor(recipient);
|
|
9250
|
+
}
|
|
9251
|
+
}
|
|
9252
|
+
}]);
|
|
9253
|
+
|
|
9254
|
+
return MessageRecipientsClient;
|
|
9255
|
+
}();
|
|
9256
|
+
|
|
8686
9257
|
var _class;
|
|
8687
9258
|
|
|
8688
9259
|
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; }
|
|
@@ -8951,7 +9522,47 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
8951
9522
|
*/
|
|
8952
9523
|
|
|
8953
9524
|
/**
|
|
8954
|
-
*
|
|
9525
|
+
* Promise that resolves on successful initialization.
|
|
9526
|
+
*/
|
|
9527
|
+
|
|
9528
|
+
/**
|
|
9529
|
+
* Options passed to the client.
|
|
9530
|
+
*/
|
|
9531
|
+
|
|
9532
|
+
/**
|
|
9533
|
+
* Client service objects.
|
|
9534
|
+
*/
|
|
9535
|
+
|
|
9536
|
+
/**
|
|
9537
|
+
* The user of the client.
|
|
9538
|
+
*/
|
|
9539
|
+
|
|
9540
|
+
/**
|
|
9541
|
+
* Resolves the {@link Client._ensureReady} promise.
|
|
9542
|
+
*/
|
|
9543
|
+
|
|
9544
|
+
/**
|
|
9545
|
+
* Rejects the {@link Client._ensureReady} promise.
|
|
9546
|
+
*/
|
|
9547
|
+
|
|
9548
|
+
/**
|
|
9549
|
+
* The current token of the client.
|
|
9550
|
+
*/
|
|
9551
|
+
|
|
9552
|
+
/**
|
|
9553
|
+
* The constructed configuration object.
|
|
9554
|
+
*/
|
|
9555
|
+
|
|
9556
|
+
/**
|
|
9557
|
+
* The Conversations entity.
|
|
9558
|
+
*/
|
|
9559
|
+
|
|
9560
|
+
/**
|
|
9561
|
+
* Promise that resolves when initial conversations are fetched.
|
|
9562
|
+
*/
|
|
9563
|
+
|
|
9564
|
+
/**
|
|
9565
|
+
* Returned Conversations Client instance is not yet fully initialized. Calling any
|
|
8955
9566
|
* operations will block until it is. Use connection events to monitor when
|
|
8956
9567
|
* client becomes fully available (connectionStateChanged with state
|
|
8957
9568
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
|
@@ -9041,16 +9652,16 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9041
9652
|
|
|
9042
9653
|
_this._services.twilsockClient = _this._options.twilsockClient = (_this$_options$twilso = _this._options.twilsockClient) !== null && _this$_options$twilso !== void 0 ? _this$_options$twilso : new twilsock.TwilsockClient(fpaToken, productId, _this._options);
|
|
9043
9654
|
|
|
9044
|
-
_this._services.twilsockClient.on(
|
|
9045
|
-
return _this.emit(
|
|
9655
|
+
_this._services.twilsockClient.on(Client_1.tokenAboutToExpire, function () {
|
|
9656
|
+
return _this.emit(Client_1.tokenAboutToExpire);
|
|
9046
9657
|
});
|
|
9047
9658
|
|
|
9048
|
-
_this._services.twilsockClient.on(
|
|
9049
|
-
return _this.emit(
|
|
9659
|
+
_this._services.twilsockClient.on(Client_1.tokenExpired, function () {
|
|
9660
|
+
return _this.emit(Client_1.tokenExpired);
|
|
9050
9661
|
});
|
|
9051
9662
|
|
|
9052
|
-
_this._services.twilsockClient.on(
|
|
9053
|
-
return _this.emit(
|
|
9663
|
+
_this._services.twilsockClient.on(Client_1.connectionError, function (error) {
|
|
9664
|
+
return _this.emit(Client_1.connectionError, error);
|
|
9054
9665
|
});
|
|
9055
9666
|
|
|
9056
9667
|
_this._services.twilsockClient.on("stateChanged", function (state) {
|
|
@@ -9059,7 +9670,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9059
9670
|
if (state !== _this.connectionState) {
|
|
9060
9671
|
_this.connectionState = state;
|
|
9061
9672
|
|
|
9062
|
-
_this.emit(
|
|
9673
|
+
_this.emit(Client_1.connectionStateChanged, _this.connectionState);
|
|
9063
9674
|
}
|
|
9064
9675
|
});
|
|
9065
9676
|
|
|
@@ -9077,9 +9688,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9077
9688
|
var emitFailed = function emitFailed(error) {
|
|
9078
9689
|
_this._rejectEnsureReady(error);
|
|
9079
9690
|
|
|
9080
|
-
_this.emit(
|
|
9691
|
+
_this.emit(Client_1.stateChanged, "failed");
|
|
9081
9692
|
|
|
9082
|
-
_this.emit(
|
|
9693
|
+
_this.emit(Client_1.initFailed, {
|
|
9083
9694
|
error: error
|
|
9084
9695
|
});
|
|
9085
9696
|
};
|
|
@@ -9089,6 +9700,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9089
9700
|
terminal: true,
|
|
9090
9701
|
message: "Twilsock has disconnected."
|
|
9091
9702
|
});
|
|
9703
|
+
|
|
9704
|
+
_this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
|
|
9092
9705
|
};
|
|
9093
9706
|
|
|
9094
9707
|
_this._services.twilsockClient.once("connectionError", emitFailed);
|
|
@@ -9132,9 +9745,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9132
9745
|
|
|
9133
9746
|
_this._rejectEnsureReady(connectionError);
|
|
9134
9747
|
|
|
9135
|
-
_this.emit(
|
|
9748
|
+
_this.emit(Client_1.stateChanged, "failed");
|
|
9136
9749
|
|
|
9137
|
-
_this.emit(
|
|
9750
|
+
_this.emit(Client_1.initFailed, {
|
|
9138
9751
|
error: connectionError
|
|
9139
9752
|
});
|
|
9140
9753
|
|
|
@@ -9146,12 +9759,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9146
9759
|
}, _callee, null, [[3, 11]]);
|
|
9147
9760
|
})));
|
|
9148
9761
|
|
|
9149
|
-
_this.
|
|
9150
|
-
_this._resolveEnsureReady = resolve;
|
|
9151
|
-
_this._rejectEnsureReady = reject;
|
|
9152
|
-
}).catch(function () {
|
|
9153
|
-
return void 0;
|
|
9154
|
-
}); // @todo How to process unhandled rejection here?
|
|
9762
|
+
_this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
|
|
9155
9763
|
|
|
9156
9764
|
if (startTwilsock) {
|
|
9157
9765
|
_this._services.twilsockClient.connect();
|
|
@@ -9376,7 +9984,6 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9376
9984
|
/**
|
|
9377
9985
|
* Peek a conversation by its SID.
|
|
9378
9986
|
* @param conversationSid Conversation sid
|
|
9379
|
-
* @internal
|
|
9380
9987
|
*/
|
|
9381
9988
|
|
|
9382
9989
|
}, {
|
|
@@ -9662,7 +10269,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9662
10269
|
return removePushRegistrations;
|
|
9663
10270
|
}()
|
|
9664
10271
|
/**
|
|
9665
|
-
*
|
|
10272
|
+
* Parse a push notification payload.
|
|
9666
10273
|
*/
|
|
9667
10274
|
|
|
9668
10275
|
}, {
|
|
@@ -9904,6 +10511,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9904
10511
|
configurationResponse = _context17.sent;
|
|
9905
10512
|
this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
|
|
9906
10513
|
this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
|
|
10514
|
+
this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
|
|
9907
10515
|
|
|
9908
10516
|
this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
|
|
9909
10517
|
|
|
@@ -9980,12 +10588,13 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9980
10588
|
this._conversationsPromise = this._conversationsEntity.fetchConversations().then(function () {
|
|
9981
10589
|
return _this3._conversationsEntity;
|
|
9982
10590
|
}).catch(function (error) {
|
|
10591
|
+
console.error("Failed to fetch conversations _conversationsPromise -> client.ts", error);
|
|
9983
10592
|
throw error;
|
|
9984
10593
|
});
|
|
9985
|
-
_context17.next =
|
|
10594
|
+
_context17.next = 30;
|
|
9986
10595
|
return this._services.users.myself._ensureFetched();
|
|
9987
10596
|
|
|
9988
|
-
case
|
|
10597
|
+
case 30:
|
|
9989
10598
|
Client_1._supportedPushChannels.forEach(function (channelType) {
|
|
9990
10599
|
return _this3._subscribeToPushNotifications(channelType);
|
|
9991
10600
|
});
|
|
@@ -9998,10 +10607,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9998
10607
|
|
|
9999
10608
|
this._resolveEnsureReady();
|
|
10000
10609
|
|
|
10001
|
-
this.emit(
|
|
10002
|
-
this.emit(
|
|
10610
|
+
this.emit(Client_1.stateChanged, "initialized");
|
|
10611
|
+
this.emit(Client_1.initialized);
|
|
10003
10612
|
|
|
10004
|
-
case
|
|
10613
|
+
case 36:
|
|
10005
10614
|
case "end":
|
|
10006
10615
|
return _context17.stop();
|
|
10007
10616
|
}
|
|
@@ -10043,6 +10652,26 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
10043
10652
|
_this5._services.notificationClient.unsubscribe(channelType, messageType);
|
|
10044
10653
|
});
|
|
10045
10654
|
}
|
|
10655
|
+
/**
|
|
10656
|
+
* Initialize the ensureReady promise.
|
|
10657
|
+
*/
|
|
10658
|
+
|
|
10659
|
+
}, {
|
|
10660
|
+
key: "_initializeEnsureReady",
|
|
10661
|
+
value: function _initializeEnsureReady(throwErrorsAlways) {
|
|
10662
|
+
var _this6 = this;
|
|
10663
|
+
|
|
10664
|
+
this._ensureReady = new Promise(function (resolve, reject) {
|
|
10665
|
+
_this6._resolveEnsureReady = resolve;
|
|
10666
|
+
_this6._rejectEnsureReady = reject;
|
|
10667
|
+
}).catch(function (error) {
|
|
10668
|
+
if (throwErrorsAlways) {
|
|
10669
|
+
throw error;
|
|
10670
|
+
} else {
|
|
10671
|
+
return void 0;
|
|
10672
|
+
}
|
|
10673
|
+
});
|
|
10674
|
+
}
|
|
10046
10675
|
}], [{
|
|
10047
10676
|
key: "create",
|
|
10048
10677
|
value: function () {
|
|
@@ -10261,6 +10890,7 @@ exports.ContentTemplate = ContentTemplate;
|
|
|
10261
10890
|
exports.ContentTemplateVariable = ContentTemplateVariable;
|
|
10262
10891
|
exports.Conversation = Conversation;
|
|
10263
10892
|
exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
|
|
10893
|
+
exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
|
|
10264
10894
|
exports.Media = Media;
|
|
10265
10895
|
exports.Message = Message;
|
|
10266
10896
|
exports.MessageBuilder = MessageBuilder;
|
|
@@ -10268,6 +10898,7 @@ exports.NotificationTypes = NotificationTypes;
|
|
|
10268
10898
|
exports.Participant = Participant;
|
|
10269
10899
|
exports.PushNotification = PushNotification;
|
|
10270
10900
|
exports.RestPaginator = RestPaginator;
|
|
10901
|
+
exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
|
|
10271
10902
|
exports.UnsentMessage = UnsentMessage;
|
|
10272
10903
|
exports.User = User;
|
|
10273
10904
|
//# sourceMappingURL=browser.js.map
|