@twilio/conversations 2.5.0-rc.8 → 2.5.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/builds/browser.js +84 -81
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +10 -9
- package/builds/lib.js +84 -81
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +11004 -11004
- package/builds/twilio-conversations.min.js +1 -1
- package/dist/client.js +12 -12
- package/dist/client.js.map +1 -1
- package/dist/conversation.js +21 -13
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +6 -5
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/participants.js +10 -9
- package/dist/data/participants.js.map +1 -1
- package/dist/message-recipients-client.js +1 -1
- package/dist/message-recipients-client.js.map +1 -1
- package/dist/message.js +9 -9
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/participant.js +9 -5
- package/dist/participant.js.map +1 -1
- package/dist/rest-paginator.js +3 -4
- package/dist/rest-paginator.js.map +1 -1
- package/docs/classes/Client.html +2 -2
- package/docs/index.html +1 -1
- package/package.json +10 -10
package/builds/lib.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import { SyncClient, SyncDocument, SyncList } from "twilio-sync";
|
2
3
|
import { LogLevelDesc } from "loglevel";
|
3
4
|
import { Transport, TwilsockClient, InitRegistration, TransportResult } from "twilsock";
|
@@ -1611,7 +1612,7 @@ declare class RestPaginator<T> implements Paginator<T> {
|
|
1611
1612
|
/**
|
1612
1613
|
* @internal
|
1613
1614
|
*/
|
1614
|
-
constructor(items: any, source: any, prevToken: any, nextToken: any
|
1615
|
+
constructor(items: any, source: any, prevToken: any, nextToken: any);
|
1615
1616
|
/**
|
1616
1617
|
* Request the next page. Does not modify the existing object.
|
1617
1618
|
*/
|
@@ -2119,11 +2120,6 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
2119
2120
|
* @internal
|
2120
2121
|
*/
|
2121
2122
|
readonly _links: ConversationLinks;
|
2122
|
-
/**
|
2123
|
-
* Map of participants.
|
2124
|
-
* @internal
|
2125
|
-
*/
|
2126
|
-
readonly _participants: Map<string, Participant>;
|
2127
2123
|
/**
|
2128
2124
|
* Configuration of the client that the conversation belongs to.
|
2129
2125
|
*/
|
@@ -2148,6 +2144,11 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
2148
2144
|
* Sync list containing messages.
|
2149
2145
|
*/
|
2150
2146
|
private _messagesList?;
|
2147
|
+
/**
|
2148
|
+
* Map of participants.
|
2149
|
+
* @internal
|
2150
|
+
*/
|
2151
|
+
readonly _participants: Map<string, Participant>;
|
2151
2152
|
/**
|
2152
2153
|
* Participants entity.
|
2153
2154
|
*/
|
@@ -2218,7 +2219,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
2218
2219
|
*/
|
2219
2220
|
get notificationLevel(): NotificationLevel;
|
2220
2221
|
/**
|
2221
|
-
* Conversation bindings.
|
2222
|
+
* Conversation bindings. An undocumented feature (for now).
|
2222
2223
|
* @internal
|
2223
2224
|
*/
|
2224
2225
|
get bindings(): ConversationBindings;
|
@@ -2974,7 +2975,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2974
2975
|
*/
|
2975
2976
|
private _conversationsPromise;
|
2976
2977
|
/**
|
2977
|
-
* Returned Conversations instance is not yet fully initialized. Calling any
|
2978
|
+
* Returned Conversations Client instance is not yet fully initialized. Calling any
|
2978
2979
|
* operations will block until it is. Use connection events to monitor when
|
2979
2980
|
* client becomes fully available (connectionStateChanged with state
|
2980
2981
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
@@ -3101,7 +3102,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
3101
3102
|
*/
|
3102
3103
|
removePushRegistrations(channelType: ChannelType, registrationId: string): Promise<void>;
|
3103
3104
|
/**
|
3104
|
-
*
|
3105
|
+
* Parse a push notification payload.
|
3105
3106
|
*/
|
3106
3107
|
parsePushNotification: typeof Client.parsePushNotification;
|
3107
3108
|
/**
|
package/builds/lib.js
CHANGED
@@ -1444,8 +1444,9 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1444
1444
|
}
|
1445
1445
|
|
1446
1446
|
this.state.isTyping = true;
|
1447
|
-
this.emit(
|
1448
|
-
this.conversation.emit(
|
1447
|
+
this.emit(Participant.typingStarted, this);
|
1448
|
+
this.conversation.emit(Conversation.typingStarted, this); // @fixme layering violation
|
1449
|
+
|
1449
1450
|
this.state.typingTimeout = Number(setTimeout(function () {
|
1450
1451
|
return _this2._endTyping();
|
1451
1452
|
}, timeout));
|
@@ -1464,8 +1465,8 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1464
1465
|
}
|
1465
1466
|
|
1466
1467
|
this.state.isTyping = false;
|
1467
|
-
this.emit(
|
1468
|
-
this.conversation.emit(
|
1468
|
+
this.emit(Participant.typingEnded, this);
|
1469
|
+
this.conversation.emit(Conversation.typingEnded, this);
|
1469
1470
|
clearInterval(this.state.typingTimeout);
|
1470
1471
|
this.state.typingTimeout = null;
|
1471
1472
|
}
|
@@ -1524,7 +1525,7 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1524
1525
|
}
|
1525
1526
|
|
1526
1527
|
if (updateReasons.length > 0) {
|
1527
|
-
this.emit(
|
1528
|
+
this.emit(Participant.updated, {
|
1528
1529
|
participant: this,
|
1529
1530
|
updateReasons: updateReasons
|
1530
1531
|
});
|
@@ -1660,7 +1661,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1660
1661
|
|
1661
1662
|
var _super = _createSuper$7(Participants);
|
1662
1663
|
|
1663
|
-
|
1664
|
+
// passed in from Conversation
|
1665
|
+
function Participants(conversation, participants, links, services) {
|
1664
1666
|
var _this;
|
1665
1667
|
|
1666
1668
|
_classCallCheck__default["default"](this, Participants);
|
@@ -1672,7 +1674,6 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1672
1674
|
_this.conversation = conversation;
|
1673
1675
|
_this.participants = participants;
|
1674
1676
|
_this.links = links;
|
1675
|
-
_this.configuration = configuration;
|
1676
1677
|
_this.services = services;
|
1677
1678
|
return _this;
|
1678
1679
|
}
|
@@ -1723,14 +1724,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1723
1724
|
mode: "open_existing"
|
1724
1725
|
}) : Promise.resolve(arg);
|
1725
1726
|
return this.rosterEntityPromise = this.rosterEntityPromise || participantsMapPromise.then(function (rosterMap) {
|
1726
|
-
rosterMap.on(
|
1727
|
+
rosterMap.on(twilioSync.SyncMap.itemAdded, function (args) {
|
1727
1728
|
log$4.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
|
1728
1729
|
|
1729
1730
|
_this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
|
1730
|
-
_this2.emit(
|
1731
|
+
_this2.emit(Conversation.participantJoined, participant);
|
1731
1732
|
});
|
1732
1733
|
});
|
1733
|
-
rosterMap.on(
|
1734
|
+
rosterMap.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
1734
1735
|
log$4.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
|
1735
1736
|
var participantSid = args.key;
|
1736
1737
|
|
@@ -1746,12 +1747,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1746
1747
|
return;
|
1747
1748
|
}
|
1748
1749
|
|
1749
|
-
_this2.emit(
|
1750
|
+
_this2.emit(Conversation.participantLeft, leftParticipant);
|
1750
1751
|
});
|
1751
|
-
rosterMap.on(
|
1752
|
+
rosterMap.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
1752
1753
|
log$4.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
|
1753
1754
|
|
1754
|
-
_this2.upsertParticipant(args.item.key, args.item.data)
|
1755
|
+
_this2.upsertParticipant(args.item.key, args.item.data).catch(function (e) {
|
1756
|
+
return log$4.error(e);
|
1757
|
+
});
|
1755
1758
|
});
|
1756
1759
|
var participantsPromises = [];
|
1757
1760
|
|
@@ -1845,8 +1848,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1845
1848
|
};
|
1846
1849
|
participant = new Participant(data, participantSid, this.conversation, links, this.services);
|
1847
1850
|
this.participants.set(participantSid, participant);
|
1848
|
-
participant.on(
|
1849
|
-
return _this3.emit(
|
1851
|
+
participant.on(Participant.updated, function (args) {
|
1852
|
+
return _this3.emit(Conversation.participantUpdated, args);
|
1850
1853
|
});
|
1851
1854
|
return _context3.abrupt("return", participant);
|
1852
1855
|
|
@@ -2457,15 +2460,14 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2457
2460
|
/**
|
2458
2461
|
* @internal
|
2459
2462
|
*/
|
2460
|
-
function RestPaginator(items, source, prevToken, nextToken
|
2463
|
+
function RestPaginator(items, source, prevToken, nextToken) {
|
2461
2464
|
_classCallCheck__default["default"](this, RestPaginator);
|
2462
2465
|
|
2463
2466
|
this.state = {
|
2464
2467
|
prevToken: prevToken,
|
2465
2468
|
nextToken: nextToken,
|
2466
2469
|
source: source,
|
2467
|
-
items: items
|
2468
|
-
pageSize: pageSize
|
2470
|
+
items: items
|
2469
2471
|
};
|
2470
2472
|
}
|
2471
2473
|
/**
|
@@ -2503,7 +2505,7 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2503
2505
|
}, {
|
2504
2506
|
key: "nextPage",
|
2505
2507
|
value: function nextPage() {
|
2506
|
-
return this.hasNextPage ? this.state.source(this.state.nextToken
|
2508
|
+
return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error("No next page"));
|
2507
2509
|
}
|
2508
2510
|
/**
|
2509
2511
|
* Request the previous page. Does not modify the existing object.
|
@@ -2512,7 +2514,7 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2512
2514
|
}, {
|
2513
2515
|
key: "prevPage",
|
2514
2516
|
value: function prevPage() {
|
2515
|
-
return this.hasPrevPage ? this.state.source(this.state.prevToken
|
2517
|
+
return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error("No previous page"));
|
2516
2518
|
}
|
2517
2519
|
}]);
|
2518
2520
|
|
@@ -3203,7 +3205,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3203
3205
|
var _getParticipant = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
3204
3206
|
var _this3 = this;
|
3205
3207
|
|
3206
|
-
var participant,
|
3208
|
+
var participant, errorMessage;
|
3207
3209
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
3208
3210
|
while (1) {
|
3209
3211
|
switch (_context.prev = _context.next) {
|
@@ -3248,26 +3250,26 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3248
3250
|
return _context.abrupt("return", participant);
|
3249
3251
|
|
3250
3252
|
case 11:
|
3251
|
-
|
3253
|
+
errorMessage = "Participant with ";
|
3252
3254
|
|
3253
3255
|
if (this.state.participantSid) {
|
3254
|
-
|
3256
|
+
errorMessage += "SID '" + this.state.participantSid + "' ";
|
3255
3257
|
}
|
3256
3258
|
|
3257
3259
|
if (this.state.author) {
|
3258
3260
|
if (this.state.participantSid) {
|
3259
|
-
|
3261
|
+
errorMessage += "or ";
|
3260
3262
|
}
|
3261
3263
|
|
3262
|
-
|
3264
|
+
errorMessage += "identity '" + this.state.author + "' ";
|
3263
3265
|
}
|
3264
3266
|
|
3265
|
-
if (
|
3266
|
-
|
3267
|
+
if (errorMessage === "Participant with ") {
|
3268
|
+
errorMessage = "Participant ";
|
3267
3269
|
}
|
3268
3270
|
|
3269
|
-
|
3270
|
-
throw new Error(
|
3271
|
+
errorMessage += "was not found";
|
3272
|
+
throw new Error(errorMessage);
|
3271
3273
|
|
3272
3274
|
case 17:
|
3273
3275
|
case "end":
|
@@ -3604,7 +3606,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3604
3606
|
pageToken: pageToken,
|
3605
3607
|
pageSize: pageSize
|
3606
3608
|
});
|
3607
|
-
}, response.body.meta.previous_token, response.body.meta.next_token
|
3609
|
+
}, response.body.meta.previous_token, response.body.meta.next_token));
|
3608
3610
|
|
3609
3611
|
case 6:
|
3610
3612
|
case "end":
|
@@ -4930,32 +4932,39 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
4930
4932
|
participants: _this._links.participants
|
4931
4933
|
};
|
4932
4934
|
_this._participants = new Map();
|
4933
|
-
_this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants,
|
4935
|
+
_this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants, // state leak
|
4936
|
+
participantsLinks, _this._services);
|
4934
4937
|
|
4935
|
-
_this._participantsEntity.on(
|
4936
|
-
return
|
4938
|
+
_this._participantsEntity.on(Conversation.participantJoined, function (participant) {
|
4939
|
+
return (// @todo update participants map here??
|
4940
|
+
_this.emit(Conversation.participantJoined, participant)
|
4941
|
+
);
|
4937
4942
|
});
|
4938
4943
|
|
4939
|
-
_this._participantsEntity.on(
|
4940
|
-
return
|
4944
|
+
_this._participantsEntity.on(Conversation.participantLeft, function (participant) {
|
4945
|
+
return (// @todo update participants map here??
|
4946
|
+
_this.emit(Conversation.participantLeft, participant)
|
4947
|
+
);
|
4941
4948
|
});
|
4942
4949
|
|
4943
|
-
_this._participantsEntity.on(
|
4944
|
-
return
|
4950
|
+
_this._participantsEntity.on(Conversation.participantUpdated, function (args) {
|
4951
|
+
return (// @todo update participants map here??
|
4952
|
+
_this.emit(Conversation.participantUpdated, args)
|
4953
|
+
);
|
4945
4954
|
});
|
4946
4955
|
|
4947
4956
|
_this._messagesEntity = new Messages(_assertThisInitialized__default["default"](_this), configuration, services);
|
4948
4957
|
|
4949
|
-
_this._messagesEntity.on(
|
4958
|
+
_this._messagesEntity.on(Conversation.messageAdded, function (message) {
|
4950
4959
|
return _this._onMessageAdded(message);
|
4951
4960
|
});
|
4952
4961
|
|
4953
|
-
_this._messagesEntity.on(
|
4954
|
-
return _this.emit(
|
4962
|
+
_this._messagesEntity.on(Conversation.messageUpdated, function (args) {
|
4963
|
+
return _this.emit(Conversation.messageUpdated, args);
|
4955
4964
|
});
|
4956
4965
|
|
4957
|
-
_this._messagesEntity.on(
|
4958
|
-
return _this.emit(
|
4966
|
+
_this._messagesEntity.on(Conversation.messageRemoved, function (message) {
|
4967
|
+
return _this.emit(Conversation.messageRemoved, message);
|
4959
4968
|
});
|
4960
4969
|
|
4961
4970
|
return _this;
|
@@ -5058,7 +5067,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
5058
5067
|
return (_this$_internalState$3 = this._internalState.notificationLevel) !== null && _this$_internalState$3 !== void 0 ? _this$_internalState$3 : "default";
|
5059
5068
|
}
|
5060
5069
|
/**
|
5061
|
-
* Conversation bindings.
|
5070
|
+
* Conversation bindings. An undocumented feature (for now).
|
5062
5071
|
* @internal
|
5063
5072
|
*/
|
5064
5073
|
|
@@ -6107,12 +6116,12 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6107
6116
|
case 6:
|
6108
6117
|
this._entity = _context25.sent;
|
6109
6118
|
|
6110
|
-
this._entity.on(
|
6119
|
+
this._entity.on(twilioSync.SyncDocument.updated, function (args) {
|
6111
6120
|
return _this2._update(args.data);
|
6112
6121
|
});
|
6113
6122
|
|
6114
|
-
this._entity.on(
|
6115
|
-
return _this2.emit(
|
6123
|
+
this._entity.on(twilioSync.SyncDocument.removed, function () {
|
6124
|
+
return _this2.emit(Conversation.removed, _this2);
|
6116
6125
|
});
|
6117
6126
|
|
6118
6127
|
this._update(this._entity.data);
|
@@ -6280,22 +6289,16 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6280
6289
|
while (1) {
|
6281
6290
|
switch (_context28.prev = _context28.next) {
|
6282
6291
|
case 0:
|
6283
|
-
if (
|
6284
|
-
|
6285
|
-
break;
|
6286
|
-
}
|
6287
|
-
|
6288
|
-
_context28.next = 3;
|
6289
|
-
return this._entity.close();
|
6292
|
+
if (this._entity) {
|
6293
|
+
this._entity.close();
|
6290
6294
|
|
6291
|
-
|
6292
|
-
|
6293
|
-
|
6295
|
+
this._entity = null;
|
6296
|
+
this._entityPromise = null;
|
6297
|
+
}
|
6294
6298
|
|
6295
|
-
case 5:
|
6296
6299
|
return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
6297
6300
|
|
6298
|
-
case
|
6301
|
+
case 2:
|
6299
6302
|
case "end":
|
6300
6303
|
return _context28.stop();
|
6301
6304
|
}
|
@@ -6464,7 +6467,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6464
6467
|
}
|
6465
6468
|
|
6466
6469
|
if (updateReasons.size > 0) {
|
6467
|
-
this.emit(
|
6470
|
+
this.emit(Conversation.updated, {
|
6468
6471
|
conversation: this,
|
6469
6472
|
updateReasons: _toConsumableArray__default["default"](updateReasons)
|
6470
6473
|
});
|
@@ -6496,7 +6499,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6496
6499
|
_iterator.f();
|
6497
6500
|
}
|
6498
6501
|
|
6499
|
-
this.emit(
|
6502
|
+
this.emit(Conversation.messageAdded, message);
|
6500
6503
|
}
|
6501
6504
|
/**
|
6502
6505
|
* Set last read message index.
|
@@ -6806,7 +6809,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6806
6809
|
return addConversation;
|
6807
6810
|
}()
|
6808
6811
|
/**
|
6809
|
-
* Fetch conversations list and instantiate all necessary objects
|
6812
|
+
* Fetch conversations' list and instantiate all necessary objects
|
6810
6813
|
*/
|
6811
6814
|
|
6812
6815
|
}, {
|
@@ -6827,12 +6830,12 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6827
6830
|
|
6828
6831
|
case 3:
|
6829
6832
|
map = _context2.sent;
|
6830
|
-
map.on(
|
6833
|
+
map.on(twilioSync.SyncMap.itemAdded, function (args) {
|
6831
6834
|
log$1.debug("itemAdded: ".concat(args.item.key));
|
6832
6835
|
|
6833
6836
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
6834
6837
|
});
|
6835
|
-
map.on(
|
6838
|
+
map.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
6836
6839
|
log$1.debug("itemRemoved: ".concat(args.key));
|
6837
6840
|
var sid = args.key;
|
6838
6841
|
|
@@ -6858,7 +6861,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6858
6861
|
|
6859
6862
|
conversation.emit("removed", conversation);
|
6860
6863
|
});
|
6861
|
-
map.on(
|
6864
|
+
map.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
6862
6865
|
log$1.debug("itemUpdated: ".concat(args.item.key));
|
6863
6866
|
|
6864
6867
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
@@ -7951,7 +7954,7 @@ function PushNotification(data) {
|
|
7951
7954
|
this.data = data.data || {};
|
7952
7955
|
});
|
7953
7956
|
|
7954
|
-
var version = "2.5.0
|
7957
|
+
var version = "2.5.0";
|
7955
7958
|
|
7956
7959
|
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
7960
|
|
@@ -8978,7 +8981,7 @@ var MessageRecipientsClient = /*#__PURE__*/function () {
|
|
8978
8981
|
pageToken: pageToken,
|
8979
8982
|
pageSize: pageSize
|
8980
8983
|
});
|
8981
|
-
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token
|
8984
|
+
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
|
8982
8985
|
|
8983
8986
|
case 8:
|
8984
8987
|
case "end":
|
@@ -9278,7 +9281,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9278
9281
|
*/
|
9279
9282
|
|
9280
9283
|
/**
|
9281
|
-
* Returned Conversations instance is not yet fully initialized. Calling any
|
9284
|
+
* Returned Conversations Client instance is not yet fully initialized. Calling any
|
9282
9285
|
* operations will block until it is. Use connection events to monitor when
|
9283
9286
|
* client becomes fully available (connectionStateChanged with state
|
9284
9287
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
@@ -9368,16 +9371,16 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9368
9371
|
|
9369
9372
|
_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
9373
|
|
9371
|
-
_this._services.twilsockClient.on(
|
9372
|
-
return _this.emit(
|
9374
|
+
_this._services.twilsockClient.on(Client_1.tokenAboutToExpire, function () {
|
9375
|
+
return _this.emit(Client_1.tokenAboutToExpire);
|
9373
9376
|
});
|
9374
9377
|
|
9375
|
-
_this._services.twilsockClient.on(
|
9376
|
-
return _this.emit(
|
9378
|
+
_this._services.twilsockClient.on(Client_1.tokenExpired, function () {
|
9379
|
+
return _this.emit(Client_1.tokenExpired);
|
9377
9380
|
});
|
9378
9381
|
|
9379
|
-
_this._services.twilsockClient.on(
|
9380
|
-
return _this.emit(
|
9382
|
+
_this._services.twilsockClient.on(Client_1.connectionError, function (error) {
|
9383
|
+
return _this.emit(Client_1.connectionError, error);
|
9381
9384
|
});
|
9382
9385
|
|
9383
9386
|
_this._services.twilsockClient.on("stateChanged", function (state) {
|
@@ -9386,7 +9389,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9386
9389
|
if (state !== _this.connectionState) {
|
9387
9390
|
_this.connectionState = state;
|
9388
9391
|
|
9389
|
-
_this.emit(
|
9392
|
+
_this.emit(Client_1.connectionStateChanged, _this.connectionState);
|
9390
9393
|
}
|
9391
9394
|
});
|
9392
9395
|
|
@@ -9404,9 +9407,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9404
9407
|
var emitFailed = function emitFailed(error) {
|
9405
9408
|
_this._rejectEnsureReady(error);
|
9406
9409
|
|
9407
|
-
_this.emit(
|
9410
|
+
_this.emit(Client_1.stateChanged, "failed");
|
9408
9411
|
|
9409
|
-
_this.emit(
|
9412
|
+
_this.emit(Client_1.initFailed, {
|
9410
9413
|
error: error
|
9411
9414
|
});
|
9412
9415
|
};
|
@@ -9459,9 +9462,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9459
9462
|
|
9460
9463
|
_this._rejectEnsureReady(connectionError);
|
9461
9464
|
|
9462
|
-
_this.emit(
|
9465
|
+
_this.emit(Client_1.stateChanged, "failed");
|
9463
9466
|
|
9464
|
-
_this.emit(
|
9467
|
+
_this.emit(Client_1.initFailed, {
|
9465
9468
|
error: connectionError
|
9466
9469
|
});
|
9467
9470
|
|
@@ -9989,7 +9992,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9989
9992
|
return removePushRegistrations;
|
9990
9993
|
}()
|
9991
9994
|
/**
|
9992
|
-
*
|
9995
|
+
* Parse a push notification payload.
|
9993
9996
|
*/
|
9994
9997
|
|
9995
9998
|
}, {
|
@@ -10326,8 +10329,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10326
10329
|
|
10327
10330
|
this._resolveEnsureReady();
|
10328
10331
|
|
10329
|
-
this.emit(
|
10330
|
-
this.emit(
|
10332
|
+
this.emit(Client_1.stateChanged, "initialized");
|
10333
|
+
this.emit(Client_1.initialized);
|
10331
10334
|
|
10332
10335
|
case 36:
|
10333
10336
|
case "end":
|