@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/README.md
CHANGED
|
@@ -77,7 +77,7 @@ To consume securely use the following script snippet format:
|
|
|
77
77
|
|
|
78
78
|
```html
|
|
79
79
|
<script
|
|
80
|
-
src="https://sdk.twilio.com/js/conversations/releases/2.6.
|
|
80
|
+
src="https://sdk.twilio.com/js/conversations/releases/2.6.5/twilio-conversations.min.js"
|
|
81
81
|
integrity="sha256-<HASH FROM THE CHANGELOGS PAGE>"
|
|
82
82
|
crossorigin="anonymous"
|
|
83
83
|
></script>
|
package/builds/browser.esm.js
CHANGED
|
@@ -4958,6 +4958,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
4958
4958
|
* Promise for the conversation entity document.
|
|
4959
4959
|
*/
|
|
4960
4960
|
|
|
4961
|
+
/**
|
|
4962
|
+
* Promise for the messages list.
|
|
4963
|
+
*/
|
|
4964
|
+
|
|
4961
4965
|
/**
|
|
4962
4966
|
* Conversation entity document.
|
|
4963
4967
|
*/
|
|
@@ -6240,44 +6244,95 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6240
6244
|
}, {
|
|
6241
6245
|
key: "_fetchStreams",
|
|
6242
6246
|
value: function () {
|
|
6243
|
-
var _fetchStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6244
|
-
var
|
|
6247
|
+
var _fetchStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
|
|
6248
|
+
var _this3 = this;
|
|
6245
6249
|
|
|
6246
|
-
|
|
6247
|
-
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
6250
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
6248
6251
|
while (1) {
|
|
6249
|
-
switch (
|
|
6252
|
+
switch (_context27.prev = _context27.next) {
|
|
6250
6253
|
case 0:
|
|
6251
|
-
|
|
6252
|
-
|
|
6254
|
+
if (!this._streamsPromise) {
|
|
6255
|
+
_context27.next = 2;
|
|
6256
|
+
break;
|
|
6257
|
+
}
|
|
6253
6258
|
|
|
6254
|
-
|
|
6255
|
-
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
|
6259
|
+
return _context27.abrupt("return", this._streamsPromise);
|
|
6256
6260
|
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6261
|
+
case 2:
|
|
6262
|
+
this._streamsPromise = new Promise( /*#__PURE__*/function () {
|
|
6263
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(resolve, reject) {
|
|
6264
|
+
var _this3$_entity, _this3$_entity2;
|
|
6265
|
+
|
|
6266
|
+
var data, messagesPromise, participantsPromise;
|
|
6267
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
6268
|
+
while (1) {
|
|
6269
|
+
switch (_context26.prev = _context26.next) {
|
|
6270
|
+
case 0:
|
|
6271
|
+
_context26.prev = 0;
|
|
6272
|
+
_context26.next = 3;
|
|
6273
|
+
return _this3._subscribe();
|
|
6274
|
+
|
|
6275
|
+
case 3:
|
|
6276
|
+
_context26.next = 9;
|
|
6277
|
+
break;
|
|
6263
6278
|
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6279
|
+
case 5:
|
|
6280
|
+
_context26.prev = 5;
|
|
6281
|
+
_context26.t0 = _context26["catch"](0);
|
|
6282
|
+
|
|
6283
|
+
Conversation._logger.trace("Failed to subscribe to conversation", _context26.t0);
|
|
6284
|
+
|
|
6285
|
+
return _context26.abrupt("return", reject(_context26.t0));
|
|
6286
|
+
|
|
6287
|
+
case 9:
|
|
6288
|
+
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this3$_entity = _this3._entity) === null || _this3$_entity === void 0 ? void 0 : _this3$_entity.data);
|
|
6289
|
+
|
|
6290
|
+
data = (_this3$_entity2 = _this3._entity) === null || _this3$_entity2 === void 0 ? void 0 : _this3$_entity2.data;
|
|
6291
|
+
messagesPromise = _this3._services.syncClient.list({
|
|
6292
|
+
id: data.messages,
|
|
6293
|
+
mode: "open_existing"
|
|
6294
|
+
}).then(function (list) {
|
|
6295
|
+
_this3._messagesList = list;
|
|
6296
|
+
return list;
|
|
6297
|
+
});
|
|
6298
|
+
participantsPromise = _this3._services.syncClient.map({
|
|
6299
|
+
id: data.roster,
|
|
6300
|
+
mode: "open_existing"
|
|
6301
|
+
}).then(function (map) {
|
|
6302
|
+
_this3._participantsMap = map;
|
|
6303
|
+
return map;
|
|
6304
|
+
});
|
|
6305
|
+
Promise.all([messagesPromise, participantsPromise]).then(function () {
|
|
6306
|
+
return resolve(true);
|
|
6307
|
+
}).catch(function (err) {
|
|
6308
|
+
Conversation._logger.trace("Failed to fetch conversation streams for conversation", _this3.sid, err);
|
|
6309
|
+
|
|
6310
|
+
reject(err);
|
|
6311
|
+
});
|
|
6312
|
+
|
|
6313
|
+
case 14:
|
|
6314
|
+
case "end":
|
|
6315
|
+
return _context26.stop();
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
}, _callee26, null, [[0, 5]]);
|
|
6319
|
+
}));
|
|
6271
6320
|
|
|
6272
|
-
|
|
6273
|
-
|
|
6321
|
+
return function (_x20, _x21) {
|
|
6322
|
+
return _ref.apply(this, arguments);
|
|
6323
|
+
};
|
|
6324
|
+
}());
|
|
6325
|
+
return _context27.abrupt("return", this._streamsPromise.catch(function (err) {
|
|
6326
|
+
_this3._streamsPromise = null;
|
|
6327
|
+
throw err;
|
|
6328
|
+
}));
|
|
6274
6329
|
|
|
6275
|
-
case
|
|
6330
|
+
case 4:
|
|
6276
6331
|
case "end":
|
|
6277
|
-
return
|
|
6332
|
+
return _context27.stop();
|
|
6278
6333
|
}
|
|
6279
6334
|
}
|
|
6280
|
-
},
|
|
6335
|
+
}, _callee27, this);
|
|
6281
6336
|
}));
|
|
6282
6337
|
|
|
6283
6338
|
function _fetchStreams() {
|
|
@@ -6297,48 +6352,48 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6297
6352
|
}, {
|
|
6298
6353
|
key: "_subscribeStreams",
|
|
6299
6354
|
value: function () {
|
|
6300
|
-
var _subscribeStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6301
|
-
var _this$
|
|
6355
|
+
var _subscribeStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
|
|
6356
|
+
var _this$_entity, _this$_entity2, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
|
|
6302
6357
|
|
|
6303
|
-
return _regeneratorRuntime.wrap(function
|
|
6358
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
6304
6359
|
while (1) {
|
|
6305
|
-
switch (
|
|
6360
|
+
switch (_context28.prev = _context28.next) {
|
|
6306
6361
|
case 0:
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
return this.
|
|
6362
|
+
_context28.prev = 0;
|
|
6363
|
+
_context28.next = 3;
|
|
6364
|
+
return this._fetchStreams();
|
|
6310
6365
|
|
|
6311
6366
|
case 3:
|
|
6312
|
-
Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$
|
|
6367
|
+
Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
|
6313
6368
|
|
|
6314
|
-
data = (_this$
|
|
6369
|
+
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
|
6315
6370
|
messagesObjectName = data.messages;
|
|
6316
6371
|
rosterObjectName = data.roster;
|
|
6317
|
-
|
|
6372
|
+
_context28.next = 9;
|
|
6318
6373
|
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)]);
|
|
6319
6374
|
|
|
6320
6375
|
case 9:
|
|
6321
|
-
|
|
6376
|
+
_context28.next = 16;
|
|
6322
6377
|
break;
|
|
6323
6378
|
|
|
6324
6379
|
case 11:
|
|
6325
|
-
|
|
6326
|
-
|
|
6380
|
+
_context28.prev = 11;
|
|
6381
|
+
_context28.t0 = _context28["catch"](0);
|
|
6327
6382
|
|
|
6328
6383
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
|
6329
|
-
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid,
|
|
6384
|
+
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context28.t0);
|
|
6330
6385
|
}
|
|
6331
6386
|
|
|
6332
|
-
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid,
|
|
6387
|
+
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context28.t0);
|
|
6333
6388
|
|
|
6334
|
-
throw
|
|
6389
|
+
throw _context28.t0;
|
|
6335
6390
|
|
|
6336
6391
|
case 16:
|
|
6337
6392
|
case "end":
|
|
6338
|
-
return
|
|
6393
|
+
return _context28.stop();
|
|
6339
6394
|
}
|
|
6340
6395
|
}
|
|
6341
|
-
},
|
|
6396
|
+
}, _callee28, this, [[0, 11]]);
|
|
6342
6397
|
}));
|
|
6343
6398
|
|
|
6344
6399
|
function _subscribeStreams() {
|
|
@@ -6355,10 +6410,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6355
6410
|
}, {
|
|
6356
6411
|
key: "_unsubscribe",
|
|
6357
6412
|
value: function () {
|
|
6358
|
-
var _unsubscribe2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6359
|
-
return _regeneratorRuntime.wrap(function
|
|
6413
|
+
var _unsubscribe2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
|
|
6414
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
6360
6415
|
while (1) {
|
|
6361
|
-
switch (
|
|
6416
|
+
switch (_context29.prev = _context29.next) {
|
|
6362
6417
|
case 0:
|
|
6363
6418
|
if (this._entity) {
|
|
6364
6419
|
this._entity.close();
|
|
@@ -6367,14 +6422,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6367
6422
|
this._entityPromise = null;
|
|
6368
6423
|
}
|
|
6369
6424
|
|
|
6370
|
-
return
|
|
6425
|
+
return _context29.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
|
6371
6426
|
|
|
6372
6427
|
case 2:
|
|
6373
6428
|
case "end":
|
|
6374
|
-
return
|
|
6429
|
+
return _context29.stop();
|
|
6375
6430
|
}
|
|
6376
6431
|
}
|
|
6377
|
-
},
|
|
6432
|
+
}, _callee29, this);
|
|
6378
6433
|
}));
|
|
6379
6434
|
|
|
6380
6435
|
function _unsubscribe() {
|
|
@@ -6391,7 +6446,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6391
6446
|
}, {
|
|
6392
6447
|
key: "_setStatus",
|
|
6393
6448
|
value: function _setStatus(status, source) {
|
|
6394
|
-
var
|
|
6449
|
+
var _this4 = this;
|
|
6395
6450
|
|
|
6396
6451
|
this._dataSource = source;
|
|
6397
6452
|
|
|
@@ -6405,7 +6460,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6405
6460
|
this._subscribeStreams().catch(function (err) {
|
|
6406
6461
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6407
6462
|
|
|
6408
|
-
if (
|
|
6463
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6409
6464
|
throw err;
|
|
6410
6465
|
}
|
|
6411
6466
|
});
|
|
@@ -6417,7 +6472,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6417
6472
|
this._unsubscribe().catch(function (err) {
|
|
6418
6473
|
Conversation._logger.debug("ERROR while setting conversation status " + status, err);
|
|
6419
6474
|
|
|
6420
|
-
if (
|
|
6475
|
+
if (_this4._services.syncClient.connectionState !== "disconnected") {
|
|
6421
6476
|
throw err;
|
|
6422
6477
|
}
|
|
6423
6478
|
});
|
|
@@ -6580,30 +6635,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
|
6580
6635
|
}, {
|
|
6581
6636
|
key: "_setLastReadMessageIndex",
|
|
6582
6637
|
value: function () {
|
|
6583
|
-
var _setLastReadMessageIndex2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6638
|
+
var _setLastReadMessageIndex2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(index) {
|
|
6584
6639
|
var result;
|
|
6585
|
-
return _regeneratorRuntime.wrap(function
|
|
6640
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
6586
6641
|
while (1) {
|
|
6587
|
-
switch (
|
|
6642
|
+
switch (_context30.prev = _context30.next) {
|
|
6588
6643
|
case 0:
|
|
6589
|
-
|
|
6644
|
+
_context30.next = 2;
|
|
6590
6645
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
|
6591
6646
|
last_read_message_index: index
|
|
6592
6647
|
});
|
|
6593
6648
|
|
|
6594
6649
|
case 2:
|
|
6595
|
-
result =
|
|
6596
|
-
return
|
|
6650
|
+
result = _context30.sent;
|
|
6651
|
+
return _context30.abrupt("return", result.unread_messages_count);
|
|
6597
6652
|
|
|
6598
6653
|
case 4:
|
|
6599
6654
|
case "end":
|
|
6600
|
-
return
|
|
6655
|
+
return _context30.stop();
|
|
6601
6656
|
}
|
|
6602
6657
|
}
|
|
6603
|
-
},
|
|
6658
|
+
}, _callee30, this);
|
|
6604
6659
|
}));
|
|
6605
6660
|
|
|
6606
|
-
function _setLastReadMessageIndex(
|
|
6661
|
+
function _setLastReadMessageIndex(_x22) {
|
|
6607
6662
|
return _setLastReadMessageIndex2.apply(this, arguments);
|
|
6608
6663
|
}
|
|
6609
6664
|
|
|
@@ -8030,7 +8085,7 @@ function PushNotification(data) {
|
|
|
8030
8085
|
this.data = data.data || {};
|
|
8031
8086
|
});
|
|
8032
8087
|
|
|
8033
|
-
var version = "2.6.
|
|
8088
|
+
var version = "2.6.5";
|
|
8034
8089
|
|
|
8035
8090
|
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; }
|
|
8036
8091
|
|