@twilio/conversations 2.5.0-rc.0 → 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 +98 -89
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +15 -11
- package/builds/lib.js +98 -89
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +119 -104
- 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 +26 -17
- 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/logger.js +6 -2
- package/dist/logger.js.map +1 -1
- package/dist/message-recipients-client.js +2 -2
- package/dist/message-recipients-client.js.map +1 -1
- package/dist/message.js +8 -8
- 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/util/index.js.map +1 -1
- package/docs/classes/Client.html +2 -2
- package/docs/classes/Conversation.html +10 -1
- package/docs/index.html +1 -1
- package/package.json +9 -8
package/builds/lib.d.ts
CHANGED
@@ -1241,6 +1241,9 @@ interface Paginator<T> {
|
|
1241
1241
|
*/
|
1242
1242
|
prevPage(): Promise<Paginator<T>>;
|
1243
1243
|
}
|
1244
|
+
interface PaginatorOptions {
|
1245
|
+
pageSize?: number;
|
1246
|
+
}
|
1244
1247
|
type MessageRecipientsClientServices = {
|
1245
1248
|
commandExecutor: CommandExecutor;
|
1246
1249
|
};
|
@@ -1311,7 +1314,7 @@ declare class MessageRecipientsClient {
|
|
1311
1314
|
getRecipientsFromMessage(conversationSid: string, messageSid: string): Promise<RecipientDescriptor[]>;
|
1312
1315
|
getRecipientsFromConversation(conversationSid: string, paginatorOptions?: {
|
1313
1316
|
pageToken?: string;
|
1314
|
-
pageSize?:
|
1317
|
+
pageSize?: number;
|
1315
1318
|
}): Promise<Paginator<RecipientDescriptor>>;
|
1316
1319
|
private _wrapResponse;
|
1317
1320
|
}
|
@@ -2117,11 +2120,6 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
2117
2120
|
* @internal
|
2118
2121
|
*/
|
2119
2122
|
readonly _links: ConversationLinks;
|
2120
|
-
/**
|
2121
|
-
* Map of participants.
|
2122
|
-
* @internal
|
2123
|
-
*/
|
2124
|
-
readonly _participants: Map<string, Participant>;
|
2125
2123
|
/**
|
2126
2124
|
* Configuration of the client that the conversation belongs to.
|
2127
2125
|
*/
|
@@ -2146,6 +2144,11 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
2146
2144
|
* Sync list containing messages.
|
2147
2145
|
*/
|
2148
2146
|
private _messagesList?;
|
2147
|
+
/**
|
2148
|
+
* Map of participants.
|
2149
|
+
* @internal
|
2150
|
+
*/
|
2151
|
+
readonly _participants: Map<string, Participant>;
|
2149
2152
|
/**
|
2150
2153
|
* Participants entity.
|
2151
2154
|
*/
|
@@ -2216,7 +2219,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
2216
2219
|
*/
|
2217
2220
|
get notificationLevel(): NotificationLevel;
|
2218
2221
|
/**
|
2219
|
-
* Conversation bindings.
|
2222
|
+
* Conversation bindings. An undocumented feature (for now).
|
2220
2223
|
* @internal
|
2221
2224
|
*/
|
2222
2225
|
get bindings(): ConversationBindings;
|
@@ -2425,12 +2428,13 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
2425
2428
|
updateUniqueName(uniqueName: string | null): Promise<Conversation>;
|
2426
2429
|
/**
|
2427
2430
|
* Get recipients of all messages in the conversation.
|
2431
|
+
* @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.
|
2428
2432
|
*/
|
2429
|
-
getMessageRecipients(): Promise<Paginator<RecipientDescriptor>>;
|
2433
|
+
getMessageRecipients(options?: PaginatorOptions): Promise<Paginator<RecipientDescriptor>>;
|
2430
2434
|
/**
|
2431
2435
|
* Load and subscribe to this conversation and do not subscribe to its
|
2432
2436
|
* participants and messages. This or _subscribeStreams will need to be called
|
2433
|
-
* before any events
|
2437
|
+
* before any events in the conversation will fire.
|
2434
2438
|
* @internal
|
2435
2439
|
*/
|
2436
2440
|
_subscribe(): Promise<SyncDocument>;
|
@@ -2971,7 +2975,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2971
2975
|
*/
|
2972
2976
|
private _conversationsPromise;
|
2973
2977
|
/**
|
2974
|
-
* Returned Conversations instance is not yet fully initialized. Calling any
|
2978
|
+
* Returned Conversations Client instance is not yet fully initialized. Calling any
|
2975
2979
|
* operations will block until it is. Use connection events to monitor when
|
2976
2980
|
* client becomes fully available (connectionStateChanged with state
|
2977
2981
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
@@ -3098,7 +3102,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
3098
3102
|
*/
|
3099
3103
|
removePushRegistrations(channelType: ChannelType, registrationId: string): Promise<void>;
|
3100
3104
|
/**
|
3101
|
-
*
|
3105
|
+
* Parse a push notification payload.
|
3102
3106
|
*/
|
3103
3107
|
parsePushNotification: typeof Client.parsePushNotification;
|
3104
3108
|
/**
|
package/builds/lib.js
CHANGED
@@ -293,11 +293,13 @@ var Logger = /*#__PURE__*/function () {
|
|
293
293
|
}, {
|
294
294
|
key: "trace",
|
295
295
|
value: function trace() {
|
296
|
-
|
297
|
-
args
|
298
|
-
|
296
|
+
if (log$7.getLevel() == log$7.levels.TRACE) {
|
297
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
298
|
+
args[_key] = arguments[_key];
|
299
|
+
}
|
299
300
|
|
300
|
-
|
301
|
+
log$7.debug.apply(null, prepareLine(this.prefix + "T", args));
|
302
|
+
}
|
301
303
|
}
|
302
304
|
}, {
|
303
305
|
key: "debug",
|
@@ -348,11 +350,13 @@ var Logger = /*#__PURE__*/function () {
|
|
348
350
|
}, {
|
349
351
|
key: "trace",
|
350
352
|
value: function trace() {
|
351
|
-
|
352
|
-
args
|
353
|
-
|
353
|
+
if (log$7.getLevel() == log$7.levels.TRACE) {
|
354
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
355
|
+
args[_key6] = arguments[_key6];
|
356
|
+
}
|
354
357
|
|
355
|
-
|
358
|
+
log$7.debug.apply(null, prepareLine("T", args));
|
359
|
+
}
|
356
360
|
}
|
357
361
|
}, {
|
358
362
|
key: "debug",
|
@@ -1440,8 +1444,9 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1440
1444
|
}
|
1441
1445
|
|
1442
1446
|
this.state.isTyping = true;
|
1443
|
-
this.emit(
|
1444
|
-
this.conversation.emit(
|
1447
|
+
this.emit(Participant.typingStarted, this);
|
1448
|
+
this.conversation.emit(Conversation.typingStarted, this); // @fixme layering violation
|
1449
|
+
|
1445
1450
|
this.state.typingTimeout = Number(setTimeout(function () {
|
1446
1451
|
return _this2._endTyping();
|
1447
1452
|
}, timeout));
|
@@ -1460,8 +1465,8 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1460
1465
|
}
|
1461
1466
|
|
1462
1467
|
this.state.isTyping = false;
|
1463
|
-
this.emit(
|
1464
|
-
this.conversation.emit(
|
1468
|
+
this.emit(Participant.typingEnded, this);
|
1469
|
+
this.conversation.emit(Conversation.typingEnded, this);
|
1465
1470
|
clearInterval(this.state.typingTimeout);
|
1466
1471
|
this.state.typingTimeout = null;
|
1467
1472
|
}
|
@@ -1520,7 +1525,7 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1520
1525
|
}
|
1521
1526
|
|
1522
1527
|
if (updateReasons.length > 0) {
|
1523
|
-
this.emit(
|
1528
|
+
this.emit(Participant.updated, {
|
1524
1529
|
participant: this,
|
1525
1530
|
updateReasons: updateReasons
|
1526
1531
|
});
|
@@ -1656,7 +1661,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1656
1661
|
|
1657
1662
|
var _super = _createSuper$7(Participants);
|
1658
1663
|
|
1659
|
-
|
1664
|
+
// passed in from Conversation
|
1665
|
+
function Participants(conversation, participants, links, services) {
|
1660
1666
|
var _this;
|
1661
1667
|
|
1662
1668
|
_classCallCheck__default["default"](this, Participants);
|
@@ -1668,7 +1674,6 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1668
1674
|
_this.conversation = conversation;
|
1669
1675
|
_this.participants = participants;
|
1670
1676
|
_this.links = links;
|
1671
|
-
_this.configuration = configuration;
|
1672
1677
|
_this.services = services;
|
1673
1678
|
return _this;
|
1674
1679
|
}
|
@@ -1719,14 +1724,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1719
1724
|
mode: "open_existing"
|
1720
1725
|
}) : Promise.resolve(arg);
|
1721
1726
|
return this.rosterEntityPromise = this.rosterEntityPromise || participantsMapPromise.then(function (rosterMap) {
|
1722
|
-
rosterMap.on(
|
1727
|
+
rosterMap.on(twilioSync.SyncMap.itemAdded, function (args) {
|
1723
1728
|
log$4.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
|
1724
1729
|
|
1725
1730
|
_this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
|
1726
|
-
_this2.emit(
|
1731
|
+
_this2.emit(Conversation.participantJoined, participant);
|
1727
1732
|
});
|
1728
1733
|
});
|
1729
|
-
rosterMap.on(
|
1734
|
+
rosterMap.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
1730
1735
|
log$4.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
|
1731
1736
|
var participantSid = args.key;
|
1732
1737
|
|
@@ -1742,12 +1747,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1742
1747
|
return;
|
1743
1748
|
}
|
1744
1749
|
|
1745
|
-
_this2.emit(
|
1750
|
+
_this2.emit(Conversation.participantLeft, leftParticipant);
|
1746
1751
|
});
|
1747
|
-
rosterMap.on(
|
1752
|
+
rosterMap.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
1748
1753
|
log$4.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
|
1749
1754
|
|
1750
|
-
_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
|
+
});
|
1751
1758
|
});
|
1752
1759
|
var participantsPromises = [];
|
1753
1760
|
|
@@ -1841,8 +1848,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
1841
1848
|
};
|
1842
1849
|
participant = new Participant(data, participantSid, this.conversation, links, this.services);
|
1843
1850
|
this.participants.set(participantSid, participant);
|
1844
|
-
participant.on(
|
1845
|
-
return _this3.emit(
|
1851
|
+
participant.on(Participant.updated, function (args) {
|
1852
|
+
return _this3.emit(Conversation.participantUpdated, args);
|
1846
1853
|
});
|
1847
1854
|
return _context3.abrupt("return", participant);
|
1848
1855
|
|
@@ -3198,7 +3205,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3198
3205
|
var _getParticipant = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
3199
3206
|
var _this3 = this;
|
3200
3207
|
|
3201
|
-
var participant,
|
3208
|
+
var participant, errorMessage;
|
3202
3209
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
3203
3210
|
while (1) {
|
3204
3211
|
switch (_context.prev = _context.next) {
|
@@ -3243,26 +3250,26 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3243
3250
|
return _context.abrupt("return", participant);
|
3244
3251
|
|
3245
3252
|
case 11:
|
3246
|
-
|
3253
|
+
errorMessage = "Participant with ";
|
3247
3254
|
|
3248
3255
|
if (this.state.participantSid) {
|
3249
|
-
|
3256
|
+
errorMessage += "SID '" + this.state.participantSid + "' ";
|
3250
3257
|
}
|
3251
3258
|
|
3252
3259
|
if (this.state.author) {
|
3253
3260
|
if (this.state.participantSid) {
|
3254
|
-
|
3261
|
+
errorMessage += "or ";
|
3255
3262
|
}
|
3256
3263
|
|
3257
|
-
|
3264
|
+
errorMessage += "identity '" + this.state.author + "' ";
|
3258
3265
|
}
|
3259
3266
|
|
3260
|
-
if (
|
3261
|
-
|
3267
|
+
if (errorMessage === "Participant with ") {
|
3268
|
+
errorMessage = "Participant ";
|
3262
3269
|
}
|
3263
3270
|
|
3264
|
-
|
3265
|
-
throw new Error(
|
3271
|
+
errorMessage += "was not found";
|
3272
|
+
throw new Error(errorMessage);
|
3266
3273
|
|
3267
3274
|
case 17:
|
3268
3275
|
case "end":
|
@@ -4925,32 +4932,39 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
4925
4932
|
participants: _this._links.participants
|
4926
4933
|
};
|
4927
4934
|
_this._participants = new Map();
|
4928
|
-
_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);
|
4929
4937
|
|
4930
|
-
_this._participantsEntity.on(
|
4931
|
-
return
|
4938
|
+
_this._participantsEntity.on(Conversation.participantJoined, function (participant) {
|
4939
|
+
return (// @todo update participants map here??
|
4940
|
+
_this.emit(Conversation.participantJoined, participant)
|
4941
|
+
);
|
4932
4942
|
});
|
4933
4943
|
|
4934
|
-
_this._participantsEntity.on(
|
4935
|
-
return
|
4944
|
+
_this._participantsEntity.on(Conversation.participantLeft, function (participant) {
|
4945
|
+
return (// @todo update participants map here??
|
4946
|
+
_this.emit(Conversation.participantLeft, participant)
|
4947
|
+
);
|
4936
4948
|
});
|
4937
4949
|
|
4938
|
-
_this._participantsEntity.on(
|
4939
|
-
return
|
4950
|
+
_this._participantsEntity.on(Conversation.participantUpdated, function (args) {
|
4951
|
+
return (// @todo update participants map here??
|
4952
|
+
_this.emit(Conversation.participantUpdated, args)
|
4953
|
+
);
|
4940
4954
|
});
|
4941
4955
|
|
4942
4956
|
_this._messagesEntity = new Messages(_assertThisInitialized__default["default"](_this), configuration, services);
|
4943
4957
|
|
4944
|
-
_this._messagesEntity.on(
|
4958
|
+
_this._messagesEntity.on(Conversation.messageAdded, function (message) {
|
4945
4959
|
return _this._onMessageAdded(message);
|
4946
4960
|
});
|
4947
4961
|
|
4948
|
-
_this._messagesEntity.on(
|
4949
|
-
return _this.emit(
|
4962
|
+
_this._messagesEntity.on(Conversation.messageUpdated, function (args) {
|
4963
|
+
return _this.emit(Conversation.messageUpdated, args);
|
4950
4964
|
});
|
4951
4965
|
|
4952
|
-
_this._messagesEntity.on(
|
4953
|
-
return _this.emit(
|
4966
|
+
_this._messagesEntity.on(Conversation.messageRemoved, function (message) {
|
4967
|
+
return _this.emit(Conversation.messageRemoved, message);
|
4954
4968
|
});
|
4955
4969
|
|
4956
4970
|
return _this;
|
@@ -5053,7 +5067,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
5053
5067
|
return (_this$_internalState$3 = this._internalState.notificationLevel) !== null && _this$_internalState$3 !== void 0 ? _this$_internalState$3 : "default";
|
5054
5068
|
}
|
5055
5069
|
/**
|
5056
|
-
* Conversation bindings.
|
5070
|
+
* Conversation bindings. An undocumented feature (for now).
|
5057
5071
|
* @internal
|
5058
5072
|
*/
|
5059
5073
|
|
@@ -6035,18 +6049,19 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6035
6049
|
}()
|
6036
6050
|
/**
|
6037
6051
|
* Get recipients of all messages in the conversation.
|
6052
|
+
* @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.
|
6038
6053
|
*/
|
6039
6054
|
|
6040
6055
|
}, {
|
6041
6056
|
key: "getMessageRecipients",
|
6042
6057
|
value: function () {
|
6043
|
-
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24() {
|
6058
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24(options) {
|
6044
6059
|
return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
|
6045
6060
|
while (1) {
|
6046
6061
|
switch (_context24.prev = _context24.next) {
|
6047
6062
|
case 0:
|
6048
6063
|
_context24.next = 2;
|
6049
|
-
return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid);
|
6064
|
+
return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid, options);
|
6050
6065
|
|
6051
6066
|
case 2:
|
6052
6067
|
return _context24.abrupt("return", _context24.sent);
|
@@ -6059,7 +6074,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6059
6074
|
}, _callee24, this);
|
6060
6075
|
}));
|
6061
6076
|
|
6062
|
-
function getMessageRecipients() {
|
6077
|
+
function getMessageRecipients(_x19) {
|
6063
6078
|
return _getMessageRecipients.apply(this, arguments);
|
6064
6079
|
}
|
6065
6080
|
|
@@ -6068,7 +6083,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6068
6083
|
/**
|
6069
6084
|
* Load and subscribe to this conversation and do not subscribe to its
|
6070
6085
|
* participants and messages. This or _subscribeStreams will need to be called
|
6071
|
-
* before any events
|
6086
|
+
* before any events in the conversation will fire.
|
6072
6087
|
* @internal
|
6073
6088
|
*/
|
6074
6089
|
|
@@ -6101,12 +6116,12 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6101
6116
|
case 6:
|
6102
6117
|
this._entity = _context25.sent;
|
6103
6118
|
|
6104
|
-
this._entity.on(
|
6119
|
+
this._entity.on(twilioSync.SyncDocument.updated, function (args) {
|
6105
6120
|
return _this2._update(args.data);
|
6106
6121
|
});
|
6107
6122
|
|
6108
|
-
this._entity.on(
|
6109
|
-
return _this2.emit(
|
6123
|
+
this._entity.on(twilioSync.SyncDocument.removed, function () {
|
6124
|
+
return _this2.emit(Conversation.removed, _this2);
|
6110
6125
|
});
|
6111
6126
|
|
6112
6127
|
this._update(this._entity.data);
|
@@ -6274,22 +6289,16 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6274
6289
|
while (1) {
|
6275
6290
|
switch (_context28.prev = _context28.next) {
|
6276
6291
|
case 0:
|
6277
|
-
if (
|
6278
|
-
|
6279
|
-
break;
|
6280
|
-
}
|
6281
|
-
|
6282
|
-
_context28.next = 3;
|
6283
|
-
return this._entity.close();
|
6292
|
+
if (this._entity) {
|
6293
|
+
this._entity.close();
|
6284
6294
|
|
6285
|
-
|
6286
|
-
|
6287
|
-
|
6295
|
+
this._entity = null;
|
6296
|
+
this._entityPromise = null;
|
6297
|
+
}
|
6288
6298
|
|
6289
|
-
case 5:
|
6290
6299
|
return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
6291
6300
|
|
6292
|
-
case
|
6301
|
+
case 2:
|
6293
6302
|
case "end":
|
6294
6303
|
return _context28.stop();
|
6295
6304
|
}
|
@@ -6458,7 +6467,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6458
6467
|
}
|
6459
6468
|
|
6460
6469
|
if (updateReasons.size > 0) {
|
6461
|
-
this.emit(
|
6470
|
+
this.emit(Conversation.updated, {
|
6462
6471
|
conversation: this,
|
6463
6472
|
updateReasons: _toConsumableArray__default["default"](updateReasons)
|
6464
6473
|
});
|
@@ -6490,7 +6499,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6490
6499
|
_iterator.f();
|
6491
6500
|
}
|
6492
6501
|
|
6493
|
-
this.emit(
|
6502
|
+
this.emit(Conversation.messageAdded, message);
|
6494
6503
|
}
|
6495
6504
|
/**
|
6496
6505
|
* Set last read message index.
|
@@ -6523,7 +6532,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6523
6532
|
}, _callee29, this);
|
6524
6533
|
}));
|
6525
6534
|
|
6526
|
-
function _setLastReadMessageIndex(
|
6535
|
+
function _setLastReadMessageIndex(_x20) {
|
6527
6536
|
return _setLastReadMessageIndex2.apply(this, arguments);
|
6528
6537
|
}
|
6529
6538
|
|
@@ -6603,7 +6612,7 @@ _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conve
|
|
6603
6612
|
|
6604
6613
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
|
6605
6614
|
|
6606
|
-
__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);
|
6615
|
+
__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);
|
6607
6616
|
|
6608
6617
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
|
6609
6618
|
|
@@ -6800,7 +6809,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6800
6809
|
return addConversation;
|
6801
6810
|
}()
|
6802
6811
|
/**
|
6803
|
-
* Fetch conversations list and instantiate all necessary objects
|
6812
|
+
* Fetch conversations' list and instantiate all necessary objects
|
6804
6813
|
*/
|
6805
6814
|
|
6806
6815
|
}, {
|
@@ -6821,12 +6830,12 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6821
6830
|
|
6822
6831
|
case 3:
|
6823
6832
|
map = _context2.sent;
|
6824
|
-
map.on(
|
6833
|
+
map.on(twilioSync.SyncMap.itemAdded, function (args) {
|
6825
6834
|
log$1.debug("itemAdded: ".concat(args.item.key));
|
6826
6835
|
|
6827
6836
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
6828
6837
|
});
|
6829
|
-
map.on(
|
6838
|
+
map.on(twilioSync.SyncMap.itemRemoved, function (args) {
|
6830
6839
|
log$1.debug("itemRemoved: ".concat(args.key));
|
6831
6840
|
var sid = args.key;
|
6832
6841
|
|
@@ -6852,7 +6861,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6852
6861
|
|
6853
6862
|
conversation.emit("removed", conversation);
|
6854
6863
|
});
|
6855
|
-
map.on(
|
6864
|
+
map.on(twilioSync.SyncMap.itemUpdated, function (args) {
|
6856
6865
|
log$1.debug("itemUpdated: ".concat(args.item.key));
|
6857
6866
|
|
6858
6867
|
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
@@ -7945,7 +7954,7 @@ function PushNotification(data) {
|
|
7945
7954
|
this.data = data.data || {};
|
7946
7955
|
});
|
7947
7956
|
|
7948
|
-
var version = "2.5.0
|
7957
|
+
var version = "2.5.0";
|
7949
7958
|
|
7950
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; }
|
7951
7960
|
|
@@ -8940,7 +8949,7 @@ var MessageRecipientsClient = /*#__PURE__*/function () {
|
|
8940
8949
|
while (1) {
|
8941
8950
|
switch (_context2.prev = _context2.next) {
|
8942
8951
|
case 0:
|
8943
|
-
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 :
|
8952
|
+
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();
|
8944
8953
|
_context2.next = 3;
|
8945
8954
|
return this._services.commandExecutor.fetchResource(url);
|
8946
8955
|
|
@@ -9272,7 +9281,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9272
9281
|
*/
|
9273
9282
|
|
9274
9283
|
/**
|
9275
|
-
* Returned Conversations instance is not yet fully initialized. Calling any
|
9284
|
+
* Returned Conversations Client instance is not yet fully initialized. Calling any
|
9276
9285
|
* operations will block until it is. Use connection events to monitor when
|
9277
9286
|
* client becomes fully available (connectionStateChanged with state
|
9278
9287
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
@@ -9362,16 +9371,16 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9362
9371
|
|
9363
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);
|
9364
9373
|
|
9365
|
-
_this._services.twilsockClient.on(
|
9366
|
-
return _this.emit(
|
9374
|
+
_this._services.twilsockClient.on(Client_1.tokenAboutToExpire, function () {
|
9375
|
+
return _this.emit(Client_1.tokenAboutToExpire);
|
9367
9376
|
});
|
9368
9377
|
|
9369
|
-
_this._services.twilsockClient.on(
|
9370
|
-
return _this.emit(
|
9378
|
+
_this._services.twilsockClient.on(Client_1.tokenExpired, function () {
|
9379
|
+
return _this.emit(Client_1.tokenExpired);
|
9371
9380
|
});
|
9372
9381
|
|
9373
|
-
_this._services.twilsockClient.on(
|
9374
|
-
return _this.emit(
|
9382
|
+
_this._services.twilsockClient.on(Client_1.connectionError, function (error) {
|
9383
|
+
return _this.emit(Client_1.connectionError, error);
|
9375
9384
|
});
|
9376
9385
|
|
9377
9386
|
_this._services.twilsockClient.on("stateChanged", function (state) {
|
@@ -9380,7 +9389,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9380
9389
|
if (state !== _this.connectionState) {
|
9381
9390
|
_this.connectionState = state;
|
9382
9391
|
|
9383
|
-
_this.emit(
|
9392
|
+
_this.emit(Client_1.connectionStateChanged, _this.connectionState);
|
9384
9393
|
}
|
9385
9394
|
});
|
9386
9395
|
|
@@ -9398,9 +9407,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9398
9407
|
var emitFailed = function emitFailed(error) {
|
9399
9408
|
_this._rejectEnsureReady(error);
|
9400
9409
|
|
9401
|
-
_this.emit(
|
9410
|
+
_this.emit(Client_1.stateChanged, "failed");
|
9402
9411
|
|
9403
|
-
_this.emit(
|
9412
|
+
_this.emit(Client_1.initFailed, {
|
9404
9413
|
error: error
|
9405
9414
|
});
|
9406
9415
|
};
|
@@ -9453,9 +9462,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9453
9462
|
|
9454
9463
|
_this._rejectEnsureReady(connectionError);
|
9455
9464
|
|
9456
|
-
_this.emit(
|
9465
|
+
_this.emit(Client_1.stateChanged, "failed");
|
9457
9466
|
|
9458
|
-
_this.emit(
|
9467
|
+
_this.emit(Client_1.initFailed, {
|
9459
9468
|
error: connectionError
|
9460
9469
|
});
|
9461
9470
|
|
@@ -9983,7 +9992,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9983
9992
|
return removePushRegistrations;
|
9984
9993
|
}()
|
9985
9994
|
/**
|
9986
|
-
*
|
9995
|
+
* Parse a push notification payload.
|
9987
9996
|
*/
|
9988
9997
|
|
9989
9998
|
}, {
|
@@ -10320,8 +10329,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10320
10329
|
|
10321
10330
|
this._resolveEnsureReady();
|
10322
10331
|
|
10323
|
-
this.emit(
|
10324
|
-
this.emit(
|
10332
|
+
this.emit(Client_1.stateChanged, "initialized");
|
10333
|
+
this.emit(Client_1.initialized);
|
10325
10334
|
|
10326
10335
|
case 36:
|
10327
10336
|
case "end":
|