@twilio/conversations 2.5.0-rc.8 → 2.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/builds/browser.esm.js +10713 -0
- package/builds/browser.esm.js.map +1 -0
- package/builds/browser.js +241 -81
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +10 -9
- package/builds/lib.esm.d.ts +3166 -0
- package/builds/lib.esm.js +10712 -0
- package/builds/lib.js +250 -81
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +11231 -11244
- package/builds/twilio-conversations.min.js +1 -1
- package/dist/aggregated-delivery-receipt.js +3 -5
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/channel-metadata-client.js +7 -9
- package/dist/channel-metadata-client.js.map +1 -1
- package/dist/client.js +201 -166
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +8 -8
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +12 -9
- package/dist/configuration.js.map +1 -1
- package/dist/content-client.js +11 -8
- package/dist/content-client.js.map +1 -1
- package/dist/content-template.js +3 -5
- package/dist/content-template.js.map +1 -1
- package/dist/conversation.js +130 -96
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +36 -43
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +23 -21
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +27 -24
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +15 -13
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +3 -5
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/index.js +17 -49
- 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 +13 -10
- package/dist/interfaces/rules.js.map +1 -1
- package/dist/logger.js +25 -26
- package/dist/logger.js.map +1 -1
- package/dist/media.js +11 -8
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +48 -40
- package/dist/message-builder.js.map +1 -1
- package/dist/message-recipients-client.js +11 -13
- package/dist/message-recipients-client.js.map +1 -1
- package/dist/message.js +96 -83
- 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 +1 -7
- 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 +40 -31
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js +5 -4
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +9 -8
- 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 +11 -8
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js +9 -8
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +27 -24
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +6 -4
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +1 -9
- package/dist/util/index.js.map +1 -1
- package/docs/classes/Client.html +2 -2
- package/docs/index.html +3 -3
- package/docs/modules.html +2 -2
- package/package.json +10 -10
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');
|
@@ -646,6 +655,22 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
646
655
|
* @event
|
647
656
|
*/
|
648
657
|
|
658
|
+
/**
|
659
|
+
* Fired when the client has subscribed to the user.
|
660
|
+
*
|
661
|
+
* Parameters:
|
662
|
+
* 1. {@link User} `user` - the user in question
|
663
|
+
* @event
|
664
|
+
*/
|
665
|
+
|
666
|
+
/**
|
667
|
+
* Fired when the client has unsubscribed from the user.
|
668
|
+
*
|
669
|
+
* Parameters:
|
670
|
+
* 1. {@link User} `user` - the user in question
|
671
|
+
* @event
|
672
|
+
*/
|
673
|
+
|
649
674
|
|
650
675
|
_createClass__default["default"](User, [{
|
651
676
|
key: "identity",
|
@@ -1318,6 +1343,24 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1318
1343
|
* @event
|
1319
1344
|
*/
|
1320
1345
|
|
1346
|
+
/**
|
1347
|
+
* Fired when the participant has stopped typing.
|
1348
|
+
*
|
1349
|
+
* Parameters:
|
1350
|
+
* 1. {@link Participant} `participant` - the participant in question
|
1351
|
+
* @event
|
1352
|
+
*/
|
1353
|
+
|
1354
|
+
/**
|
1355
|
+
* Fired when the fields of the participant have been updated.
|
1356
|
+
*
|
1357
|
+
* Parameters:
|
1358
|
+
* 1. object `data` - info object provided with the event. It has the following properties:
|
1359
|
+
* * {@link Participant} participant - the participant in question
|
1360
|
+
* * {@link ParticipantUpdateReason}[] updateReasons - array of reasons for the update
|
1361
|
+
* @event
|
1362
|
+
*/
|
1363
|
+
|
1321
1364
|
|
1322
1365
|
_createClass__default["default"](Participant, [{
|
1323
1366
|
key: "sid",
|
@@ -1444,8 +1487,9 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1444
1487
|
}
|
1445
1488
|
|
1446
1489
|
this.state.isTyping = true;
|
1447
|
-
this.emit(
|
1448
|
-
this.conversation.emit(
|
1490
|
+
this.emit(Participant.typingStarted, this);
|
1491
|
+
this.conversation.emit(Conversation.typingStarted, this); // @fixme layering violation
|
1492
|
+
|
1449
1493
|
this.state.typingTimeout = Number(setTimeout(function () {
|
1450
1494
|
return _this2._endTyping();
|
1451
1495
|
}, timeout));
|
@@ -1464,8 +1508,8 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1464
1508
|
}
|
1465
1509
|
|
1466
1510
|
this.state.isTyping = false;
|
1467
|
-
this.emit(
|
1468
|
-
this.conversation.emit(
|
1511
|
+
this.emit(Participant.typingEnded, this);
|
1512
|
+
this.conversation.emit(Conversation.typingEnded, this);
|
1469
1513
|
clearInterval(this.state.typingTimeout);
|
1470
1514
|
this.state.typingTimeout = null;
|
1471
1515
|
}
|
@@ -1524,7 +1568,7 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1524
1568
|
}
|
1525
1569
|
|
1526
1570
|
if (updateReasons.length > 0) {
|
1527
|
-
this.emit(
|
1571
|
+
this.emit(Participant.updated, {
|
1528
1572
|
participant: this,
|
1529
1573
|
updateReasons: updateReasons
|
1530
1574
|
});
|
@@ -1660,7 +1704,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1660
1704
|
|
1661
1705
|
var _super = _createSuper$7(Participants);
|
1662
1706
|
|
1663
|
-
|
1707
|
+
// passed in from Conversation
|
1708
|
+
function Participants(conversation, participants, links, services) {
|
1664
1709
|
var _this;
|
1665
1710
|
|
1666
1711
|
_classCallCheck__default["default"](this, Participants);
|
@@ -1672,7 +1717,6 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1672
1717
|
_this.conversation = conversation;
|
1673
1718
|
_this.participants = participants;
|
1674
1719
|
_this.links = links;
|
1675
|
-
_this.configuration = configuration;
|
1676
1720
|
_this.services = services;
|
1677
1721
|
return _this;
|
1678
1722
|
}
|
@@ -1723,14 +1767,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1723
1767
|
mode: "open_existing"
|
1724
1768
|
}) : Promise.resolve(arg);
|
1725
1769
|
return this.rosterEntityPromise = this.rosterEntityPromise || participantsMapPromise.then(function (rosterMap) {
|
1726
|
-
rosterMap.on(
|
1770
|
+
rosterMap.on(twilioSync.SyncMap.itemAdded, function (args) {
|
1727
1771
|
log$4.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
|
1728
1772
|
|
1729
1773
|
_this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
|
1730
|
-
_this2.emit(
|
1774
|
+
_this2.emit(Conversation.participantJoined, participant);
|
1731
1775
|
});
|
1732
1776
|
});
|
1733
|
-
rosterMap.on(
|
1777
|
+
rosterMap.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
1734
1778
|
log$4.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
|
1735
1779
|
var participantSid = args.key;
|
1736
1780
|
|
@@ -1746,12 +1790,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1746
1790
|
return;
|
1747
1791
|
}
|
1748
1792
|
|
1749
|
-
_this2.emit(
|
1793
|
+
_this2.emit(Conversation.participantLeft, leftParticipant);
|
1750
1794
|
});
|
1751
|
-
rosterMap.on(
|
1795
|
+
rosterMap.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
1752
1796
|
log$4.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
|
1753
1797
|
|
1754
|
-
_this2.upsertParticipant(args.item.key, args.item.data)
|
1798
|
+
_this2.upsertParticipant(args.item.key, args.item.data).catch(function (e) {
|
1799
|
+
return log$4.error(e);
|
1800
|
+
});
|
1755
1801
|
});
|
1756
1802
|
var participantsPromises = [];
|
1757
1803
|
|
@@ -1845,8 +1891,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1845
1891
|
};
|
1846
1892
|
participant = new Participant(data, participantSid, this.conversation, links, this.services);
|
1847
1893
|
this.participants.set(participantSid, participant);
|
1848
|
-
participant.on(
|
1849
|
-
return _this3.emit(
|
1894
|
+
participant.on(Participant.updated, function (args) {
|
1895
|
+
return _this3.emit(Conversation.participantUpdated, args);
|
1850
1896
|
});
|
1851
1897
|
return _context3.abrupt("return", participant);
|
1852
1898
|
|
@@ -2457,15 +2503,14 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2457
2503
|
/**
|
2458
2504
|
* @internal
|
2459
2505
|
*/
|
2460
|
-
function RestPaginator(items, source, prevToken, nextToken
|
2506
|
+
function RestPaginator(items, source, prevToken, nextToken) {
|
2461
2507
|
_classCallCheck__default["default"](this, RestPaginator);
|
2462
2508
|
|
2463
2509
|
this.state = {
|
2464
2510
|
prevToken: prevToken,
|
2465
2511
|
nextToken: nextToken,
|
2466
2512
|
source: source,
|
2467
|
-
items: items
|
2468
|
-
pageSize: pageSize
|
2513
|
+
items: items
|
2469
2514
|
};
|
2470
2515
|
}
|
2471
2516
|
/**
|
@@ -2503,7 +2548,7 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2503
2548
|
}, {
|
2504
2549
|
key: "nextPage",
|
2505
2550
|
value: function nextPage() {
|
2506
|
-
return this.hasNextPage ? this.state.source(this.state.nextToken
|
2551
|
+
return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error("No next page"));
|
2507
2552
|
}
|
2508
2553
|
/**
|
2509
2554
|
* Request the previous page. Does not modify the existing object.
|
@@ -2512,7 +2557,7 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2512
2557
|
}, {
|
2513
2558
|
key: "prevPage",
|
2514
2559
|
value: function prevPage() {
|
2515
|
-
return this.hasPrevPage ? this.state.source(this.state.prevToken
|
2560
|
+
return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error("No previous page"));
|
2516
2561
|
}
|
2517
2562
|
}]);
|
2518
2563
|
|
@@ -2893,6 +2938,15 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
2893
2938
|
|
2894
2939
|
return _this;
|
2895
2940
|
}
|
2941
|
+
/**
|
2942
|
+
* Fired when the properties or the body of the message has been updated.
|
2943
|
+
*
|
2944
|
+
* Parameters:
|
2945
|
+
* 1. object `data` - info object provided with the event. It has the following properties:
|
2946
|
+
* * {@link Message} message - the message in question
|
2947
|
+
* * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update
|
2948
|
+
*/
|
2949
|
+
|
2896
2950
|
|
2897
2951
|
_createClass__default["default"](Message, [{
|
2898
2952
|
key: "sid",
|
@@ -3203,7 +3257,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3203
3257
|
var _getParticipant = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
3204
3258
|
var _this3 = this;
|
3205
3259
|
|
3206
|
-
var participant,
|
3260
|
+
var participant, errorMessage;
|
3207
3261
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
3208
3262
|
while (1) {
|
3209
3263
|
switch (_context.prev = _context.next) {
|
@@ -3248,26 +3302,26 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3248
3302
|
return _context.abrupt("return", participant);
|
3249
3303
|
|
3250
3304
|
case 11:
|
3251
|
-
|
3305
|
+
errorMessage = "Participant with ";
|
3252
3306
|
|
3253
3307
|
if (this.state.participantSid) {
|
3254
|
-
|
3308
|
+
errorMessage += "SID '" + this.state.participantSid + "' ";
|
3255
3309
|
}
|
3256
3310
|
|
3257
3311
|
if (this.state.author) {
|
3258
3312
|
if (this.state.participantSid) {
|
3259
|
-
|
3313
|
+
errorMessage += "or ";
|
3260
3314
|
}
|
3261
3315
|
|
3262
|
-
|
3316
|
+
errorMessage += "identity '" + this.state.author + "' ";
|
3263
3317
|
}
|
3264
3318
|
|
3265
|
-
if (
|
3266
|
-
|
3319
|
+
if (errorMessage === "Participant with ") {
|
3320
|
+
errorMessage = "Participant ";
|
3267
3321
|
}
|
3268
3322
|
|
3269
|
-
|
3270
|
-
throw new Error(
|
3323
|
+
errorMessage += "was not found";
|
3324
|
+
throw new Error(errorMessage);
|
3271
3325
|
|
3272
3326
|
case 17:
|
3273
3327
|
case "end":
|
@@ -3604,7 +3658,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3604
3658
|
pageToken: pageToken,
|
3605
3659
|
pageSize: pageSize
|
3606
3660
|
});
|
3607
|
-
}, response.body.meta.previous_token, response.body.meta.next_token
|
3661
|
+
}, response.body.meta.previous_token, response.body.meta.next_token));
|
3608
3662
|
|
3609
3663
|
case 6:
|
3610
3664
|
case "end":
|
@@ -4889,6 +4943,64 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
4889
4943
|
* Logger instance.
|
4890
4944
|
*/
|
4891
4945
|
|
4946
|
+
/**
|
4947
|
+
* Unique system identifier of the conversation.
|
4948
|
+
*/
|
4949
|
+
|
4950
|
+
/**
|
4951
|
+
* Conversation links for REST requests.
|
4952
|
+
* @internal
|
4953
|
+
*/
|
4954
|
+
|
4955
|
+
/**
|
4956
|
+
* Configuration of the client that the conversation belongs to.
|
4957
|
+
*/
|
4958
|
+
|
4959
|
+
/**
|
4960
|
+
* Conversation service objects.
|
4961
|
+
*/
|
4962
|
+
|
4963
|
+
/**
|
4964
|
+
* Internal state of the conversation.
|
4965
|
+
*/
|
4966
|
+
|
4967
|
+
/**
|
4968
|
+
* Name of the conversation entity document.
|
4969
|
+
*/
|
4970
|
+
|
4971
|
+
/**
|
4972
|
+
* Messages entity.
|
4973
|
+
*/
|
4974
|
+
|
4975
|
+
/**
|
4976
|
+
* Sync list containing messages.
|
4977
|
+
*/
|
4978
|
+
|
4979
|
+
/**
|
4980
|
+
* Map of participants.
|
4981
|
+
* @internal
|
4982
|
+
*/
|
4983
|
+
|
4984
|
+
/**
|
4985
|
+
* Participants entity.
|
4986
|
+
*/
|
4987
|
+
|
4988
|
+
/**
|
4989
|
+
* Sync map containing participants.
|
4990
|
+
*/
|
4991
|
+
|
4992
|
+
/**
|
4993
|
+
* Source of the most recent update.
|
4994
|
+
*/
|
4995
|
+
|
4996
|
+
/**
|
4997
|
+
* Promise for the conversation entity document.
|
4998
|
+
*/
|
4999
|
+
|
5000
|
+
/**
|
5001
|
+
* Conversation entity document.
|
5002
|
+
*/
|
5003
|
+
|
4892
5004
|
/**
|
4893
5005
|
* @param descriptor Conversation descriptor.
|
4894
5006
|
* @param sid Conversation SID.
|
@@ -4930,32 +5042,39 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
4930
5042
|
participants: _this._links.participants
|
4931
5043
|
};
|
4932
5044
|
_this._participants = new Map();
|
4933
|
-
_this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants,
|
5045
|
+
_this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants, // state leak
|
5046
|
+
participantsLinks, _this._services);
|
4934
5047
|
|
4935
|
-
_this._participantsEntity.on(
|
4936
|
-
return
|
5048
|
+
_this._participantsEntity.on(Conversation.participantJoined, function (participant) {
|
5049
|
+
return (// @todo update participants map here??
|
5050
|
+
_this.emit(Conversation.participantJoined, participant)
|
5051
|
+
);
|
4937
5052
|
});
|
4938
5053
|
|
4939
|
-
_this._participantsEntity.on(
|
4940
|
-
return
|
5054
|
+
_this._participantsEntity.on(Conversation.participantLeft, function (participant) {
|
5055
|
+
return (// @todo update participants map here??
|
5056
|
+
_this.emit(Conversation.participantLeft, participant)
|
5057
|
+
);
|
4941
5058
|
});
|
4942
5059
|
|
4943
|
-
_this._participantsEntity.on(
|
4944
|
-
return
|
5060
|
+
_this._participantsEntity.on(Conversation.participantUpdated, function (args) {
|
5061
|
+
return (// @todo update participants map here??
|
5062
|
+
_this.emit(Conversation.participantUpdated, args)
|
5063
|
+
);
|
4945
5064
|
});
|
4946
5065
|
|
4947
5066
|
_this._messagesEntity = new Messages(_assertThisInitialized__default["default"](_this), configuration, services);
|
4948
5067
|
|
4949
|
-
_this._messagesEntity.on(
|
5068
|
+
_this._messagesEntity.on(Conversation.messageAdded, function (message) {
|
4950
5069
|
return _this._onMessageAdded(message);
|
4951
5070
|
});
|
4952
5071
|
|
4953
|
-
_this._messagesEntity.on(
|
4954
|
-
return _this.emit(
|
5072
|
+
_this._messagesEntity.on(Conversation.messageUpdated, function (args) {
|
5073
|
+
return _this.emit(Conversation.messageUpdated, args);
|
4955
5074
|
});
|
4956
5075
|
|
4957
|
-
_this._messagesEntity.on(
|
4958
|
-
return _this.emit(
|
5076
|
+
_this._messagesEntity.on(Conversation.messageRemoved, function (message) {
|
5077
|
+
return _this.emit(Conversation.messageRemoved, message);
|
4959
5078
|
});
|
4960
5079
|
|
4961
5080
|
return _this;
|
@@ -5058,7 +5177,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
5058
5177
|
return (_this$_internalState$3 = this._internalState.notificationLevel) !== null && _this$_internalState$3 !== void 0 ? _this$_internalState$3 : "default";
|
5059
5178
|
}
|
5060
5179
|
/**
|
5061
|
-
* Conversation bindings.
|
5180
|
+
* Conversation bindings. An undocumented feature (for now).
|
5062
5181
|
* @internal
|
5063
5182
|
*/
|
5064
5183
|
|
@@ -6107,12 +6226,12 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6107
6226
|
case 6:
|
6108
6227
|
this._entity = _context25.sent;
|
6109
6228
|
|
6110
|
-
this._entity.on(
|
6229
|
+
this._entity.on(twilioSync.SyncDocument.updated, function (args) {
|
6111
6230
|
return _this2._update(args.data);
|
6112
6231
|
});
|
6113
6232
|
|
6114
|
-
this._entity.on(
|
6115
|
-
return _this2.emit(
|
6233
|
+
this._entity.on(twilioSync.SyncDocument.removed, function () {
|
6234
|
+
return _this2.emit(Conversation.removed, _this2);
|
6116
6235
|
});
|
6117
6236
|
|
6118
6237
|
this._update(this._entity.data);
|
@@ -6280,22 +6399,16 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6280
6399
|
while (1) {
|
6281
6400
|
switch (_context28.prev = _context28.next) {
|
6282
6401
|
case 0:
|
6283
|
-
if (
|
6284
|
-
|
6285
|
-
break;
|
6286
|
-
}
|
6287
|
-
|
6288
|
-
_context28.next = 3;
|
6289
|
-
return this._entity.close();
|
6402
|
+
if (this._entity) {
|
6403
|
+
this._entity.close();
|
6290
6404
|
|
6291
|
-
|
6292
|
-
|
6293
|
-
|
6405
|
+
this._entity = null;
|
6406
|
+
this._entityPromise = null;
|
6407
|
+
}
|
6294
6408
|
|
6295
|
-
case 5:
|
6296
6409
|
return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
6297
6410
|
|
6298
|
-
case
|
6411
|
+
case 2:
|
6299
6412
|
case "end":
|
6300
6413
|
return _context28.stop();
|
6301
6414
|
}
|
@@ -6464,7 +6577,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6464
6577
|
}
|
6465
6578
|
|
6466
6579
|
if (updateReasons.size > 0) {
|
6467
|
-
this.emit(
|
6580
|
+
this.emit(Conversation.updated, {
|
6468
6581
|
conversation: this,
|
6469
6582
|
updateReasons: _toConsumableArray__default["default"](updateReasons)
|
6470
6583
|
});
|
@@ -6496,7 +6609,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6496
6609
|
_iterator.f();
|
6497
6610
|
}
|
6498
6611
|
|
6499
|
-
this.emit(
|
6612
|
+
this.emit(Conversation.messageAdded, message);
|
6500
6613
|
}
|
6501
6614
|
/**
|
6502
6615
|
* Set last read message index.
|
@@ -6806,7 +6919,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6806
6919
|
return addConversation;
|
6807
6920
|
}()
|
6808
6921
|
/**
|
6809
|
-
* Fetch conversations list and instantiate all necessary objects
|
6922
|
+
* Fetch conversations' list and instantiate all necessary objects
|
6810
6923
|
*/
|
6811
6924
|
|
6812
6925
|
}, {
|
@@ -6827,12 +6940,12 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6827
6940
|
|
6828
6941
|
case 3:
|
6829
6942
|
map = _context2.sent;
|
6830
|
-
map.on(
|
6943
|
+
map.on(twilioSync.SyncMap.itemAdded, function (args) {
|
6831
6944
|
log$1.debug("itemAdded: ".concat(args.item.key));
|
6832
6945
|
|
6833
6946
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
6834
6947
|
});
|
6835
|
-
map.on(
|
6948
|
+
map.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
6836
6949
|
log$1.debug("itemRemoved: ".concat(args.key));
|
6837
6950
|
var sid = args.key;
|
6838
6951
|
|
@@ -6858,7 +6971,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6858
6971
|
|
6859
6972
|
conversation.emit("removed", conversation);
|
6860
6973
|
});
|
6861
|
-
map.on(
|
6974
|
+
map.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
6862
6975
|
log$1.debug("itemUpdated: ".concat(args.item.key));
|
6863
6976
|
|
6864
6977
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
@@ -7951,7 +8064,7 @@ function PushNotification(data) {
|
|
7951
8064
|
this.data = data.data || {};
|
7952
8065
|
});
|
7953
8066
|
|
7954
|
-
var version = "2.
|
8067
|
+
var version = "2.6.0-rc.0";
|
7955
8068
|
|
7956
8069
|
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; }
|
7957
8070
|
|
@@ -8824,6 +8937,22 @@ var EmailRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
|
8824
8937
|
* Type of recipient.
|
8825
8938
|
*/
|
8826
8939
|
|
8940
|
+
/**
|
8941
|
+
* Sid of the message that this recipient belongs to.
|
8942
|
+
*/
|
8943
|
+
|
8944
|
+
/**
|
8945
|
+
* Email recipient level.
|
8946
|
+
*/
|
8947
|
+
|
8948
|
+
/**
|
8949
|
+
* Name of the recipient.
|
8950
|
+
*/
|
8951
|
+
|
8952
|
+
/**
|
8953
|
+
* Address of the recipient.
|
8954
|
+
*/
|
8955
|
+
|
8827
8956
|
/**
|
8828
8957
|
* @internal
|
8829
8958
|
*/
|
@@ -8978,7 +9107,7 @@ var MessageRecipientsClient = /*#__PURE__*/function () {
|
|
8978
9107
|
pageToken: pageToken,
|
8979
9108
|
pageSize: pageSize
|
8980
9109
|
});
|
8981
|
-
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token
|
9110
|
+
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
|
8982
9111
|
|
8983
9112
|
case 8:
|
8984
9113
|
case "end":
|
@@ -9278,7 +9407,47 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9278
9407
|
*/
|
9279
9408
|
|
9280
9409
|
/**
|
9281
|
-
*
|
9410
|
+
* Promise that resolves on successful initialization.
|
9411
|
+
*/
|
9412
|
+
|
9413
|
+
/**
|
9414
|
+
* Options passed to the client.
|
9415
|
+
*/
|
9416
|
+
|
9417
|
+
/**
|
9418
|
+
* Client service objects.
|
9419
|
+
*/
|
9420
|
+
|
9421
|
+
/**
|
9422
|
+
* The user of the client.
|
9423
|
+
*/
|
9424
|
+
|
9425
|
+
/**
|
9426
|
+
* Resolves the {@link Client._ensureReady} promise.
|
9427
|
+
*/
|
9428
|
+
|
9429
|
+
/**
|
9430
|
+
* Rejects the {@link Client._ensureReady} promise.
|
9431
|
+
*/
|
9432
|
+
|
9433
|
+
/**
|
9434
|
+
* The current token of the client.
|
9435
|
+
*/
|
9436
|
+
|
9437
|
+
/**
|
9438
|
+
* The constructed configuration object.
|
9439
|
+
*/
|
9440
|
+
|
9441
|
+
/**
|
9442
|
+
* The Conversations entity.
|
9443
|
+
*/
|
9444
|
+
|
9445
|
+
/**
|
9446
|
+
* Promise that resolves when initial conversations are fetched.
|
9447
|
+
*/
|
9448
|
+
|
9449
|
+
/**
|
9450
|
+
* Returned Conversations Client instance is not yet fully initialized. Calling any
|
9282
9451
|
* operations will block until it is. Use connection events to monitor when
|
9283
9452
|
* client becomes fully available (connectionStateChanged with state
|
9284
9453
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
@@ -9368,16 +9537,16 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9368
9537
|
|
9369
9538
|
_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);
|
9370
9539
|
|
9371
|
-
_this._services.twilsockClient.on(
|
9372
|
-
return _this.emit(
|
9540
|
+
_this._services.twilsockClient.on(Client_1.tokenAboutToExpire, function () {
|
9541
|
+
return _this.emit(Client_1.tokenAboutToExpire);
|
9373
9542
|
});
|
9374
9543
|
|
9375
|
-
_this._services.twilsockClient.on(
|
9376
|
-
return _this.emit(
|
9544
|
+
_this._services.twilsockClient.on(Client_1.tokenExpired, function () {
|
9545
|
+
return _this.emit(Client_1.tokenExpired);
|
9377
9546
|
});
|
9378
9547
|
|
9379
|
-
_this._services.twilsockClient.on(
|
9380
|
-
return _this.emit(
|
9548
|
+
_this._services.twilsockClient.on(Client_1.connectionError, function (error) {
|
9549
|
+
return _this.emit(Client_1.connectionError, error);
|
9381
9550
|
});
|
9382
9551
|
|
9383
9552
|
_this._services.twilsockClient.on("stateChanged", function (state) {
|
@@ -9386,7 +9555,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9386
9555
|
if (state !== _this.connectionState) {
|
9387
9556
|
_this.connectionState = state;
|
9388
9557
|
|
9389
|
-
_this.emit(
|
9558
|
+
_this.emit(Client_1.connectionStateChanged, _this.connectionState);
|
9390
9559
|
}
|
9391
9560
|
});
|
9392
9561
|
|
@@ -9404,9 +9573,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9404
9573
|
var emitFailed = function emitFailed(error) {
|
9405
9574
|
_this._rejectEnsureReady(error);
|
9406
9575
|
|
9407
|
-
_this.emit(
|
9576
|
+
_this.emit(Client_1.stateChanged, "failed");
|
9408
9577
|
|
9409
|
-
_this.emit(
|
9578
|
+
_this.emit(Client_1.initFailed, {
|
9410
9579
|
error: error
|
9411
9580
|
});
|
9412
9581
|
};
|
@@ -9459,9 +9628,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9459
9628
|
|
9460
9629
|
_this._rejectEnsureReady(connectionError);
|
9461
9630
|
|
9462
|
-
_this.emit(
|
9631
|
+
_this.emit(Client_1.stateChanged, "failed");
|
9463
9632
|
|
9464
|
-
_this.emit(
|
9633
|
+
_this.emit(Client_1.initFailed, {
|
9465
9634
|
error: connectionError
|
9466
9635
|
});
|
9467
9636
|
|
@@ -9989,7 +10158,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9989
10158
|
return removePushRegistrations;
|
9990
10159
|
}()
|
9991
10160
|
/**
|
9992
|
-
*
|
10161
|
+
* Parse a push notification payload.
|
9993
10162
|
*/
|
9994
10163
|
|
9995
10164
|
}, {
|
@@ -10326,8 +10495,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10326
10495
|
|
10327
10496
|
this._resolveEnsureReady();
|
10328
10497
|
|
10329
|
-
this.emit(
|
10330
|
-
this.emit(
|
10498
|
+
this.emit(Client_1.stateChanged, "initialized");
|
10499
|
+
this.emit(Client_1.initialized);
|
10331
10500
|
|
10332
10501
|
case 36:
|
10333
10502
|
case "end":
|