@twilio/conversations 2.6.4 → 2.6.5
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 +1 -1
- package/builds/browser.esm.js +119 -64
- package/builds/browser.esm.js.map +1 -1
- package/builds/browser.js +119 -64
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +5 -1
- package/builds/lib.esm.d.ts +5 -1
- package/builds/lib.esm.js +119 -64
- package/builds/lib.js +119 -64
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +121 -66
- package/builds/twilio-conversations.js.map +1 -1
- package/builds/twilio-conversations.min.js +1 -1
- package/builds/twilio-conversations.min.js.map +1 -1
- package/dist/conversation.js +42 -11
- package/dist/conversation.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/docs/index.html +2 -2
- package/docs/modules.html +1 -1
- package/package.json +8 -8
package/builds/browser.js
CHANGED
|
@@ -4997,6 +4997,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4997
4997
|
* Promise for the conversation entity document.
|
|
4998
4998
|
*/
|
|
4999
4999
|
|
|
5000
|
+
/**
|
|
5001
|
+
* Promise for the messages list.
|
|
5002
|
+
*/
|
|
5003
|
+
|
|
5000
5004
|
/**
|
|
5001
5005
|
* Conversation entity document.
|
|
5002
5006
|
*/
|
|
@@ -6279,44 +6283,95 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6279
6283
|
}, {
|
|
6280
6284
|
key: "_fetchStreams",
|
|
6281
6285
|
value: function () {
|
|
6282
|
-
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6283
|
-
var
|
|
6286
|
+
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
|
|
6287
|
+
var _this3 = this;
|
|
6284
6288
|
|
|
6285
|
-
|
|
6286
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
|
|
6289
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
|
|
6287
6290
|
while (1) {
|
|
6288
|
-
switch (
|
|
6291
|
+
switch (_context27.prev = _context27.next) {
|
|
6289
6292
|
case 0:
|
|
6290
|
-
|
|
6291
|
-
|
|
6293
|
+
if (!this._streamsPromise) {
|
|
6294
|
+
_context27.next = 2;
|
|
6295
|
+
break;
|
|
6296
|
+
}
|
|
6292
6297
|
|
|
6293
|
-
|
|
6294
|
-
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
|
6298
|
+
return _context27.abrupt("return", this._streamsPromise);
|
|
6295
6299
|
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6300
|
+
case 2:
|
|
6301
|
+
this._streamsPromise = new Promise( /*#__PURE__*/function () {
|
|
6302
|
+
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26(resolve, reject) {
|
|
6303
|
+
var _this3$_entity, _this3$_entity2;
|
|
6304
|
+
|
|
6305
|
+
var data, messagesPromise, participantsPromise;
|
|
6306
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
|
|
6307
|
+
while (1) {
|
|
6308
|
+
switch (_context26.prev = _context26.next) {
|
|
6309
|
+
case 0:
|
|
6310
|
+
_context26.prev = 0;
|
|
6311
|
+
_context26.next = 3;
|
|
6312
|
+
return _this3._subscribe();
|
|
6313
|
+
|
|
6314
|
+
case 3:
|
|
6315
|
+
_context26.next = 9;
|
|
6316
|
+
break;
|
|
6302
6317
|
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6318
|
+
case 5:
|
|
6319
|
+
_context26.prev = 5;
|
|
6320
|
+
_context26.t0 = _context26["catch"](0);
|
|
6321
|
+
|
|
6322
|
+
Conversation._logger.trace("Failed to subscribe to conversation", _context26.t0);
|
|
6323
|
+
|
|
6324
|
+
return _context26.abrupt("return", reject(_context26.t0));
|
|
6325
|
+
|
|
6326
|
+
case 9:
|
|
6327
|
+
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this3$_entity = _this3._entity) === null || _this3$_entity === void 0 ? void 0 : _this3$_entity.data);
|
|
6328
|
+
|
|
6329
|
+
data = (_this3$_entity2 = _this3._entity) === null || _this3$_entity2 === void 0 ? void 0 : _this3$_entity2.data;
|
|
6330
|
+
messagesPromise = _this3._services.syncClient.list({
|
|
6331
|
+
id: data.messages,
|
|
6332
|
+
mode: "open_existing"
|
|
6333
|
+
}).then(function (list) {
|
|
6334
|
+
_this3._messagesList = list;
|
|
6335
|
+
return list;
|
|
6336
|
+
});
|
|
6337
|
+
participantsPromise = _this3._services.syncClient.map({
|
|
6338
|
+
id: data.roster,
|
|
6339
|
+
mode: "open_existing"
|
|
6340
|
+
}).then(function (map) {
|
|
6341
|
+
_this3._participantsMap = map;
|
|
6342
|
+
return map;
|
|
6343
|
+
});
|
|
6344
|
+
Promise.all([messagesPromise, participantsPromise]).then(function () {
|
|
6345
|
+
return resolve(true);
|
|
6346
|
+
}).catch(function (err) {
|
|
6347
|
+
Conversation._logger.trace("Failed to fetch conversation streams for conversation", _this3.sid, err);
|
|
6348
|
+
|
|
6349
|
+
reject(err);
|
|
6350
|
+
});
|
|
6351
|
+
|
|
6352
|
+
case 14:
|
|
6353
|
+
case "end":
|
|
6354
|
+
return _context26.stop();
|
|
6355
|
+
}
|
|
6356
|
+
}
|
|
6357
|
+
}, _callee26, null, [[0, 5]]);
|
|
6358
|
+
}));
|
|
6310
6359
|
|
|
6311
|
-
|
|
6312
|
-
|
|
6360
|
+
return function (_x20, _x21) {
|
|
6361
|
+
return _ref.apply(this, arguments);
|
|
6362
|
+
};
|
|
6363
|
+
}());
|
|
6364
|
+
return _context27.abrupt("return", this._streamsPromise.catch(function (err) {
|
|
6365
|
+
_this3._streamsPromise = null;
|
|
6366
|
+
throw err;
|
|
6367
|
+
}));
|
|
6313
6368
|
|
|
6314
|
-
case
|
|
6369
|
+
case 4:
|
|
6315
6370
|
case "end":
|
|
6316
|
-
return
|
|
6371
|
+
return _context27.stop();
|
|
6317
6372
|
}
|
|
6318
6373
|
}
|
|
6319
|
-
},
|
|
6374
|
+
}, _callee27, this);
|
|
6320
6375
|
}));
|
|
6321
6376
|
|
|
6322
6377
|
function _fetchStreams() {
|
|
@@ -6336,48 +6391,48 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6336
6391
|
}, {
|
|
6337
6392
|
key: "_subscribeStreams",
|
|
6338
6393
|
value: function () {
|
|
6339
|
-
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6340
|
-
var _this$
|
|
6394
|
+
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
|
|
6395
|
+
var _this$_entity, _this$_entity2, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
|
|
6341
6396
|
|
|
6342
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6397
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
|
|
6343
6398
|
while (1) {
|
|
6344
|
-
switch (
|
|
6399
|
+
switch (_context28.prev = _context28.next) {
|
|
6345
6400
|
case 0:
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
return this.
|
|
6401
|
+
_context28.prev = 0;
|
|
6402
|
+
_context28.next = 3;
|
|
6403
|
+
return this._fetchStreams();
|
|
6349
6404
|
|
|
6350
6405
|
case 3:
|
|
6351
|
-
Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$
|
|
6406
|
+
Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
|
6352
6407
|
|
|
6353
|
-
data = (_this$
|
|
6408
|
+
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
|
6354
6409
|
messagesObjectName = data.messages;
|
|
6355
6410
|
rosterObjectName = data.roster;
|
|
6356
|
-
|
|
6411
|
+
_context28.next = 9;
|
|
6357
6412
|
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)]);
|
|
6358
6413
|
|
|
6359
6414
|
case 9:
|
|
6360
|
-
|
|
6415
|
+
_context28.next = 16;
|
|
6361
6416
|
break;
|
|
6362
6417
|
|
|
6363
6418
|
case 11:
|
|
6364
|
-
|
|
6365
|
-
|
|
6419
|
+
_context28.prev = 11;
|
|
6420
|
+
_context28.t0 = _context28["catch"](0);
|
|
6366
6421
|
|
|
6367
6422
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
|
6368
|
-
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid,
|
|
6423
|
+
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context28.t0);
|
|
6369
6424
|
}
|
|
6370
6425
|
|
|
6371
|
-
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid,
|
|
6426
|
+
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context28.t0);
|
|
6372
6427
|
|
|
6373
|
-
throw
|
|
6428
|
+
throw _context28.t0;
|
|
6374
6429
|
|
|
6375
6430
|
case 16:
|
|
6376
6431
|
case "end":
|
|
6377
|
-
return
|
|
6432
|
+
return _context28.stop();
|
|
6378
6433
|
}
|
|
6379
6434
|
}
|
|
6380
|
-
},
|
|
6435
|
+
}, _callee28, this, [[0, 11]]);
|
|
6381
6436
|
}));
|
|
6382
6437
|
|
|
6383
6438
|
function _subscribeStreams() {
|
|
@@ -6394,10 +6449,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6394
6449
|
}, {
|
|
6395
6450
|
key: "_unsubscribe",
|
|
6396
6451
|
value: function () {
|
|
6397
|
-
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6398
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6452
|
+
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29() {
|
|
6453
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
|
|
6399
6454
|
while (1) {
|
|
6400
|
-
switch (
|
|
6455
|
+
switch (_context29.prev = _context29.next) {
|
|
6401
6456
|
case 0:
|
|
6402
6457
|
if (this._entity) {
|
|
6403
6458
|
this._entity.close();
|
|
@@ -6406,14 +6461,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6406
6461
|
this._entityPromise = null;
|
|
6407
6462
|
}
|
|
6408
6463
|
|
|
6409
|
-
return
|
|
6464
|
+
return _context29.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
|
6410
6465
|
|
|
6411
6466
|
case 2:
|
|
6412
6467
|
case "end":
|
|
6413
|
-
return
|
|
6468
|
+
return _context29.stop();
|
|
6414
6469
|
}
|
|
6415
6470
|
}
|
|
6416
|
-
},
|
|
6471
|
+
}, _callee29, this);
|
|
6417
6472
|
}));
|
|
6418
6473
|
|
|
6419
6474
|
function _unsubscribe() {
|
|
@@ -6430,7 +6485,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6430
6485
|
}, {
|
|
6431
6486
|
key: "_setStatus",
|
|
6432
6487
|
value: function _setStatus(status, source) {
|
|
6433
|
-
var
|
|
6488
|
+
var _this4 = this;
|
|
6434
6489
|
|
|
6435
6490
|
this._dataSource = source;
|
|
6436
6491
|
|
|
@@ -6444,7 +6499,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6444
6499
|
this._subscribeStreams().catch(function (err) {
|
|
6445
6500
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6446
6501
|
|
|
6447
|
-
if (
|
|
6502
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6448
6503
|
throw err;
|
|
6449
6504
|
}
|
|
6450
6505
|
});
|
|
@@ -6456,7 +6511,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6456
6511
|
this._unsubscribe().catch(function (err) {
|
|
6457
6512
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6458
6513
|
|
|
6459
|
-
if (
|
|
6514
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6460
6515
|
throw err;
|
|
6461
6516
|
}
|
|
6462
6517
|
});
|
|
@@ -6619,30 +6674,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6619
6674
|
}, {
|
|
6620
6675
|
key: "_setLastReadMessageIndex",
|
|
6621
6676
|
value: function () {
|
|
6622
|
-
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
6677
|
+
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee30(index) {
|
|
6623
6678
|
var result;
|
|
6624
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
6679
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee30$(_context30) {
|
|
6625
6680
|
while (1) {
|
|
6626
|
-
switch (
|
|
6681
|
+
switch (_context30.prev = _context30.next) {
|
|
6627
6682
|
case 0:
|
|
6628
|
-
|
|
6683
|
+
_context30.next = 2;
|
|
6629
6684
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
|
6630
6685
|
last_read_message_index: index
|
|
6631
6686
|
});
|
|
6632
6687
|
|
|
6633
6688
|
case 2:
|
|
6634
|
-
result =
|
|
6635
|
-
return
|
|
6689
|
+
result = _context30.sent;
|
|
6690
|
+
return _context30.abrupt("return", result.unread_messages_count);
|
|
6636
6691
|
|
|
6637
6692
|
case 4:
|
|
6638
6693
|
case "end":
|
|
6639
|
-
return
|
|
6694
|
+
return _context30.stop();
|
|
6640
6695
|
}
|
|
6641
6696
|
}
|
|
6642
|
-
},
|
|
6697
|
+
}, _callee30, this);
|
|
6643
6698
|
}));
|
|
6644
6699
|
|
|
6645
|
-
function _setLastReadMessageIndex(
|
|
6700
|
+
function _setLastReadMessageIndex(_x22) {
|
|
6646
6701
|
return _setLastReadMessageIndex2.apply(this, arguments);
|
|
6647
6702
|
}
|
|
6648
6703
|
|
|
@@ -8069,7 +8124,7 @@ function PushNotification(data) {
|
|
|
8069
8124
|
this.data = data.data || {};
|
|
8070
8125
|
});
|
|
8071
8126
|
|
|
8072
|
-
var version = "2.6.
|
|
8127
|
+
var version = "2.6.5";
|
|
8073
8128
|
|
|
8074
8129
|
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; }
|
|
8075
8130
|
|