@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/lib.js
CHANGED
|
@@ -128,6 +128,15 @@ This software includes platform.js under the following license.
|
|
|
128
128
|
*/
|
|
129
129
|
'use strict';
|
|
130
130
|
|
|
131
|
+
var global =
|
|
132
|
+
typeof global !== "undefined"
|
|
133
|
+
? global
|
|
134
|
+
: typeof self !== "undefined"
|
|
135
|
+
? self
|
|
136
|
+
: typeof window !== "undefined"
|
|
137
|
+
? window
|
|
138
|
+
: {};
|
|
139
|
+
|
|
131
140
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
132
141
|
|
|
133
142
|
require('core-js/modules/es.reflect.to-string-tag.js');
|
|
@@ -145,10 +154,10 @@ var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
|
145
154
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
146
155
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
147
156
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
148
|
-
require('core-js/modules/es.object.to-string.js');
|
|
149
|
-
require('core-js/modules/es.promise.js');
|
|
150
157
|
require('core-js/modules/es.array.map.js');
|
|
158
|
+
require('core-js/modules/es.object.to-string.js');
|
|
151
159
|
require('core-js/modules/web.dom-collections.for-each.js');
|
|
160
|
+
require('core-js/modules/es.promise.js');
|
|
152
161
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
153
162
|
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
154
163
|
require('core-js/modules/es.array.concat.js');
|
|
@@ -167,7 +176,6 @@ var declarativeTypeValidator = require('@twilio/declarative-type-validator');
|
|
|
167
176
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
168
177
|
require('core-js/modules/es.array.includes.js');
|
|
169
178
|
var replayEventEmitter = require('@twilio/replay-event-emitter');
|
|
170
|
-
var isEqual = require('lodash.isequal');
|
|
171
179
|
require('core-js/modules/es.array.slice.js');
|
|
172
180
|
require('core-js/modules/es.function.name.js');
|
|
173
181
|
require('core-js/modules/es.regexp.test.js');
|
|
@@ -208,16 +216,15 @@ require('core-js/modules/es.typed-array.subarray.js');
|
|
|
208
216
|
require('core-js/modules/es.typed-array.to-locale-string.js');
|
|
209
217
|
require('core-js/modules/es.typed-array.to-string.js');
|
|
210
218
|
require('core-js/modules/es.array-buffer.constructor.js');
|
|
211
|
-
require('isomorphic-form-data');
|
|
212
219
|
require('core-js/modules/es.array.sort.js');
|
|
213
220
|
require('core-js/modules/es.string.includes.js');
|
|
214
221
|
require('core-js/modules/es.string.starts-with.js');
|
|
222
|
+
require('core-js/modules/es.weak-set.js');
|
|
215
223
|
var deprecationDecorator = require('@twilio/deprecation-decorator');
|
|
216
224
|
require('core-js/modules/es.object.entries.js');
|
|
217
225
|
require('core-js/modules/es.array.find.js');
|
|
218
226
|
require('core-js/modules/es.array.splice.js');
|
|
219
227
|
var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
|
|
220
|
-
var uuid = require('uuid');
|
|
221
228
|
require('core-js/modules/es.object.freeze.js');
|
|
222
229
|
|
|
223
230
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -252,7 +259,6 @@ var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regenerat
|
|
|
252
259
|
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
253
260
|
var loglevelLog__namespace = /*#__PURE__*/_interopNamespace(loglevelLog);
|
|
254
261
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
255
|
-
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
256
262
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
257
263
|
var _wrapNativeSuper__default = /*#__PURE__*/_interopDefaultLegacy(_wrapNativeSuper);
|
|
258
264
|
|
|
@@ -292,11 +298,13 @@ var Logger = /*#__PURE__*/function () {
|
|
|
292
298
|
}, {
|
|
293
299
|
key: "trace",
|
|
294
300
|
value: function trace() {
|
|
295
|
-
|
|
296
|
-
args
|
|
297
|
-
|
|
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
|
+
}
|
|
298
305
|
|
|
299
|
-
|
|
306
|
+
log$7.debug.apply(null, prepareLine(this.prefix + "T", args));
|
|
307
|
+
}
|
|
300
308
|
}
|
|
301
309
|
}, {
|
|
302
310
|
key: "debug",
|
|
@@ -347,11 +355,13 @@ var Logger = /*#__PURE__*/function () {
|
|
|
347
355
|
}, {
|
|
348
356
|
key: "trace",
|
|
349
357
|
value: function trace() {
|
|
350
|
-
|
|
351
|
-
args
|
|
352
|
-
|
|
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
|
+
}
|
|
353
362
|
|
|
354
|
-
|
|
363
|
+
log$7.debug.apply(null, prepareLine("T", args));
|
|
364
|
+
}
|
|
355
365
|
}
|
|
356
366
|
}, {
|
|
357
367
|
key: "debug",
|
|
@@ -405,9 +415,11 @@ var MINIMUM_RETRY_DELAY = 1000;
|
|
|
405
415
|
var MAXIMUM_RETRY_DELAY = 4000;
|
|
406
416
|
var MAXIMUM_ATTEMPTS_COUNT = 3;
|
|
407
417
|
var RETRY_WHEN_THROTTLED = true;
|
|
418
|
+
var CHANNEL_METADATA_CACHE_CAPACITY = 100;
|
|
419
|
+
var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
|
|
408
420
|
|
|
409
421
|
var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
|
|
410
|
-
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;
|
|
411
423
|
|
|
412
424
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
413
425
|
var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -466,7 +478,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
|
|
|
466
478
|
this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
|
|
467
479
|
}
|
|
468
480
|
|
|
469
|
-
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;
|
|
470
483
|
});
|
|
471
484
|
|
|
472
485
|
/**
|
|
@@ -558,6 +571,56 @@ var UriBuilder = /*#__PURE__*/function () {
|
|
|
558
571
|
|
|
559
572
|
return UriBuilder;
|
|
560
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
|
+
}
|
|
561
624
|
|
|
562
625
|
var json = declarativeTypeValidator.custom(function (value) {
|
|
563
626
|
return [["string", "number", "boolean", "object"].includes(_typeof__default["default"](value)), "a JSON type"];
|
|
@@ -638,6 +701,22 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
638
701
|
* @event
|
|
639
702
|
*/
|
|
640
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
|
+
|
|
641
720
|
|
|
642
721
|
_createClass__default["default"](User, [{
|
|
643
722
|
key: "identity",
|
|
@@ -732,7 +811,7 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
732
811
|
case 9:
|
|
733
812
|
updateAttributes = parseAttributes(value.value, "Retrieved malformed attributes from the server for user: ".concat(this.state.identity), log$6);
|
|
734
813
|
|
|
735
|
-
if (!
|
|
814
|
+
if (!isEqual(this.state.attributes, updateAttributes)) {
|
|
736
815
|
this.state.attributes = updateAttributes;
|
|
737
816
|
updateReasons.push("attributes");
|
|
738
817
|
}
|
|
@@ -1084,11 +1163,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
|
|
|
1084
1163
|
|
|
1085
1164
|
__decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
|
|
1086
1165
|
|
|
1087
|
-
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; } } }; }
|
|
1088
1167
|
|
|
1089
|
-
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); }
|
|
1090
1169
|
|
|
1091
|
-
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; }
|
|
1092
1171
|
|
|
1093
1172
|
var Network = /*#__PURE__*/function () {
|
|
1094
1173
|
function Network(configuration, services) {
|
|
@@ -1109,7 +1188,7 @@ var Network = /*#__PURE__*/function () {
|
|
|
1109
1188
|
}, {
|
|
1110
1189
|
key: "cleanupCache",
|
|
1111
1190
|
value: function cleanupCache() {
|
|
1112
|
-
var _iterator = _createForOfIteratorHelper$
|
|
1191
|
+
var _iterator = _createForOfIteratorHelper$5(this.cache),
|
|
1113
1192
|
_step;
|
|
1114
1193
|
|
|
1115
1194
|
try {
|
|
@@ -1310,6 +1389,24 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1310
1389
|
* @event
|
|
1311
1390
|
*/
|
|
1312
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
|
+
|
|
1313
1410
|
|
|
1314
1411
|
_createClass__default["default"](Participant, [{
|
|
1315
1412
|
key: "sid",
|
|
@@ -1436,8 +1533,9 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1436
1533
|
}
|
|
1437
1534
|
|
|
1438
1535
|
this.state.isTyping = true;
|
|
1439
|
-
this.emit(
|
|
1440
|
-
this.conversation.emit(
|
|
1536
|
+
this.emit(Participant.typingStarted, this);
|
|
1537
|
+
this.conversation.emit(Conversation.typingStarted, this); // @fixme layering violation
|
|
1538
|
+
|
|
1441
1539
|
this.state.typingTimeout = Number(setTimeout(function () {
|
|
1442
1540
|
return _this2._endTyping();
|
|
1443
1541
|
}, timeout));
|
|
@@ -1456,8 +1554,8 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1456
1554
|
}
|
|
1457
1555
|
|
|
1458
1556
|
this.state.isTyping = false;
|
|
1459
|
-
this.emit(
|
|
1460
|
-
this.conversation.emit(
|
|
1557
|
+
this.emit(Participant.typingEnded, this);
|
|
1558
|
+
this.conversation.emit(Conversation.typingEnded, this);
|
|
1461
1559
|
clearInterval(this.state.typingTimeout);
|
|
1462
1560
|
this.state.typingTimeout = null;
|
|
1463
1561
|
}
|
|
@@ -1472,7 +1570,7 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1472
1570
|
var updateReasons = [];
|
|
1473
1571
|
var updateAttributes = parseAttributes(data.attributes, "Retrieved malformed attributes from the server for participant: " + this.state.sid, log$5);
|
|
1474
1572
|
|
|
1475
|
-
if (data.attributes && !
|
|
1573
|
+
if (data.attributes && !isEqual(this.state.attributes, updateAttributes)) {
|
|
1476
1574
|
this.state.attributes = updateAttributes;
|
|
1477
1575
|
updateReasons.push("attributes");
|
|
1478
1576
|
}
|
|
@@ -1510,13 +1608,13 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1510
1608
|
}
|
|
1511
1609
|
}
|
|
1512
1610
|
|
|
1513
|
-
if (data.bindings && !
|
|
1611
|
+
if (data.bindings && !isEqual(this.state.bindings, data.bindings)) {
|
|
1514
1612
|
this.state.bindings = data.bindings;
|
|
1515
1613
|
updateReasons.push("bindings");
|
|
1516
1614
|
}
|
|
1517
1615
|
|
|
1518
1616
|
if (updateReasons.length > 0) {
|
|
1519
|
-
this.emit(
|
|
1617
|
+
this.emit(Participant.updated, {
|
|
1520
1618
|
participant: this,
|
|
1521
1619
|
updateReasons: updateReasons
|
|
1522
1620
|
});
|
|
@@ -1652,7 +1750,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1652
1750
|
|
|
1653
1751
|
var _super = _createSuper$7(Participants);
|
|
1654
1752
|
|
|
1655
|
-
|
|
1753
|
+
// passed in from Conversation
|
|
1754
|
+
function Participants(conversation, participants, links, services) {
|
|
1656
1755
|
var _this;
|
|
1657
1756
|
|
|
1658
1757
|
_classCallCheck__default["default"](this, Participants);
|
|
@@ -1664,7 +1763,6 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1664
1763
|
_this.conversation = conversation;
|
|
1665
1764
|
_this.participants = participants;
|
|
1666
1765
|
_this.links = links;
|
|
1667
|
-
_this.configuration = configuration;
|
|
1668
1766
|
_this.services = services;
|
|
1669
1767
|
return _this;
|
|
1670
1768
|
}
|
|
@@ -1715,14 +1813,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1715
1813
|
mode: "open_existing"
|
|
1716
1814
|
}) : Promise.resolve(arg);
|
|
1717
1815
|
return this.rosterEntityPromise = this.rosterEntityPromise || participantsMapPromise.then(function (rosterMap) {
|
|
1718
|
-
rosterMap.on(
|
|
1816
|
+
rosterMap.on(twilioSync.SyncMap.itemAdded, function (args) {
|
|
1719
1817
|
log$4.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
|
|
1720
1818
|
|
|
1721
1819
|
_this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
|
|
1722
|
-
_this2.emit(
|
|
1820
|
+
_this2.emit(Conversation.participantJoined, participant);
|
|
1723
1821
|
});
|
|
1724
1822
|
});
|
|
1725
|
-
rosterMap.on(
|
|
1823
|
+
rosterMap.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
|
1726
1824
|
log$4.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
|
|
1727
1825
|
var participantSid = args.key;
|
|
1728
1826
|
|
|
@@ -1738,12 +1836,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1738
1836
|
return;
|
|
1739
1837
|
}
|
|
1740
1838
|
|
|
1741
|
-
_this2.emit(
|
|
1839
|
+
_this2.emit(Conversation.participantLeft, leftParticipant);
|
|
1742
1840
|
});
|
|
1743
|
-
rosterMap.on(
|
|
1841
|
+
rosterMap.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
|
1744
1842
|
log$4.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
|
|
1745
1843
|
|
|
1746
|
-
_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
|
+
});
|
|
1747
1847
|
});
|
|
1748
1848
|
var participantsPromises = [];
|
|
1749
1849
|
|
|
@@ -1837,8 +1937,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
1837
1937
|
};
|
|
1838
1938
|
participant = new Participant(data, participantSid, this.conversation, links, this.services);
|
|
1839
1939
|
this.participants.set(participantSid, participant);
|
|
1840
|
-
participant.on(
|
|
1841
|
-
return _this3.emit(
|
|
1940
|
+
participant.on(Participant.updated, function (args) {
|
|
1941
|
+
return _this3.emit(Conversation.participantUpdated, args);
|
|
1842
1942
|
});
|
|
1843
1943
|
return _context3.abrupt("return", participant);
|
|
1844
1944
|
|
|
@@ -2102,6 +2202,8 @@ var Media = /*#__PURE__*/function () {
|
|
|
2102
2202
|
* @internal
|
|
2103
2203
|
*/
|
|
2104
2204
|
function Media(data, services) {
|
|
2205
|
+
var _data$filename;
|
|
2206
|
+
|
|
2105
2207
|
_classCallCheck__default["default"](this, Media);
|
|
2106
2208
|
|
|
2107
2209
|
_defineProperty__default["default"](this, "mcsMedia", null);
|
|
@@ -2115,7 +2217,7 @@ var Media = /*#__PURE__*/function () {
|
|
|
2115
2217
|
this.state = {
|
|
2116
2218
|
sid: data.sid,
|
|
2117
2219
|
category: data.category,
|
|
2118
|
-
filename: data.filename,
|
|
2220
|
+
filename: (_data$filename = data.filename) !== null && _data$filename !== void 0 ? _data$filename : null,
|
|
2119
2221
|
contentType: data.contentType,
|
|
2120
2222
|
size: data.size
|
|
2121
2223
|
};
|
|
@@ -2188,10 +2290,12 @@ var Media = /*#__PURE__*/function () {
|
|
|
2188
2290
|
while (1) {
|
|
2189
2291
|
switch (_context.prev = _context.next) {
|
|
2190
2292
|
case 0:
|
|
2191
|
-
fetchMediaRequest = _this._fetchMcsMedia();
|
|
2293
|
+
fetchMediaRequest = _this.mcsMedia ? undefined : _this._fetchMcsMedia();
|
|
2192
2294
|
contentUrlRequest = (_this$mcsMedia = _this.mcsMedia) === null || _this$mcsMedia === void 0 ? void 0 : _this$mcsMedia.getContentUrl();
|
|
2193
2295
|
onCancel(function () {
|
|
2194
|
-
fetchMediaRequest
|
|
2296
|
+
if (fetchMediaRequest) {
|
|
2297
|
+
fetchMediaRequest.cancel();
|
|
2298
|
+
}
|
|
2195
2299
|
|
|
2196
2300
|
if (contentUrlRequest) {
|
|
2197
2301
|
contentUrlRequest.cancel();
|
|
@@ -2199,7 +2303,7 @@ var Media = /*#__PURE__*/function () {
|
|
|
2199
2303
|
});
|
|
2200
2304
|
_context.prev = 3;
|
|
2201
2305
|
|
|
2202
|
-
if (
|
|
2306
|
+
if (contentUrlRequest) {
|
|
2203
2307
|
_context.next = 9;
|
|
2204
2308
|
break;
|
|
2205
2309
|
}
|
|
@@ -2209,7 +2313,7 @@ var Media = /*#__PURE__*/function () {
|
|
|
2209
2313
|
|
|
2210
2314
|
case 7:
|
|
2211
2315
|
mcsMedia = _context.sent;
|
|
2212
|
-
contentUrlRequest = mcsMedia.getContentUrl();
|
|
2316
|
+
contentUrlRequest = mcsMedia === null || mcsMedia === void 0 ? void 0 : mcsMedia.getContentUrl();
|
|
2213
2317
|
|
|
2214
2318
|
case 9:
|
|
2215
2319
|
_context.t0 = resolve;
|
|
@@ -2266,13 +2370,11 @@ var Media = /*#__PURE__*/function () {
|
|
|
2266
2370
|
while (1) {
|
|
2267
2371
|
switch (_context2.prev = _context2.next) {
|
|
2268
2372
|
case 0:
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
if (!_this2.services.mcsClient) {
|
|
2272
|
-
_context2.next = 14;
|
|
2273
|
-
break;
|
|
2373
|
+
if (_this2.services.mcsClient === null) {
|
|
2374
|
+
reject(new Error("Media Content Service is unavailable"));
|
|
2274
2375
|
}
|
|
2275
2376
|
|
|
2377
|
+
request = _this2.services.mcsClient.get(_this2.state.sid);
|
|
2276
2378
|
onCancel(function () {
|
|
2277
2379
|
return request.cancel();
|
|
2278
2380
|
});
|
|
@@ -2282,27 +2384,22 @@ var Media = /*#__PURE__*/function () {
|
|
|
2282
2384
|
|
|
2283
2385
|
case 6:
|
|
2284
2386
|
_this2.mcsMedia = _context2.sent;
|
|
2387
|
+
_this2.state = _this2.mcsMedia._state();
|
|
2285
2388
|
resolve(_this2.mcsMedia);
|
|
2286
|
-
_context2.next =
|
|
2389
|
+
_context2.next = 14;
|
|
2287
2390
|
break;
|
|
2288
2391
|
|
|
2289
|
-
case
|
|
2290
|
-
_context2.prev =
|
|
2392
|
+
case 11:
|
|
2393
|
+
_context2.prev = 11;
|
|
2291
2394
|
_context2.t0 = _context2["catch"](3);
|
|
2292
2395
|
reject(_context2.t0);
|
|
2293
2396
|
|
|
2294
|
-
case 13:
|
|
2295
|
-
return _context2.abrupt("return");
|
|
2296
|
-
|
|
2297
2397
|
case 14:
|
|
2298
|
-
reject(new Error("Media Content Service is unavailable"));
|
|
2299
|
-
|
|
2300
|
-
case 15:
|
|
2301
2398
|
case "end":
|
|
2302
2399
|
return _context2.stop();
|
|
2303
2400
|
}
|
|
2304
2401
|
}
|
|
2305
|
-
}, _callee2, null, [[3,
|
|
2402
|
+
}, _callee2, null, [[3, 11]]);
|
|
2306
2403
|
}));
|
|
2307
2404
|
|
|
2308
2405
|
return function (_x4, _x5, _x6) {
|
|
@@ -2310,6 +2407,15 @@ var Media = /*#__PURE__*/function () {
|
|
|
2310
2407
|
};
|
|
2311
2408
|
}());
|
|
2312
2409
|
}
|
|
2410
|
+
/**
|
|
2411
|
+
* @internal
|
|
2412
|
+
*/
|
|
2413
|
+
|
|
2414
|
+
}, {
|
|
2415
|
+
key: "_state",
|
|
2416
|
+
value: function _state() {
|
|
2417
|
+
return this.state;
|
|
2418
|
+
}
|
|
2313
2419
|
}]);
|
|
2314
2420
|
|
|
2315
2421
|
return Media;
|
|
@@ -2807,6 +2913,12 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
2807
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); }; }
|
|
2808
2914
|
|
|
2809
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; }
|
|
2810
2922
|
var log$3 = Logger.scope("Message");
|
|
2811
2923
|
|
|
2812
2924
|
var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -2816,6 +2928,10 @@ global["XMLHttpRequest"] || require("xmlhttprequest").XMLHttpRequest;
|
|
|
2816
2928
|
*/
|
|
2817
2929
|
|
|
2818
2930
|
|
|
2931
|
+
var _wrapMedia = /*#__PURE__*/new WeakSet();
|
|
2932
|
+
|
|
2933
|
+
var _assignMedias = /*#__PURE__*/new WeakSet();
|
|
2934
|
+
|
|
2819
2935
|
var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
2820
2936
|
_inherits__default["default"](Message, _ReplayEventEmitter);
|
|
2821
2937
|
|
|
@@ -2829,13 +2945,18 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
2829
2945
|
* @internal
|
|
2830
2946
|
*/
|
|
2831
2947
|
function Message(index, data, conversation, links, configuration, services) {
|
|
2832
|
-
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;
|
|
2833
2949
|
|
|
2834
2950
|
var _this;
|
|
2835
2951
|
|
|
2836
2952
|
_classCallCheck__default["default"](this, Message);
|
|
2837
2953
|
|
|
2838
2954
|
_this = _super.call(this);
|
|
2955
|
+
|
|
2956
|
+
_classPrivateMethodInitSpec(_assertThisInitialized__default["default"](_this), _assignMedias);
|
|
2957
|
+
|
|
2958
|
+
_classPrivateMethodInitSpec(_assertThisInitialized__default["default"](_this), _wrapMedia);
|
|
2959
|
+
|
|
2839
2960
|
_this.conversation = conversation;
|
|
2840
2961
|
_this.links = links;
|
|
2841
2962
|
_this.configuration = configuration;
|
|
@@ -2852,16 +2973,15 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
2852
2973
|
lastUpdatedBy: (_data$lastUpdatedBy = data.lastUpdatedBy) !== null && _data$lastUpdatedBy !== void 0 ? _data$lastUpdatedBy : null,
|
|
2853
2974
|
attributes: parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(data.sid), log$3),
|
|
2854
2975
|
type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type : "text",
|
|
2855
|
-
media:
|
|
2856
|
-
medias:
|
|
2857
|
-
return new Media(m, _this.services);
|
|
2858
|
-
}) : data.type === "media" && data.media && !data.medias ? [new Media(_objectSpread$4(_objectSpread$4({}, data.media), {}, {
|
|
2859
|
-
category: "media"
|
|
2860
|
-
}), _this.services)] : null,
|
|
2976
|
+
media: null,
|
|
2977
|
+
medias: null,
|
|
2861
2978
|
participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
|
|
2862
2979
|
aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null,
|
|
2863
2980
|
hasChannelMetadata: (_data$channelMetadata = data.channelMetadata) !== null && _data$channelMetadata !== void 0 ? _data$channelMetadata : false
|
|
2864
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
|
+
|
|
2865
2985
|
return _this;
|
|
2866
2986
|
}
|
|
2867
2987
|
/**
|
|
@@ -3083,6 +3203,12 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3083
3203
|
}, {
|
|
3084
3204
|
key: "_update",
|
|
3085
3205
|
value: function _update(data) {
|
|
3206
|
+
var _data$medias2,
|
|
3207
|
+
_this2 = this,
|
|
3208
|
+
_this$state$medias2,
|
|
3209
|
+
_classPrivateMethodGe2,
|
|
3210
|
+
_this$state$media;
|
|
3211
|
+
|
|
3086
3212
|
var updateReasons = [];
|
|
3087
3213
|
|
|
3088
3214
|
if ((data.text || typeof data.text === "string") && data.text !== this.state.body) {
|
|
@@ -3117,7 +3243,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3117
3243
|
|
|
3118
3244
|
var updatedAttributes = parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(this.sid), log$3);
|
|
3119
3245
|
|
|
3120
|
-
if (!
|
|
3246
|
+
if (!isEqual(this.state.attributes, updatedAttributes)) {
|
|
3121
3247
|
this.state.attributes = updatedAttributes;
|
|
3122
3248
|
updateReasons.push("attributes");
|
|
3123
3249
|
}
|
|
@@ -3135,6 +3261,29 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3135
3261
|
|
|
3136
3262
|
updateReasons.push("deliveryReceipt");
|
|
3137
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");
|
|
3138
3287
|
}
|
|
3139
3288
|
|
|
3140
3289
|
if (updateReasons.length > 0) {
|
|
@@ -3152,9 +3301,9 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3152
3301
|
key: "getParticipant",
|
|
3153
3302
|
value: function () {
|
|
3154
3303
|
var _getParticipant = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
3155
|
-
var
|
|
3304
|
+
var _this3 = this;
|
|
3156
3305
|
|
|
3157
|
-
var participant,
|
|
3306
|
+
var participant, errorMessage;
|
|
3158
3307
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
3159
3308
|
while (1) {
|
|
3160
3309
|
switch (_context.prev = _context.next) {
|
|
@@ -3168,7 +3317,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3168
3317
|
|
|
3169
3318
|
_context.next = 4;
|
|
3170
3319
|
return this.conversation.getParticipantBySid(this.state.participantSid).catch(function () {
|
|
3171
|
-
log$3.debug("Participant with sid \"".concat(
|
|
3320
|
+
log$3.debug("Participant with sid \"".concat(_this3.participantSid, "\" not found for message ").concat(_this3.sid));
|
|
3172
3321
|
return null;
|
|
3173
3322
|
});
|
|
3174
3323
|
|
|
@@ -3183,7 +3332,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3183
3332
|
|
|
3184
3333
|
_context.next = 8;
|
|
3185
3334
|
return this.conversation.getParticipantByIdentity(this.state.author).catch(function () {
|
|
3186
|
-
log$3.debug("Participant with identity \"".concat(
|
|
3335
|
+
log$3.debug("Participant with identity \"".concat(_this3.author, "\" not found for message ").concat(_this3.sid));
|
|
3187
3336
|
return null;
|
|
3188
3337
|
});
|
|
3189
3338
|
|
|
@@ -3199,26 +3348,26 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3199
3348
|
return _context.abrupt("return", participant);
|
|
3200
3349
|
|
|
3201
3350
|
case 11:
|
|
3202
|
-
|
|
3351
|
+
errorMessage = "Participant with ";
|
|
3203
3352
|
|
|
3204
3353
|
if (this.state.participantSid) {
|
|
3205
|
-
|
|
3354
|
+
errorMessage += "SID '" + this.state.participantSid + "' ";
|
|
3206
3355
|
}
|
|
3207
3356
|
|
|
3208
3357
|
if (this.state.author) {
|
|
3209
3358
|
if (this.state.participantSid) {
|
|
3210
|
-
|
|
3359
|
+
errorMessage += "or ";
|
|
3211
3360
|
}
|
|
3212
3361
|
|
|
3213
|
-
|
|
3362
|
+
errorMessage += "identity '" + this.state.author + "' ";
|
|
3214
3363
|
}
|
|
3215
3364
|
|
|
3216
|
-
if (
|
|
3217
|
-
|
|
3365
|
+
if (errorMessage === "Participant with ") {
|
|
3366
|
+
errorMessage = "Participant ";
|
|
3218
3367
|
}
|
|
3219
3368
|
|
|
3220
|
-
|
|
3221
|
-
throw new Error(
|
|
3369
|
+
errorMessage += "was not found";
|
|
3370
|
+
throw new Error(errorMessage);
|
|
3222
3371
|
|
|
3223
3372
|
case 17:
|
|
3224
3373
|
case "end":
|
|
@@ -3398,7 +3547,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3398
3547
|
key: "attachTemporaryUrlsFor",
|
|
3399
3548
|
value: function () {
|
|
3400
3549
|
var _attachTemporaryUrlsFor = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(contentSet) {
|
|
3401
|
-
var
|
|
3550
|
+
var _this4 = this;
|
|
3402
3551
|
|
|
3403
3552
|
var sids;
|
|
3404
3553
|
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context6) {
|
|
@@ -3421,7 +3570,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3421
3570
|
|
|
3422
3571
|
case 4:
|
|
3423
3572
|
return _context6.abrupt("return", _context6.sent.map(function (item) {
|
|
3424
|
-
return new Media(item,
|
|
3573
|
+
return new Media(item, _this4.services);
|
|
3425
3574
|
}));
|
|
3426
3575
|
|
|
3427
3576
|
case 7:
|
|
@@ -3464,7 +3613,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3464
3613
|
}, {
|
|
3465
3614
|
key: "getTemporaryContentUrlsForMediaSids",
|
|
3466
3615
|
value: function getTemporaryContentUrlsForMediaSids(mediaSids) {
|
|
3467
|
-
var
|
|
3616
|
+
var _this5 = this;
|
|
3468
3617
|
|
|
3469
3618
|
return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
|
|
3470
3619
|
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7(resolve, reject, onCancel) {
|
|
@@ -3473,9 +3622,9 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3473
3622
|
while (1) {
|
|
3474
3623
|
switch (_context7.prev = _context7.next) {
|
|
3475
3624
|
case 0:
|
|
3476
|
-
mediaGetRequest =
|
|
3625
|
+
mediaGetRequest = _this5.services.mcsClient.mediaSetGetContentUrls(mediaSids !== null && mediaSids !== void 0 ? mediaSids : []);
|
|
3477
3626
|
|
|
3478
|
-
if (!(!
|
|
3627
|
+
if (!(!_this5.services.mcsClient || !mediaSids)) {
|
|
3479
3628
|
_context7.next = 4;
|
|
3480
3629
|
break;
|
|
3481
3630
|
}
|
|
@@ -3534,7 +3683,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3534
3683
|
key: "_getDetailedDeliveryReceiptsPaginator",
|
|
3535
3684
|
value: function () {
|
|
3536
3685
|
var _getDetailedDeliveryReceiptsPaginator2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8(options) {
|
|
3537
|
-
var
|
|
3686
|
+
var _this6 = this;
|
|
3538
3687
|
|
|
3539
3688
|
var messagesReceiptsUrl, url, response;
|
|
3540
3689
|
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context8) {
|
|
@@ -3551,7 +3700,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3551
3700
|
return _context8.abrupt("return", new RestPaginator(response.body.delivery_receipts.map(function (x) {
|
|
3552
3701
|
return new DetailedDeliveryReceipt(x);
|
|
3553
3702
|
}), function (pageToken, pageSize) {
|
|
3554
|
-
return
|
|
3703
|
+
return _this6._getDetailedDeliveryReceiptsPaginator({
|
|
3555
3704
|
pageToken: pageToken,
|
|
3556
3705
|
pageSize: pageSize
|
|
3557
3706
|
});
|
|
@@ -3579,7 +3728,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3579
3728
|
}, {
|
|
3580
3729
|
key: "getContentData",
|
|
3581
3730
|
value: function getContentData() {
|
|
3582
|
-
var
|
|
3731
|
+
var _this7 = this;
|
|
3583
3732
|
|
|
3584
3733
|
return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
|
|
3585
3734
|
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9(resolve, reject, onCancel) {
|
|
@@ -3588,7 +3737,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3588
3737
|
while (1) {
|
|
3589
3738
|
switch (_context9.prev = _context9.next) {
|
|
3590
3739
|
case 0:
|
|
3591
|
-
if (!(
|
|
3740
|
+
if (!(_this7.state.contentSid === null)) {
|
|
3592
3741
|
_context9.next = 3;
|
|
3593
3742
|
break;
|
|
3594
3743
|
}
|
|
@@ -3597,7 +3746,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3597
3746
|
return _context9.abrupt("return");
|
|
3598
3747
|
|
|
3599
3748
|
case 3:
|
|
3600
|
-
bodies =
|
|
3749
|
+
bodies = _this7.getMediaByCategories(["body"]);
|
|
3601
3750
|
|
|
3602
3751
|
if (!(bodies === null)) {
|
|
3603
3752
|
_context9.next = 7;
|
|
@@ -3753,11 +3902,65 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3753
3902
|
|
|
3754
3903
|
return getChannelMetadata;
|
|
3755
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
|
+
}()
|
|
3756
3937
|
}]);
|
|
3757
3938
|
|
|
3758
3939
|
return Message;
|
|
3759
3940
|
}(replayEventEmitter.ReplayEventEmitter);
|
|
3760
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
|
+
|
|
3761
3964
|
_defineProperty__default["default"](Message, "updated", "updated");
|
|
3762
3965
|
|
|
3763
3966
|
__decorate([deprecationDecorator.deprecated("getMediaByCategory", "getMediaByCategories"), __metadata("design:type", Function), __metadata("design:paramtypes", [Array]), __metadata("design:returntype", Array)], Message.prototype, "getMediaByCategory", null);
|
|
@@ -3780,11 +3983,11 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
3780
3983
|
|
|
3781
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; }
|
|
3782
3985
|
|
|
3783
|
-
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; } } }; }
|
|
3784
3987
|
|
|
3785
|
-
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); }
|
|
3786
3989
|
|
|
3787
|
-
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; }
|
|
3788
3991
|
|
|
3789
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); }; }
|
|
3790
3993
|
|
|
@@ -3992,7 +4195,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
3992
4195
|
return request.cancel();
|
|
3993
4196
|
});
|
|
3994
4197
|
});
|
|
3995
|
-
_iterator = _createForOfIteratorHelper$
|
|
4198
|
+
_iterator = _createForOfIteratorHelper$4(message.mediaContent);
|
|
3996
4199
|
_context3.prev = 4;
|
|
3997
4200
|
|
|
3998
4201
|
_iterator.s();
|
|
@@ -4645,11 +4848,11 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
|
|
|
4645
4848
|
|
|
4646
4849
|
__decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
|
|
4647
4850
|
|
|
4648
|
-
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; } } }; }
|
|
4649
4852
|
|
|
4650
|
-
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); }
|
|
4651
4854
|
|
|
4652
|
-
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; }
|
|
4653
4856
|
|
|
4654
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); }; }
|
|
4655
4858
|
|
|
@@ -4786,6 +4989,68 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4786
4989
|
* Logger instance.
|
|
4787
4990
|
*/
|
|
4788
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
|
+
|
|
4789
5054
|
/**
|
|
4790
5055
|
* @param descriptor Conversation descriptor.
|
|
4791
5056
|
* @param sid Conversation SID.
|
|
@@ -4827,32 +5092,39 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4827
5092
|
participants: _this._links.participants
|
|
4828
5093
|
};
|
|
4829
5094
|
_this._participants = new Map();
|
|
4830
|
-
_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);
|
|
4831
5097
|
|
|
4832
|
-
_this._participantsEntity.on(
|
|
4833
|
-
return
|
|
5098
|
+
_this._participantsEntity.on(Conversation.participantJoined, function (participant) {
|
|
5099
|
+
return (// @todo update participants map here??
|
|
5100
|
+
_this.emit(Conversation.participantJoined, participant)
|
|
5101
|
+
);
|
|
4834
5102
|
});
|
|
4835
5103
|
|
|
4836
|
-
_this._participantsEntity.on(
|
|
4837
|
-
return
|
|
5104
|
+
_this._participantsEntity.on(Conversation.participantLeft, function (participant) {
|
|
5105
|
+
return (// @todo update participants map here??
|
|
5106
|
+
_this.emit(Conversation.participantLeft, participant)
|
|
5107
|
+
);
|
|
4838
5108
|
});
|
|
4839
5109
|
|
|
4840
|
-
_this._participantsEntity.on(
|
|
4841
|
-
return
|
|
5110
|
+
_this._participantsEntity.on(Conversation.participantUpdated, function (args) {
|
|
5111
|
+
return (// @todo update participants map here??
|
|
5112
|
+
_this.emit(Conversation.participantUpdated, args)
|
|
5113
|
+
);
|
|
4842
5114
|
});
|
|
4843
5115
|
|
|
4844
5116
|
_this._messagesEntity = new Messages(_assertThisInitialized__default["default"](_this), configuration, services);
|
|
4845
5117
|
|
|
4846
|
-
_this._messagesEntity.on(
|
|
5118
|
+
_this._messagesEntity.on(Conversation.messageAdded, function (message) {
|
|
4847
5119
|
return _this._onMessageAdded(message);
|
|
4848
5120
|
});
|
|
4849
5121
|
|
|
4850
|
-
_this._messagesEntity.on(
|
|
4851
|
-
return _this.emit(
|
|
5122
|
+
_this._messagesEntity.on(Conversation.messageUpdated, function (args) {
|
|
5123
|
+
return _this.emit(Conversation.messageUpdated, args);
|
|
4852
5124
|
});
|
|
4853
5125
|
|
|
4854
|
-
_this._messagesEntity.on(
|
|
4855
|
-
return _this.emit(
|
|
5126
|
+
_this._messagesEntity.on(Conversation.messageRemoved, function (message) {
|
|
5127
|
+
return _this.emit(Conversation.messageRemoved, message);
|
|
4856
5128
|
});
|
|
4857
5129
|
|
|
4858
5130
|
return _this;
|
|
@@ -4955,7 +5227,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4955
5227
|
return (_this$_internalState$3 = this._internalState.notificationLevel) !== null && _this$_internalState$3 !== void 0 ? _this$_internalState$3 : "default";
|
|
4956
5228
|
}
|
|
4957
5229
|
/**
|
|
4958
|
-
* Conversation bindings.
|
|
5230
|
+
* Conversation bindings. An undocumented feature (for now).
|
|
4959
5231
|
* @internal
|
|
4960
5232
|
*/
|
|
4961
5233
|
|
|
@@ -5935,74 +6207,107 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
5935
6207
|
|
|
5936
6208
|
return updateUniqueName;
|
|
5937
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
|
+
}()
|
|
5938
6243
|
/**
|
|
5939
6244
|
* Load and subscribe to this conversation and do not subscribe to its
|
|
5940
6245
|
* participants and messages. This or _subscribeStreams will need to be called
|
|
5941
|
-
* before any events
|
|
6246
|
+
* before any events in the conversation will fire.
|
|
5942
6247
|
* @internal
|
|
5943
6248
|
*/
|
|
5944
6249
|
|
|
5945
6250
|
}, {
|
|
5946
6251
|
key: "_subscribe",
|
|
5947
6252
|
value: function () {
|
|
5948
|
-
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6253
|
+
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee25() {
|
|
5949
6254
|
var _this2 = this;
|
|
5950
6255
|
|
|
5951
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6256
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
|
|
5952
6257
|
while (1) {
|
|
5953
|
-
switch (
|
|
6258
|
+
switch (_context25.prev = _context25.next) {
|
|
5954
6259
|
case 0:
|
|
5955
6260
|
if (!this._entityPromise) {
|
|
5956
|
-
|
|
6261
|
+
_context25.next = 2;
|
|
5957
6262
|
break;
|
|
5958
6263
|
}
|
|
5959
6264
|
|
|
5960
|
-
return
|
|
6265
|
+
return _context25.abrupt("return", this._entityPromise);
|
|
5961
6266
|
|
|
5962
6267
|
case 2:
|
|
5963
6268
|
this._entityPromise = this._services.syncClient.document({
|
|
5964
6269
|
id: this._entityName,
|
|
5965
6270
|
mode: "open_existing"
|
|
5966
6271
|
});
|
|
5967
|
-
|
|
5968
|
-
|
|
6272
|
+
_context25.prev = 3;
|
|
6273
|
+
_context25.next = 6;
|
|
5969
6274
|
return this._entityPromise;
|
|
5970
6275
|
|
|
5971
6276
|
case 6:
|
|
5972
|
-
this._entity =
|
|
6277
|
+
this._entity = _context25.sent;
|
|
5973
6278
|
|
|
5974
|
-
this._entity.on(
|
|
6279
|
+
this._entity.on(twilioSync.SyncDocument.updated, function (args) {
|
|
5975
6280
|
return _this2._update(args.data);
|
|
5976
6281
|
});
|
|
5977
6282
|
|
|
5978
|
-
this._entity.on(
|
|
5979
|
-
return _this2.emit(
|
|
6283
|
+
this._entity.on(twilioSync.SyncDocument.removed, function () {
|
|
6284
|
+
return _this2.emit(Conversation.removed, _this2);
|
|
5980
6285
|
});
|
|
5981
6286
|
|
|
5982
6287
|
this._update(this._entity.data);
|
|
5983
6288
|
|
|
5984
|
-
return
|
|
6289
|
+
return _context25.abrupt("return", this._entity);
|
|
5985
6290
|
|
|
5986
6291
|
case 13:
|
|
5987
|
-
|
|
5988
|
-
|
|
6292
|
+
_context25.prev = 13;
|
|
6293
|
+
_context25.t0 = _context25["catch"](3);
|
|
5989
6294
|
this._entity = null;
|
|
5990
6295
|
this._entityPromise = null;
|
|
5991
6296
|
|
|
5992
6297
|
if (this._services.syncClient.connectionState != "disconnected") {
|
|
5993
|
-
Conversation._logger.error("Failed to get conversation object",
|
|
6298
|
+
Conversation._logger.error("Failed to get conversation object", _context25.t0);
|
|
5994
6299
|
}
|
|
5995
6300
|
|
|
5996
|
-
Conversation._logger.debug("ERROR: Failed to get conversation object",
|
|
6301
|
+
Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
|
|
5997
6302
|
|
|
5998
|
-
throw
|
|
6303
|
+
throw _context25.t0;
|
|
5999
6304
|
|
|
6000
6305
|
case 20:
|
|
6001
6306
|
case "end":
|
|
6002
|
-
return
|
|
6307
|
+
return _context25.stop();
|
|
6003
6308
|
}
|
|
6004
6309
|
}
|
|
6005
|
-
},
|
|
6310
|
+
}, _callee25, this, [[3, 13]]);
|
|
6006
6311
|
}));
|
|
6007
6312
|
|
|
6008
6313
|
function _subscribe() {
|
|
@@ -6024,44 +6329,95 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6024
6329
|
}, {
|
|
6025
6330
|
key: "_fetchStreams",
|
|
6026
6331
|
value: function () {
|
|
6027
|
-
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6028
|
-
var
|
|
6332
|
+
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
|
|
6333
|
+
var _this3 = this;
|
|
6029
6334
|
|
|
6030
|
-
|
|
6031
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
|
|
6335
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
|
|
6032
6336
|
while (1) {
|
|
6033
|
-
switch (
|
|
6337
|
+
switch (_context27.prev = _context27.next) {
|
|
6034
6338
|
case 0:
|
|
6035
|
-
|
|
6036
|
-
|
|
6339
|
+
if (!this._streamsPromise) {
|
|
6340
|
+
_context27.next = 2;
|
|
6341
|
+
break;
|
|
6342
|
+
}
|
|
6037
6343
|
|
|
6038
|
-
|
|
6039
|
-
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);
|
|
6040
6345
|
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
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;
|
|
6047
6363
|
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
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
|
+
}));
|
|
6055
6405
|
|
|
6056
|
-
|
|
6057
|
-
|
|
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
|
+
}));
|
|
6058
6414
|
|
|
6059
|
-
case
|
|
6415
|
+
case 4:
|
|
6060
6416
|
case "end":
|
|
6061
|
-
return
|
|
6417
|
+
return _context27.stop();
|
|
6062
6418
|
}
|
|
6063
6419
|
}
|
|
6064
|
-
},
|
|
6420
|
+
}, _callee27, this);
|
|
6065
6421
|
}));
|
|
6066
6422
|
|
|
6067
6423
|
function _fetchStreams() {
|
|
@@ -6081,48 +6437,48 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6081
6437
|
}, {
|
|
6082
6438
|
key: "_subscribeStreams",
|
|
6083
6439
|
value: function () {
|
|
6084
|
-
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6085
|
-
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;
|
|
6086
6442
|
|
|
6087
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6443
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
|
|
6088
6444
|
while (1) {
|
|
6089
|
-
switch (
|
|
6445
|
+
switch (_context28.prev = _context28.next) {
|
|
6090
6446
|
case 0:
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
return this.
|
|
6447
|
+
_context28.prev = 0;
|
|
6448
|
+
_context28.next = 3;
|
|
6449
|
+
return this._fetchStreams();
|
|
6094
6450
|
|
|
6095
6451
|
case 3:
|
|
6096
|
-
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);
|
|
6097
6453
|
|
|
6098
|
-
data = (_this$
|
|
6454
|
+
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
|
6099
6455
|
messagesObjectName = data.messages;
|
|
6100
6456
|
rosterObjectName = data.roster;
|
|
6101
|
-
|
|
6457
|
+
_context28.next = 9;
|
|
6102
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)]);
|
|
6103
6459
|
|
|
6104
6460
|
case 9:
|
|
6105
|
-
|
|
6461
|
+
_context28.next = 16;
|
|
6106
6462
|
break;
|
|
6107
6463
|
|
|
6108
6464
|
case 11:
|
|
6109
|
-
|
|
6110
|
-
|
|
6465
|
+
_context28.prev = 11;
|
|
6466
|
+
_context28.t0 = _context28["catch"](0);
|
|
6111
6467
|
|
|
6112
6468
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
|
6113
|
-
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);
|
|
6114
6470
|
}
|
|
6115
6471
|
|
|
6116
|
-
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);
|
|
6117
6473
|
|
|
6118
|
-
throw
|
|
6474
|
+
throw _context28.t0;
|
|
6119
6475
|
|
|
6120
6476
|
case 16:
|
|
6121
6477
|
case "end":
|
|
6122
|
-
return
|
|
6478
|
+
return _context28.stop();
|
|
6123
6479
|
}
|
|
6124
6480
|
}
|
|
6125
|
-
},
|
|
6481
|
+
}, _callee28, this, [[0, 11]]);
|
|
6126
6482
|
}));
|
|
6127
6483
|
|
|
6128
6484
|
function _subscribeStreams() {
|
|
@@ -6139,32 +6495,26 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6139
6495
|
}, {
|
|
6140
6496
|
key: "_unsubscribe",
|
|
6141
6497
|
value: function () {
|
|
6142
|
-
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6143
|
-
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) {
|
|
6144
6500
|
while (1) {
|
|
6145
|
-
switch (
|
|
6501
|
+
switch (_context29.prev = _context29.next) {
|
|
6146
6502
|
case 0:
|
|
6147
|
-
if (
|
|
6148
|
-
|
|
6149
|
-
break;
|
|
6150
|
-
}
|
|
6503
|
+
if (this._entity) {
|
|
6504
|
+
this._entity.close();
|
|
6151
6505
|
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
case 3:
|
|
6156
|
-
this._entity = null;
|
|
6157
|
-
this._entityPromise = null;
|
|
6506
|
+
this._entity = null;
|
|
6507
|
+
this._entityPromise = null;
|
|
6508
|
+
}
|
|
6158
6509
|
|
|
6159
|
-
|
|
6160
|
-
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()]));
|
|
6161
6511
|
|
|
6162
|
-
case
|
|
6512
|
+
case 2:
|
|
6163
6513
|
case "end":
|
|
6164
|
-
return
|
|
6514
|
+
return _context29.stop();
|
|
6165
6515
|
}
|
|
6166
6516
|
}
|
|
6167
|
-
},
|
|
6517
|
+
}, _callee29, this);
|
|
6168
6518
|
}));
|
|
6169
6519
|
|
|
6170
6520
|
function _unsubscribe() {
|
|
@@ -6181,7 +6531,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6181
6531
|
}, {
|
|
6182
6532
|
key: "_setStatus",
|
|
6183
6533
|
value: function _setStatus(status, source) {
|
|
6184
|
-
var
|
|
6534
|
+
var _this4 = this;
|
|
6185
6535
|
|
|
6186
6536
|
this._dataSource = source;
|
|
6187
6537
|
|
|
@@ -6195,7 +6545,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6195
6545
|
this._subscribeStreams().catch(function (err) {
|
|
6196
6546
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6197
6547
|
|
|
6198
|
-
if (
|
|
6548
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6199
6549
|
throw err;
|
|
6200
6550
|
}
|
|
6201
6551
|
});
|
|
@@ -6207,7 +6557,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6207
6557
|
this._unsubscribe().catch(function (err) {
|
|
6208
6558
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6209
6559
|
|
|
6210
|
-
if (
|
|
6560
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6211
6561
|
throw err;
|
|
6212
6562
|
}
|
|
6213
6563
|
});
|
|
@@ -6247,7 +6597,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6247
6597
|
break;
|
|
6248
6598
|
|
|
6249
6599
|
case fieldMappings.attributes:
|
|
6250
|
-
if (
|
|
6600
|
+
if (isEqual(this._internalState.attributes, update.attributes)) {
|
|
6251
6601
|
break;
|
|
6252
6602
|
}
|
|
6253
6603
|
|
|
@@ -6283,7 +6633,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6283
6633
|
updateReasons.add(localKey);
|
|
6284
6634
|
}
|
|
6285
6635
|
|
|
6286
|
-
if (
|
|
6636
|
+
if (isEqual(this._internalState.lastMessage, {})) {
|
|
6287
6637
|
delete this._internalState.lastMessage;
|
|
6288
6638
|
}
|
|
6289
6639
|
|
|
@@ -6296,7 +6646,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6296
6646
|
state.dateUpdated = new Date(state.dateUpdated);
|
|
6297
6647
|
}
|
|
6298
6648
|
|
|
6299
|
-
if (
|
|
6649
|
+
if (isEqual(this._internalState.state, state)) {
|
|
6300
6650
|
break;
|
|
6301
6651
|
}
|
|
6302
6652
|
|
|
@@ -6305,7 +6655,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6305
6655
|
break;
|
|
6306
6656
|
|
|
6307
6657
|
case fieldMappings.bindings:
|
|
6308
|
-
if (
|
|
6658
|
+
if (isEqual(this._internalState.bindings, update.bindings)) {
|
|
6309
6659
|
break;
|
|
6310
6660
|
}
|
|
6311
6661
|
|
|
@@ -6328,7 +6678,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6328
6678
|
}
|
|
6329
6679
|
|
|
6330
6680
|
if (updateReasons.size > 0) {
|
|
6331
|
-
this.emit(
|
|
6681
|
+
this.emit(Conversation.updated, {
|
|
6332
6682
|
conversation: this,
|
|
6333
6683
|
updateReasons: _toConsumableArray__default["default"](updateReasons)
|
|
6334
6684
|
});
|
|
@@ -6341,7 +6691,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6341
6691
|
}, {
|
|
6342
6692
|
key: "_onMessageAdded",
|
|
6343
6693
|
value: function _onMessageAdded(message) {
|
|
6344
|
-
var _iterator = _createForOfIteratorHelper$
|
|
6694
|
+
var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
|
|
6345
6695
|
_step;
|
|
6346
6696
|
|
|
6347
6697
|
try {
|
|
@@ -6360,7 +6710,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6360
6710
|
_iterator.f();
|
|
6361
6711
|
}
|
|
6362
6712
|
|
|
6363
|
-
this.emit(
|
|
6713
|
+
this.emit(Conversation.messageAdded, message);
|
|
6364
6714
|
}
|
|
6365
6715
|
/**
|
|
6366
6716
|
* Set last read message index.
|
|
@@ -6370,30 +6720,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6370
6720
|
}, {
|
|
6371
6721
|
key: "_setLastReadMessageIndex",
|
|
6372
6722
|
value: function () {
|
|
6373
|
-
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) {
|
|
6374
6724
|
var result;
|
|
6375
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6725
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee30$(_context30) {
|
|
6376
6726
|
while (1) {
|
|
6377
|
-
switch (
|
|
6727
|
+
switch (_context30.prev = _context30.next) {
|
|
6378
6728
|
case 0:
|
|
6379
|
-
|
|
6729
|
+
_context30.next = 2;
|
|
6380
6730
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
|
6381
6731
|
last_read_message_index: index
|
|
6382
6732
|
});
|
|
6383
6733
|
|
|
6384
6734
|
case 2:
|
|
6385
|
-
result =
|
|
6386
|
-
return
|
|
6735
|
+
result = _context30.sent;
|
|
6736
|
+
return _context30.abrupt("return", result.unread_messages_count);
|
|
6387
6737
|
|
|
6388
6738
|
case 4:
|
|
6389
6739
|
case "end":
|
|
6390
|
-
return
|
|
6740
|
+
return _context30.stop();
|
|
6391
6741
|
}
|
|
6392
6742
|
}
|
|
6393
|
-
},
|
|
6743
|
+
}, _callee30, this);
|
|
6394
6744
|
}));
|
|
6395
6745
|
|
|
6396
|
-
function _setLastReadMessageIndex(
|
|
6746
|
+
function _setLastReadMessageIndex(_x22) {
|
|
6397
6747
|
return _setLastReadMessageIndex2.apply(this, arguments);
|
|
6398
6748
|
}
|
|
6399
6749
|
|
|
@@ -6473,7 +6823,7 @@ _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conve
|
|
|
6473
6823
|
|
|
6474
6824
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
|
|
6475
6825
|
|
|
6476
|
-
__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);
|
|
6477
6827
|
|
|
6478
6828
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
|
|
6479
6829
|
|
|
@@ -6549,11 +6899,11 @@ var Deferred = /*#__PURE__*/function () {
|
|
|
6549
6899
|
return Deferred;
|
|
6550
6900
|
}();
|
|
6551
6901
|
|
|
6552
|
-
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; } } }; }
|
|
6553
6903
|
|
|
6554
|
-
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); }
|
|
6555
6905
|
|
|
6556
|
-
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; }
|
|
6557
6907
|
|
|
6558
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; }
|
|
6559
6909
|
|
|
@@ -6609,6 +6959,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6609
6959
|
return this.services.commandExecutor.mutateResource("post", this.configuration.links.conversations, {
|
|
6610
6960
|
friendly_name: options.friendlyName,
|
|
6611
6961
|
unique_name: options.uniqueName,
|
|
6962
|
+
access: options.access,
|
|
6612
6963
|
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
|
|
6613
6964
|
});
|
|
6614
6965
|
|
|
@@ -6670,7 +7021,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6670
7021
|
return addConversation;
|
|
6671
7022
|
}()
|
|
6672
7023
|
/**
|
|
6673
|
-
* Fetch conversations list and instantiate all necessary objects
|
|
7024
|
+
* Fetch conversations' list and instantiate all necessary objects
|
|
6674
7025
|
*/
|
|
6675
7026
|
|
|
6676
7027
|
}, {
|
|
@@ -6691,12 +7042,12 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6691
7042
|
|
|
6692
7043
|
case 3:
|
|
6693
7044
|
map = _context2.sent;
|
|
6694
|
-
map.on(
|
|
7045
|
+
map.on(twilioSync.SyncMap.itemAdded, function (args) {
|
|
6695
7046
|
log$1.debug("itemAdded: ".concat(args.item.key));
|
|
6696
7047
|
|
|
6697
7048
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
|
6698
7049
|
});
|
|
6699
|
-
map.on(
|
|
7050
|
+
map.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
|
6700
7051
|
log$1.debug("itemRemoved: ".concat(args.key));
|
|
6701
7052
|
var sid = args.key;
|
|
6702
7053
|
|
|
@@ -6722,7 +7073,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6722
7073
|
|
|
6723
7074
|
conversation.emit("removed", conversation);
|
|
6724
7075
|
});
|
|
6725
|
-
map.on(
|
|
7076
|
+
map.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
|
6726
7077
|
log$1.debug("itemUpdated: ".concat(args.item.key));
|
|
6727
7078
|
|
|
6728
7079
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
|
@@ -6733,7 +7084,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6733
7084
|
case 9:
|
|
6734
7085
|
myConversations = _context2.sent;
|
|
6735
7086
|
upserts = [];
|
|
6736
|
-
_iterator = _createForOfIteratorHelper$
|
|
7087
|
+
_iterator = _createForOfIteratorHelper$2(myConversations);
|
|
6737
7088
|
|
|
6738
7089
|
try {
|
|
6739
7090
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
@@ -6893,6 +7244,8 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6893
7244
|
createdBy: body.created_by,
|
|
6894
7245
|
attributes: body.attributes,
|
|
6895
7246
|
channel: body.sync_objects.conversation,
|
|
7247
|
+
roster: body.sync_objects.participants,
|
|
7248
|
+
messages: body.sync_objects.messages,
|
|
6896
7249
|
notificationLevel: body === null || body === void 0 ? void 0 : body.notification_level,
|
|
6897
7250
|
sid: sid
|
|
6898
7251
|
};
|
|
@@ -6938,8 +7291,10 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6938
7291
|
uniqueName: body.unique_name,
|
|
6939
7292
|
createdBy: body.created_by,
|
|
6940
7293
|
attributes: body.attributes,
|
|
6941
|
-
channel: "".concat(sid, ".channel"),
|
|
6942
|
-
|
|
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,
|
|
6943
7298
|
sid: sid
|
|
6944
7299
|
};
|
|
6945
7300
|
return _context6.abrupt("return", this._upsertConversation("sync", sid, data));
|
|
@@ -7079,7 +7434,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
7079
7434
|
updateData.lastConsumedMessageIndex = data.lastConsumedMessageIndex;
|
|
7080
7435
|
}
|
|
7081
7436
|
|
|
7082
|
-
if (!
|
|
7437
|
+
if (!isEqual(updateData, {})) {
|
|
7083
7438
|
conversation._update(updateData);
|
|
7084
7439
|
}
|
|
7085
7440
|
|
|
@@ -7276,7 +7631,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
7276
7631
|
status: conversationDescriptor.status,
|
|
7277
7632
|
channel: conversationDescriptor.sync_objects.conversation,
|
|
7278
7633
|
messages: conversationDescriptor.sync_objects.messages,
|
|
7279
|
-
roster: "".concat(conversationDescriptor.conversation_sid, ".roster"),
|
|
7634
|
+
roster: conversationDescriptor.sync_objects.participants || "".concat(conversationDescriptor.conversation_sid, ".roster"),
|
|
7280
7635
|
lastConsumedMessageIndex: conversationDescriptor.last_read_message_index,
|
|
7281
7636
|
notificationLevel: conversationDescriptor.notification_level
|
|
7282
7637
|
};
|
|
@@ -7699,7 +8054,7 @@ var TypingIndicator = /*#__PURE__*/function () {
|
|
|
7699
8054
|
}
|
|
7700
8055
|
|
|
7701
8056
|
conversation._participants.forEach(function (participant) {
|
|
7702
|
-
if (participant.identity !== message.identity) {
|
|
8057
|
+
if (participant.identity !== message.identity && participant.type !== "apple") {
|
|
7703
8058
|
return;
|
|
7704
8059
|
}
|
|
7705
8060
|
|
|
@@ -7815,7 +8170,15 @@ function PushNotification(data) {
|
|
|
7815
8170
|
this.data = data.data || {};
|
|
7816
8171
|
});
|
|
7817
8172
|
|
|
7818
|
-
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
|
+
};
|
|
7819
8182
|
|
|
7820
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; }
|
|
7821
8184
|
|
|
@@ -7824,6 +8187,7 @@ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
7824
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); }; }
|
|
7825
8188
|
|
|
7826
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;
|
|
7827
8191
|
|
|
7828
8192
|
var trimSlashes = function trimSlashes(url) {
|
|
7829
8193
|
return url.replace(/(^\/+|\/+$)/g, "");
|
|
@@ -8048,7 +8412,7 @@ var CommandExecutor = /*#__PURE__*/function () {
|
|
|
8048
8412
|
case 0:
|
|
8049
8413
|
_context4.next = 2;
|
|
8050
8414
|
return this._makeRequest(method, url, requestBody, {
|
|
8051
|
-
"X-Twilio-Mutation-Id":
|
|
8415
|
+
"X-Twilio-Mutation-Id": uuidv4()
|
|
8052
8416
|
});
|
|
8053
8417
|
|
|
8054
8418
|
case 2:
|
|
@@ -8216,11 +8580,11 @@ var ContentClient = /*#__PURE__*/function () {
|
|
|
8216
8580
|
return ContentClient;
|
|
8217
8581
|
}();
|
|
8218
8582
|
|
|
8219
|
-
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; } } }; }
|
|
8220
8584
|
|
|
8221
|
-
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); }
|
|
8222
8586
|
|
|
8223
|
-
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; }
|
|
8224
8588
|
|
|
8225
8589
|
var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8226
8590
|
function QuickLRU() {
|
|
@@ -8249,7 +8613,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8249
8613
|
this._size = 0;
|
|
8250
8614
|
|
|
8251
8615
|
if (typeof this.onEviction === 'function') {
|
|
8252
|
-
var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
|
|
8616
|
+
var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
|
|
8253
8617
|
_step;
|
|
8254
8618
|
|
|
8255
8619
|
try {
|
|
@@ -8341,7 +8705,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8341
8705
|
while (1) {
|
|
8342
8706
|
switch (_context.prev = _context.next) {
|
|
8343
8707
|
case 0:
|
|
8344
|
-
_iterator2 = _createForOfIteratorHelper(this);
|
|
8708
|
+
_iterator2 = _createForOfIteratorHelper$1(this);
|
|
8345
8709
|
_context.prev = 1;
|
|
8346
8710
|
|
|
8347
8711
|
_iterator2.s();
|
|
@@ -8393,7 +8757,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8393
8757
|
while (1) {
|
|
8394
8758
|
switch (_context2.prev = _context2.next) {
|
|
8395
8759
|
case 0:
|
|
8396
|
-
_iterator3 = _createForOfIteratorHelper(this);
|
|
8760
|
+
_iterator3 = _createForOfIteratorHelper$1(this);
|
|
8397
8761
|
_context2.prev = 1;
|
|
8398
8762
|
|
|
8399
8763
|
_iterator3.s();
|
|
@@ -8445,7 +8809,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8445
8809
|
while (1) {
|
|
8446
8810
|
switch (_context3.prev = _context3.next) {
|
|
8447
8811
|
case 0:
|
|
8448
|
-
_iterator4 = _createForOfIteratorHelper(this.cache);
|
|
8812
|
+
_iterator4 = _createForOfIteratorHelper$1(this.cache);
|
|
8449
8813
|
_context3.prev = 1;
|
|
8450
8814
|
|
|
8451
8815
|
_iterator4.s();
|
|
@@ -8482,7 +8846,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8482
8846
|
return _context3.finish(14);
|
|
8483
8847
|
|
|
8484
8848
|
case 17:
|
|
8485
|
-
_iterator5 = _createForOfIteratorHelper(this.oldCache);
|
|
8849
|
+
_iterator5 = _createForOfIteratorHelper$1(this.oldCache);
|
|
8486
8850
|
_context3.prev = 18;
|
|
8487
8851
|
|
|
8488
8852
|
_iterator5.s();
|
|
@@ -8537,7 +8901,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
|
8537
8901
|
get: function get() {
|
|
8538
8902
|
var oldCacheSize = 0;
|
|
8539
8903
|
|
|
8540
|
-
var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
|
|
8904
|
+
var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
|
|
8541
8905
|
_step6;
|
|
8542
8906
|
|
|
8543
8907
|
try {
|
|
@@ -8674,6 +9038,222 @@ var ChannelMetadataClient = /*#__PURE__*/function () {
|
|
|
8674
9038
|
return ChannelMetadataClient;
|
|
8675
9039
|
}();
|
|
8676
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
|
+
|
|
8677
9257
|
var _class;
|
|
8678
9258
|
|
|
8679
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; }
|
|
@@ -8942,7 +9522,47 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
8942
9522
|
*/
|
|
8943
9523
|
|
|
8944
9524
|
/**
|
|
8945
|
-
*
|
|
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
|
|
8946
9566
|
* operations will block until it is. Use connection events to monitor when
|
|
8947
9567
|
* client becomes fully available (connectionStateChanged with state
|
|
8948
9568
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
|
@@ -9032,16 +9652,16 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9032
9652
|
|
|
9033
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);
|
|
9034
9654
|
|
|
9035
|
-
_this._services.twilsockClient.on(
|
|
9036
|
-
return _this.emit(
|
|
9655
|
+
_this._services.twilsockClient.on(Client_1.tokenAboutToExpire, function () {
|
|
9656
|
+
return _this.emit(Client_1.tokenAboutToExpire);
|
|
9037
9657
|
});
|
|
9038
9658
|
|
|
9039
|
-
_this._services.twilsockClient.on(
|
|
9040
|
-
return _this.emit(
|
|
9659
|
+
_this._services.twilsockClient.on(Client_1.tokenExpired, function () {
|
|
9660
|
+
return _this.emit(Client_1.tokenExpired);
|
|
9041
9661
|
});
|
|
9042
9662
|
|
|
9043
|
-
_this._services.twilsockClient.on(
|
|
9044
|
-
return _this.emit(
|
|
9663
|
+
_this._services.twilsockClient.on(Client_1.connectionError, function (error) {
|
|
9664
|
+
return _this.emit(Client_1.connectionError, error);
|
|
9045
9665
|
});
|
|
9046
9666
|
|
|
9047
9667
|
_this._services.twilsockClient.on("stateChanged", function (state) {
|
|
@@ -9050,7 +9670,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9050
9670
|
if (state !== _this.connectionState) {
|
|
9051
9671
|
_this.connectionState = state;
|
|
9052
9672
|
|
|
9053
|
-
_this.emit(
|
|
9673
|
+
_this.emit(Client_1.connectionStateChanged, _this.connectionState);
|
|
9054
9674
|
}
|
|
9055
9675
|
});
|
|
9056
9676
|
|
|
@@ -9068,9 +9688,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9068
9688
|
var emitFailed = function emitFailed(error) {
|
|
9069
9689
|
_this._rejectEnsureReady(error);
|
|
9070
9690
|
|
|
9071
|
-
_this.emit(
|
|
9691
|
+
_this.emit(Client_1.stateChanged, "failed");
|
|
9072
9692
|
|
|
9073
|
-
_this.emit(
|
|
9693
|
+
_this.emit(Client_1.initFailed, {
|
|
9074
9694
|
error: error
|
|
9075
9695
|
});
|
|
9076
9696
|
};
|
|
@@ -9080,6 +9700,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9080
9700
|
terminal: true,
|
|
9081
9701
|
message: "Twilsock has disconnected."
|
|
9082
9702
|
});
|
|
9703
|
+
|
|
9704
|
+
_this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
|
|
9083
9705
|
};
|
|
9084
9706
|
|
|
9085
9707
|
_this._services.twilsockClient.once("connectionError", emitFailed);
|
|
@@ -9123,9 +9745,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9123
9745
|
|
|
9124
9746
|
_this._rejectEnsureReady(connectionError);
|
|
9125
9747
|
|
|
9126
|
-
_this.emit(
|
|
9748
|
+
_this.emit(Client_1.stateChanged, "failed");
|
|
9127
9749
|
|
|
9128
|
-
_this.emit(
|
|
9750
|
+
_this.emit(Client_1.initFailed, {
|
|
9129
9751
|
error: connectionError
|
|
9130
9752
|
});
|
|
9131
9753
|
|
|
@@ -9137,12 +9759,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9137
9759
|
}, _callee, null, [[3, 11]]);
|
|
9138
9760
|
})));
|
|
9139
9761
|
|
|
9140
|
-
_this.
|
|
9141
|
-
_this._resolveEnsureReady = resolve;
|
|
9142
|
-
_this._rejectEnsureReady = reject;
|
|
9143
|
-
}).catch(function () {
|
|
9144
|
-
return void 0;
|
|
9145
|
-
}); // @todo How to process unhandled rejection here?
|
|
9762
|
+
_this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
|
|
9146
9763
|
|
|
9147
9764
|
if (startTwilsock) {
|
|
9148
9765
|
_this._services.twilsockClient.connect();
|
|
@@ -9367,7 +9984,6 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9367
9984
|
/**
|
|
9368
9985
|
* Peek a conversation by its SID.
|
|
9369
9986
|
* @param conversationSid Conversation sid
|
|
9370
|
-
* @internal
|
|
9371
9987
|
*/
|
|
9372
9988
|
|
|
9373
9989
|
}, {
|
|
@@ -9653,7 +10269,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9653
10269
|
return removePushRegistrations;
|
|
9654
10270
|
}()
|
|
9655
10271
|
/**
|
|
9656
|
-
*
|
|
10272
|
+
* Parse a push notification payload.
|
|
9657
10273
|
*/
|
|
9658
10274
|
|
|
9659
10275
|
}, {
|
|
@@ -9895,6 +10511,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9895
10511
|
configurationResponse = _context17.sent;
|
|
9896
10512
|
this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
|
|
9897
10513
|
this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
|
|
10514
|
+
this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
|
|
9898
10515
|
|
|
9899
10516
|
this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
|
|
9900
10517
|
|
|
@@ -9971,12 +10588,13 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9971
10588
|
this._conversationsPromise = this._conversationsEntity.fetchConversations().then(function () {
|
|
9972
10589
|
return _this3._conversationsEntity;
|
|
9973
10590
|
}).catch(function (error) {
|
|
10591
|
+
console.error("Failed to fetch conversations _conversationsPromise -> client.ts", error);
|
|
9974
10592
|
throw error;
|
|
9975
10593
|
});
|
|
9976
|
-
_context17.next =
|
|
10594
|
+
_context17.next = 30;
|
|
9977
10595
|
return this._services.users.myself._ensureFetched();
|
|
9978
10596
|
|
|
9979
|
-
case
|
|
10597
|
+
case 30:
|
|
9980
10598
|
Client_1._supportedPushChannels.forEach(function (channelType) {
|
|
9981
10599
|
return _this3._subscribeToPushNotifications(channelType);
|
|
9982
10600
|
});
|
|
@@ -9989,10 +10607,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
9989
10607
|
|
|
9990
10608
|
this._resolveEnsureReady();
|
|
9991
10609
|
|
|
9992
|
-
this.emit(
|
|
9993
|
-
this.emit(
|
|
10610
|
+
this.emit(Client_1.stateChanged, "initialized");
|
|
10611
|
+
this.emit(Client_1.initialized);
|
|
9994
10612
|
|
|
9995
|
-
case
|
|
10613
|
+
case 36:
|
|
9996
10614
|
case "end":
|
|
9997
10615
|
return _context17.stop();
|
|
9998
10616
|
}
|
|
@@ -10034,6 +10652,26 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
|
10034
10652
|
_this5._services.notificationClient.unsubscribe(channelType, messageType);
|
|
10035
10653
|
});
|
|
10036
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
|
+
}
|
|
10037
10675
|
}], [{
|
|
10038
10676
|
key: "create",
|
|
10039
10677
|
value: function () {
|
|
@@ -10252,6 +10890,7 @@ exports.ContentTemplate = ContentTemplate;
|
|
|
10252
10890
|
exports.ContentTemplateVariable = ContentTemplateVariable;
|
|
10253
10891
|
exports.Conversation = Conversation;
|
|
10254
10892
|
exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
|
|
10893
|
+
exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
|
|
10255
10894
|
exports.Media = Media;
|
|
10256
10895
|
exports.Message = Message;
|
|
10257
10896
|
exports.MessageBuilder = MessageBuilder;
|
|
@@ -10259,6 +10898,7 @@ exports.NotificationTypes = NotificationTypes;
|
|
|
10259
10898
|
exports.Participant = Participant;
|
|
10260
10899
|
exports.PushNotification = PushNotification;
|
|
10261
10900
|
exports.RestPaginator = RestPaginator;
|
|
10901
|
+
exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
|
|
10262
10902
|
exports.UnsentMessage = UnsentMessage;
|
|
10263
10903
|
exports.User = User;
|
|
10264
10904
|
//# sourceMappingURL=lib.js.map
|