@twilio/conversations 3.0.1-rc.1 → 3.0.1-rc.103

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.
Files changed (136) hide show
  1. package/builds/browser.js +9543 -4302
  2. package/builds/browser.js.map +1 -1
  3. package/builds/lib.d.ts +256 -61
  4. package/builds/lib.js +9543 -4302
  5. package/builds/lib.js.map +1 -1
  6. package/builds/twilio-conversations.js +44686 -27540
  7. package/builds/twilio-conversations.min.js +1 -200
  8. package/dist/channel-metadata-client.js +1 -1
  9. package/dist/channel-metadata-client.js.map +1 -1
  10. package/dist/client.js +153 -43
  11. package/dist/client.js.map +1 -1
  12. package/dist/command-executor.js +31 -50
  13. package/dist/command-executor.js.map +1 -1
  14. package/dist/configuration.js +8 -4
  15. package/dist/configuration.js.map +1 -1
  16. package/dist/content-template.js +1 -1
  17. package/dist/content-template.js.map +1 -1
  18. package/dist/conversation.js +12 -46
  19. package/dist/conversation.js.map +1 -1
  20. package/dist/data/conversations.js +2 -18
  21. package/dist/data/conversations.js.map +1 -1
  22. package/dist/data/messages.js +13 -3
  23. package/dist/data/messages.js.map +1 -1
  24. package/dist/data/participants.js +2 -4
  25. package/dist/data/participants.js.map +1 -1
  26. package/dist/data/users.js +2 -2
  27. package/dist/data/users.js.map +1 -1
  28. package/dist/index.js +5 -6
  29. package/dist/index.js.map +1 -1
  30. package/dist/media.js.map +1 -1
  31. package/dist/message-builder.js.map +1 -1
  32. package/dist/message-recipients-client.js +237 -0
  33. package/dist/message-recipients-client.js.map +1 -0
  34. package/dist/message.js +57 -0
  35. package/dist/message.js.map +1 -1
  36. package/dist/node_modules/quick-lru/index.js.map +1 -1
  37. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  38. package/dist/packages/conversations/package.json.js +1 -1
  39. package/dist/participant.js +34 -34
  40. package/dist/participant.js.map +1 -1
  41. package/dist/push-notification.js.map +1 -1
  42. package/dist/rest-paginator.js +11 -11
  43. package/dist/rest-paginator.js.map +1 -1
  44. package/dist/services/network.js +11 -101
  45. package/dist/services/network.js.map +1 -1
  46. package/dist/services/typing-indicator.js +5 -13
  47. package/dist/services/typing-indicator.js.map +1 -1
  48. package/dist/unsent-message.js.map +1 -1
  49. package/dist/user.js.map +1 -1
  50. package/dist/util/index.js.map +1 -1
  51. package/docs/assets/css/main.css +2660 -0
  52. package/docs/assets/images/icons.png +0 -0
  53. package/docs/assets/images/icons@2x.png +0 -0
  54. package/docs/assets/images/widgets.png +0 -0
  55. package/docs/assets/images/widgets@2x.png +0 -0
  56. package/docs/assets/js/main.js +248 -0
  57. package/docs/assets/js/search.js +1 -0
  58. package/docs/classes/AggregatedDeliveryReceipt.html +3182 -144
  59. package/docs/classes/CancellablePromise.html +3209 -224
  60. package/docs/classes/ChannelMetadata.html +3049 -66
  61. package/docs/classes/Client.html +4276 -701
  62. package/docs/classes/ContentTemplate.html +3115 -96
  63. package/docs/classes/ContentTemplateVariable.html +3114 -88
  64. package/docs/classes/Conversation.html +4380 -768
  65. package/docs/classes/DetailedDeliveryReceipt.html +3162 -116
  66. package/docs/classes/EmailRecipientDescriptor.html +3098 -0
  67. package/docs/classes/Media.html +3165 -119
  68. package/docs/classes/Message.html +3824 -417
  69. package/docs/classes/MessageBuilder.html +3315 -208
  70. package/docs/classes/Participant.html +3442 -258
  71. package/docs/classes/PushNotification.html +3129 -101
  72. package/docs/classes/RestPaginator.html +3158 -120
  73. package/docs/classes/UnknownRecipientDescriptor.html +3067 -0
  74. package/docs/classes/UnsentMessage.html +3040 -63
  75. package/docs/classes/User.html +3347 -209
  76. package/docs/index.html +4366 -146
  77. package/docs/interfaces/ClientOptions.html +3065 -66
  78. package/docs/interfaces/ConversationBindings.html +3000 -109
  79. package/docs/interfaces/ConversationEmailBinding.html +3000 -109
  80. package/docs/interfaces/ConversationLimits.html +3097 -87
  81. package/docs/interfaces/ConversationState.html +3049 -66
  82. package/docs/interfaces/ConversationUpdatedEventArgs.html +3000 -109
  83. package/docs/interfaces/CreateConversationOptions.html +3065 -73
  84. package/docs/interfaces/LastMessage.html +3049 -66
  85. package/docs/interfaces/Paginator.html +3139 -110
  86. package/docs/interfaces/ParticipantBindings.html +3000 -109
  87. package/docs/interfaces/ParticipantEmailBinding.html +3000 -109
  88. package/docs/interfaces/PushNotificationData.html +3113 -94
  89. package/docs/interfaces/SendEmailOptions.html +3033 -59
  90. package/docs/interfaces/SendMediaOptions.html +3067 -75
  91. package/docs/modules.html +4373 -180
  92. package/package.json +13 -14
  93. package/docs/.nojekyll +0 -1
  94. package/docs/assets/highlight.css +0 -113
  95. package/docs/assets/main.js +0 -58
  96. package/docs/assets/search.js +0 -1
  97. package/docs/assets/style.css +0 -1279
  98. package/docs/classes/CancellationError.html +0 -112
  99. package/docs/interfaces/ParticipantBindingOptions.html +0 -110
  100. package/docs/types/ChannelType.html +0 -106
  101. package/docs/types/ConnectionState.html +0 -115
  102. package/docs/types/ContentData.html +0 -106
  103. package/docs/types/ContentDataAction.html +0 -107
  104. package/docs/types/ContentDataActionOther.html +0 -121
  105. package/docs/types/ContentDataActionPhone.html +0 -128
  106. package/docs/types/ContentDataActionReply.html +0 -133
  107. package/docs/types/ContentDataActionUrl.html +0 -128
  108. package/docs/types/ContentDataCallToAction.html +0 -131
  109. package/docs/types/ContentDataCard.html +0 -137
  110. package/docs/types/ContentDataListItem.html +0 -121
  111. package/docs/types/ContentDataListPicker.html +0 -134
  112. package/docs/types/ContentDataLocation.html +0 -134
  113. package/docs/types/ContentDataMedia.html +0 -129
  114. package/docs/types/ContentDataOther.html +0 -121
  115. package/docs/types/ContentDataQuickReply.html +0 -131
  116. package/docs/types/ContentDataReply.html +0 -119
  117. package/docs/types/ContentDataText.html +0 -125
  118. package/docs/types/ConversationStatus.html +0 -107
  119. package/docs/types/ConversationUpdateReason.html +0 -106
  120. package/docs/types/DeliveryAmount.html +0 -106
  121. package/docs/types/DeliveryStatus.html +0 -106
  122. package/docs/types/JSONArray.html +0 -106
  123. package/docs/types/JSONObject.html +0 -111
  124. package/docs/types/JSONValue.html +0 -106
  125. package/docs/types/LogLevel.html +0 -106
  126. package/docs/types/MediaCategory.html +0 -106
  127. package/docs/types/MessageType.html +0 -106
  128. package/docs/types/MessageUpdateReason.html +0 -106
  129. package/docs/types/NotificationLevel.html +0 -109
  130. package/docs/types/NotificationsChannelType.html +0 -110
  131. package/docs/types/ParticipantEmailLevel.html +0 -108
  132. package/docs/types/ParticipantType.html +0 -107
  133. package/docs/types/ParticipantUpdateReason.html +0 -106
  134. package/docs/types/PushNotificationType.html +0 -106
  135. package/docs/types/State.html +0 -110
  136. package/docs/types/UserUpdateReason.html +0 -106
package/builds/lib.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import { SyncClient, SyncDocument, SyncList } from "twilio-sync";
3
3
  import { LogLevelDesc } from "loglevel";
4
- import { TwilsockClient } from "twilsock";
4
+ import { Transport, TwilsockClient, InitRegistration, TransportResult } from "twilsock";
5
+ import { ConnectionState as TwilsockConnectionState } from "twilsock";
5
6
  import { ReplayEventEmitter } from "@twilio/replay-event-emitter";
6
- import { JSONValue, CancellationError } from "@twilio/shared";
7
- import { CancellablePromise as CancellablePromise$0 } from "@twilio/shared";
8
7
  import { ChannelType, Notifications } from "@twilio/notifications";
9
8
  import { Notifications as NotificationClient } from "@twilio/notifications";
10
9
  import { CancellablePromise, McsClient, MediaCategory, McsMedia } from "@twilio/mcs-client";
10
+ import { MediaCategory as McsMediaCategory } from "@twilio/mcs-client";
11
11
  interface ConfigurationResponse {
12
12
  options: {
13
13
  consumption_report_interval: string;
@@ -111,10 +111,11 @@ declare class Configuration {
111
111
  readonly userInfo: string;
112
112
  readonly myConversations: string;
113
113
  readonly channelMetadataCacheCapacity: number;
114
+ readonly messageRecipientsCacheCapacity: number;
114
115
  constructor(options: ClientOptions, configurationResponse: ConfigurationResponse, logger: Logger);
115
116
  }
116
117
  interface CommandExecutorServices {
117
- transport: TwilsockClient;
118
+ transport: Transport;
118
119
  }
119
120
  declare class CommandExecutor {
120
121
  private _serviceUrl;
@@ -126,6 +127,20 @@ declare class CommandExecutor {
126
127
  fetchResource<Request = void, Response = void>(url: string, requestBody?: Request): Promise<Response>;
127
128
  mutateResource<Request = void, Response = void>(method: "post" | "delete", url: string, requestBody?: Request): Promise<Response>;
128
129
  }
130
+ /**
131
+ * Represents a JSON value.
132
+ */
133
+ type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
134
+ /**
135
+ * Represents a JSON object.
136
+ */
137
+ type JSONObject = {
138
+ [x: string]: JSONValue;
139
+ };
140
+ /**
141
+ * Represents a JSON array.
142
+ */
143
+ type JSONArray = JSONValue[];
129
144
  type UserEvents = {
130
145
  updated: (data: {
131
146
  user: User;
@@ -252,16 +267,12 @@ declare class Network {
252
267
  private cacheLifetime;
253
268
  private readonly cache;
254
269
  private timer;
255
- private pendingRequests;
256
- private isShutdownInitiated;
257
270
  constructor(configuration: any, services: any);
258
271
  private isExpired;
259
272
  private cleanupCache;
260
273
  pokeTimer(): void;
261
- private static responsePostProcess;
262
274
  private executeWithRetry;
263
- get(url: string): Promise<any>;
264
- disconnect(): Promise<void>;
275
+ get<T>(url: string): Promise<TransportResult<T>>;
265
276
  }
266
277
  type UsersEvents = {
267
278
  userUpdated: (data: {
@@ -421,7 +432,7 @@ declare class Participant extends ReplayEventEmitter<ParticipantEvents> {
421
432
  * using the type dynamically `participant.bindings[participant.type]`
422
433
  * just be aware that the binding information has different structure for
423
434
  * each participant type.
424
- * See also {@link ParticipantEmailBinding}, the only available currently binding descriptor.
435
+ * See also {ParticipantEmailBinding}, the only available currently binding descriptor.
425
436
  */
426
437
  get bindings(): ParticipantBindings;
427
438
  /**
@@ -483,15 +494,39 @@ declare class Participant extends ReplayEventEmitter<ParticipantEvents> {
483
494
  */
484
495
  updateAttributes(attributes: JSONValue): Promise<Participant>;
485
496
  }
486
- /**
487
- * Participant binding options
488
- */
497
+ interface ParticipantResponse {
498
+ account_sid: string;
499
+ chat_service_sid: string;
500
+ conversation_sid: string;
501
+ role_sid: string;
502
+ sid: string;
503
+ attributes: string;
504
+ date_created: string;
505
+ date_updated: string;
506
+ identity: string;
507
+ messaging_binding: {
508
+ type: "chat" | "sms" | "whatsapp" | "email";
509
+ address: string;
510
+ proxy_address: string;
511
+ } | null;
512
+ url: string;
513
+ links: {
514
+ conversation: string;
515
+ };
516
+ }
489
517
  interface ParticipantBindingOptions {
490
518
  email?: ParticipantEmailBinding;
491
519
  }
520
+ /**
521
+ * Category of media. Possible values are as follows:
522
+ * * `'media'`
523
+ * * `'body'`
524
+ * * `'history'`
525
+ */
526
+ type MediaCategory$0 = McsMediaCategory;
492
527
  interface MediaState {
493
528
  sid: string;
494
- category: MediaCategory;
529
+ category: MediaCategory$0;
495
530
  filename: string | null;
496
531
  contentType: string;
497
532
  size: number;
@@ -529,7 +564,7 @@ declare class Media {
529
564
  /**
530
565
  * Media category, can be one of the {@link MediaCategory} values.
531
566
  */
532
- get category(): MediaCategory;
567
+ get category(): MediaCategory$0;
533
568
  /**
534
569
  * Returns the direct content URL for the media.
535
570
  *
@@ -1115,7 +1150,7 @@ declare class ContentTemplateVariable {
1115
1150
  /**
1116
1151
  * A rich content template.
1117
1152
  *
1118
- * Use {@link Client.getContentTemplates} to request all the templates available
1153
+ * Use {@Link Client.getContentTemplates} to request all the templates available
1119
1154
  * for the current account.
1120
1155
  */
1121
1156
  declare class ContentTemplate {
@@ -1175,6 +1210,115 @@ declare class ChannelMetadataClient {
1175
1210
  constructor(services: ChannelMetadataClientServices, configuration: Configuration);
1176
1211
  getChannelMetadata(conversationSid: string, messageSid: string): Promise<ChannelMetadata | null>;
1177
1212
  }
1213
+ type MessageRecipient = {
1214
+ message_sid: string;
1215
+ type: "email"; // discriminant for future expansion
1216
+ level: "to" | "from" | "cc";
1217
+ name: string;
1218
+ address: string;
1219
+ };
1220
+ /**
1221
+ * Pagination helper interface.
1222
+ * @typeParam T The item type.
1223
+ */
1224
+ interface Paginator<T> {
1225
+ /**
1226
+ * Indicates the existence of the next page.
1227
+ */
1228
+ hasNextPage: boolean;
1229
+ /**
1230
+ * Indicates the existence of the previous page.
1231
+ */
1232
+ hasPrevPage: boolean;
1233
+ /**
1234
+ * Array of elements of type T on the current page.
1235
+ */
1236
+ items: T[];
1237
+ /**
1238
+ * Request next page.
1239
+ * Does not modify the existing object.
1240
+ */
1241
+ nextPage(): Promise<Paginator<T>>;
1242
+ /**
1243
+ * Request previous page.
1244
+ * Does not modify the existing object.
1245
+ */
1246
+ prevPage(): Promise<Paginator<T>>;
1247
+ }
1248
+ type MessageRecipientsClientServices = {
1249
+ commandExecutor: CommandExecutor;
1250
+ };
1251
+ /**
1252
+ * Message recipient descriptor.
1253
+ */
1254
+ type RecipientDescriptor = EmailRecipientDescriptor | UnknownRecipientDescriptor;
1255
+ /**
1256
+ * Email recipient level.
1257
+ */
1258
+ type EmailRecipientLevel = "to" | "from" | "cc";
1259
+ /**
1260
+ * Email recipient descriptor.
1261
+ */
1262
+ declare class EmailRecipientDescriptor {
1263
+ /**
1264
+ * Type of recipient.
1265
+ */
1266
+ readonly type = "email";
1267
+ /**
1268
+ * Sid of the message that this recipient belongs to.
1269
+ */
1270
+ readonly messageSid: string;
1271
+ /**
1272
+ * Email recipient level.
1273
+ */
1274
+ readonly level: EmailRecipientLevel;
1275
+ /**
1276
+ * Name of the recipient.
1277
+ */
1278
+ readonly name: string;
1279
+ /**
1280
+ * Address of the recipient.
1281
+ */
1282
+ readonly address: string;
1283
+ /**
1284
+ * @internal
1285
+ */
1286
+ constructor(recipient: MessageRecipient);
1287
+ }
1288
+ /**
1289
+ * Unknown recipient descriptor. Used to be able to handle recipient types that
1290
+ * are not supported by the current version of the SDK.
1291
+ */
1292
+ declare class UnknownRecipientDescriptor {
1293
+ /**
1294
+ * Type of recipient.
1295
+ */
1296
+ readonly type: string;
1297
+ /**
1298
+ * Sid of the message that this recipient belongs to.
1299
+ */
1300
+ readonly messageSid: string;
1301
+ /**
1302
+ * Recipient data as a JSON string.
1303
+ */
1304
+ readonly rawData: string;
1305
+ /**
1306
+ * @internal
1307
+ */
1308
+ constructor(recipient: MessageRecipient);
1309
+ }
1310
+ declare class MessageRecipientsClient {
1311
+ private readonly _services;
1312
+ private readonly _configuration;
1313
+ private readonly _cache;
1314
+ constructor(services: MessageRecipientsClientServices, configuration: Configuration);
1315
+ getRecipientsFromMessage(conversationSid: string, messageSid: string): Promise<RecipientDescriptor[]>;
1316
+ getRecipientsFromConversation(conversationSid: string, paginatorOptions?: {
1317
+ pageToken?: string;
1318
+ pageSize?: string;
1319
+ }): Promise<Paginator<RecipientDescriptor>>;
1320
+ private _wrapResponse;
1321
+ }
1178
1322
  type MessageEvents = {
1179
1323
  updated: (data: {
1180
1324
  message: Message;
@@ -1186,6 +1330,7 @@ interface MessageServices {
1186
1330
  network: Network;
1187
1331
  commandExecutor: CommandExecutor;
1188
1332
  channelMetadataClient: ChannelMetadataClient;
1333
+ messageRecipientsClient: MessageRecipientsClient;
1189
1334
  }
1190
1335
  interface MessageLinks {
1191
1336
  self: string;
@@ -1215,8 +1360,8 @@ interface MessageData {
1215
1360
  attributes?: JSONValue;
1216
1361
  dateUpdated: string;
1217
1362
  timestamp?: string;
1218
- medias: MediaState[] | null;
1219
- media: MediaState | null;
1363
+ medias?: Media[];
1364
+ media?: Media;
1220
1365
  memberSid?: string;
1221
1366
  delivery?: AggregatedDeliveryDescriptor;
1222
1367
  channelMetadata?: boolean;
@@ -1299,6 +1444,11 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
1299
1444
  * Type of the message.
1300
1445
  */
1301
1446
  get type(): MessageType;
1447
+ /**
1448
+ * One of the attached media (if present).
1449
+ * @deprecated Use attachedMedia instead. Note that the latter is now an array.
1450
+ */
1451
+ get media(): Media | null;
1302
1452
  /**
1303
1453
  * Return all media attachments, except email body/history attachments, without temporary urls.
1304
1454
  */
@@ -1311,6 +1461,14 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
1311
1461
  * Aggregated information about the message delivery statuses across all participants of a conversation..
1312
1462
  */
1313
1463
  get aggregatedDeliveryReceipt(): AggregatedDeliveryReceipt | null;
1464
+ /**
1465
+ * @deprecated
1466
+ * Return a (possibly empty) array of media matching a specific set of categories.
1467
+ * Allowed category is so far only 'media'.
1468
+ * @param categories Array of categories to match.
1469
+ * @returns Array of media descriptors matching given categories.
1470
+ */
1471
+ getMediaByCategory(categories: Array<MediaCategory>): Array<Media> | null;
1314
1472
  /**
1315
1473
  * Return a (possibly empty) array of media matching a specific set of categories.
1316
1474
  * Allowed category is so far only 'media'.
@@ -1353,6 +1511,12 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
1353
1511
  * @param attributes New attributes.
1354
1512
  */
1355
1513
  updateAttributes(attributes: JSONValue): Promise<Message>;
1514
+ /**
1515
+ * @deprecated
1516
+ * Get content URLs for all media attachments in the given set using a single operation.
1517
+ * @param contentSet Set of media attachments to query content URLs.
1518
+ */
1519
+ attachTemporaryUrlsFor(contentSet: Media[] | null): Promise<Media[]>;
1356
1520
  /**
1357
1521
  * Get content URLs for all media attachments in the given set using a single operation.
1358
1522
  * @param contentSet Set of media attachments to query content URLs.
@@ -1378,34 +1542,10 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
1378
1542
  * the message doesn't have any channel metadata.
1379
1543
  */
1380
1544
  getChannelMetadata(): Promise<ChannelMetadata | null>;
1381
- }
1382
- /**
1383
- * Pagination helper interface.
1384
- * @typeParam T The item type.
1385
- */
1386
- interface Paginator<T> {
1387
- /**
1388
- * Indicates the existence of the next page.
1389
- */
1390
- hasNextPage: boolean;
1391
1545
  /**
1392
- * Indicates the existence of the previous page.
1546
+ * Get recipients of the message.
1393
1547
  */
1394
- hasPrevPage: boolean;
1395
- /**
1396
- * Array of elements of type T on the current page.
1397
- */
1398
- items: T[];
1399
- /**
1400
- * Request next page.
1401
- * Does not modify the existing object.
1402
- */
1403
- nextPage(): Promise<Paginator<T>>;
1404
- /**
1405
- * Request previous page.
1406
- * Does not modify the existing object.
1407
- */
1408
- prevPage(): Promise<Paginator<T>>;
1548
+ getMessageRecipients(): Promise<RecipientDescriptor[]>;
1409
1549
  }
1410
1550
  interface TypingIndicatorServices {
1411
1551
  twilsockClient: TwilsockClient;
@@ -1513,14 +1653,12 @@ interface MessageResponse {
1513
1653
  participant_sid: string;
1514
1654
  body: string;
1515
1655
  subject: string;
1516
- content_sid: string;
1517
1656
  date_created: string;
1518
1657
  date_updated: string;
1519
1658
  url: string;
1520
1659
  media: {
1521
1660
  sid: string;
1522
1661
  size: string;
1523
- category: string;
1524
1662
  content_type: string;
1525
1663
  filename: string;
1526
1664
  }[] | null;
@@ -1543,6 +1681,7 @@ interface MessagesServices {
1543
1681
  syncClient: SyncClient;
1544
1682
  commandExecutor: CommandExecutor;
1545
1683
  channelMetadataClient: ChannelMetadataClient;
1684
+ messageRecipientsClient: MessageRecipientsClient;
1546
1685
  }
1547
1686
  /**
1548
1687
  * Represents the collection of messages in a conversation
@@ -1591,7 +1730,7 @@ declare class Messages extends ReplayEventEmitter<MessagesEvents> {
1591
1730
  */
1592
1731
  getMessages(pageSize: number | undefined, anchor: number | "end" | undefined, direction?: "forward" | "backwards"): Promise<SyncPaginator<Message>>;
1593
1732
  private _wrapPaginator;
1594
- _upsertMessage(index: number, value: MessageData): Message;
1733
+ private _upsertMessage;
1595
1734
  /**
1596
1735
  * Returns last messages from conversation
1597
1736
  * @param {Number} [pageSize] Number of messages to return in single chunk. By default it's 30.
@@ -1838,6 +1977,7 @@ interface ConversationServices {
1838
1977
  syncClient: SyncClient;
1839
1978
  commandExecutor: CommandExecutor;
1840
1979
  channelMetadataClient: ChannelMetadataClient;
1980
+ messageRecipientsClient: MessageRecipientsClient;
1841
1981
  }
1842
1982
  /**
1843
1983
  * Conversation descriptor.
@@ -2108,7 +2248,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2108
2248
  * @param attributes Attributes to be attached to the participant.
2109
2249
  * @returns The added participant.
2110
2250
  */
2111
- add(identity: string, attributes?: JSONValue): Promise<Participant>;
2251
+ add(identity: string, attributes?: JSONValue): Promise<ParticipantResponse>;
2112
2252
  /**
2113
2253
  * Add a non-chat participant to the conversation.
2114
2254
  * @param proxyAddress Proxy (Twilio) address of the participant.
@@ -2118,7 +2258,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2118
2258
  * CC/To level.
2119
2259
  * @returns The added participant.
2120
2260
  */
2121
- addNonChatParticipant(proxyAddress: string, address: string, attributes?: JSONValue, bindingOptions?: ParticipantBindingOptions): Promise<Participant>;
2261
+ addNonChatParticipant(proxyAddress: string, address: string, attributes?: JSONValue, bindingOptions?: ParticipantBindingOptions): Promise<ParticipantResponse>;
2122
2262
  /**
2123
2263
  * Advance the conversation's last read message index to the current read
2124
2264
  * horizon. Rejects if the user is not a participant of the conversation. Last
@@ -2233,7 +2373,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2233
2373
  * @param emailOptions Email options for the message.
2234
2374
  * @return Index of the new message.
2235
2375
  */
2236
- sendMessage(message: null | string | FormData | SendMediaOptions, messageAttributes?: JSONValue, emailOptions?: SendEmailOptions): Promise<Message>;
2376
+ sendMessage(message: null | string | FormData | SendMediaOptions, messageAttributes?: JSONValue, emailOptions?: SendEmailOptions): Promise<number>;
2237
2377
  /**
2238
2378
  * New interface to prepare for sending a message.
2239
2379
  * Use this instead of {@link Conversation.sendMessage}.
@@ -2286,6 +2426,10 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2286
2426
  * to null removes it.
2287
2427
  */
2288
2428
  updateUniqueName(uniqueName: string | null): Promise<Conversation>;
2429
+ /**
2430
+ * Get recipients of all messages in the conversation.
2431
+ */
2432
+ getMessageRecipients(): Promise<Paginator<RecipientDescriptor>>;
2289
2433
  /**
2290
2434
  * Load and subscribe to this conversation and do not subscribe to its
2291
2435
  * participants and messages. This or _subscribeStreams will need to be called
@@ -2340,9 +2484,6 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2340
2484
  private _setLastReadMessageIndex;
2341
2485
  }
2342
2486
  type ConversationsDataSource = "sync" | "rest";
2343
- /**
2344
- * Type of a push notification.
2345
- */
2346
2487
  type PushNotificationType = "twilio.conversations.new_message" | "twilio.conversations.added_to_conversation" | "twilio.conversations.removed_from_conversation";
2347
2488
  interface PushNotificationDescriptor {
2348
2489
  title: string | null;
@@ -2454,11 +2595,12 @@ type ClientEvents = {
2454
2595
  user: User;
2455
2596
  updateReasons: UserUpdateReason[];
2456
2597
  }) => void;
2598
+ stateChanged: (state: State) => void;
2457
2599
  initialized: () => void;
2458
2600
  initFailed: ({ error }: {
2459
2601
  error?: ConnectionError;
2460
2602
  }) => void;
2461
- connectionStateChanged: (state: ConnectionState) => void;
2603
+ connectionStateChanged: (state: TwilsockConnectionState) => void;
2462
2604
  connectionError: (data: ConnectionError) => void;
2463
2605
  };
2464
2606
  /**
@@ -2471,7 +2613,7 @@ type ClientEvents = {
2471
2613
  * * `'denied'` - client connection is denied because of invalid JWT access
2472
2614
  * token. User must refresh token in order to proceed
2473
2615
  */
2474
- type ConnectionState = "disconnected" | "connecting" | "connected";
2616
+ type ConnectionState = TwilsockConnectionState;
2475
2617
  /**
2476
2618
  * State of the client. Possible values are as follows:
2477
2619
  * * `'failed'` - the client failed to initialize
@@ -2500,10 +2642,14 @@ interface ClientOptions {
2500
2642
  * The cache capacity for channel metadata.
2501
2643
  */
2502
2644
  channelMetadataCacheCapacity?: number;
2645
+ /**
2646
+ * The cache capacity for message recipients.
2647
+ */
2648
+ messageRecipientsCacheCapacity?: number;
2503
2649
  region?: string;
2504
2650
  productId?: string;
2505
2651
  twilsockClient?: TwilsockClient;
2506
- transport?: TwilsockClient;
2652
+ transport?: Transport;
2507
2653
  notificationsClient?: NotificationClient;
2508
2654
  syncClient?: SyncClient;
2509
2655
  typingIndicatorTimeoutOverride?: number;
@@ -2518,6 +2664,7 @@ interface ClientOptions {
2518
2664
  Notification?: Record<string, unknown>;
2519
2665
  Twilsock?: Record<string, unknown>;
2520
2666
  clientMetadata?: Record<string, unknown>;
2667
+ initRegistrations?: InitRegistration[];
2521
2668
  disableDeepClone?: boolean;
2522
2669
  typingUri?: string;
2523
2670
  apiUri?: string;
@@ -2717,6 +2864,15 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2717
2864
  * @event
2718
2865
  */
2719
2866
  static readonly userUpdated = "userUpdated";
2867
+ /**
2868
+ * @deprecated Use initialized or initFailed events instead
2869
+ * Fired when the state of the client has been changed.
2870
+ *
2871
+ * Parameters:
2872
+ * 1. {@link State} `state` - the new client state
2873
+ * @event
2874
+ */
2875
+ static readonly stateChanged = "stateChanged";
2720
2876
  /**
2721
2877
  * Fired when the client has completed initialization successfully.
2722
2878
  * @event
@@ -2776,7 +2932,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2776
2932
  /**
2777
2933
  * Client connection state.
2778
2934
  */
2779
- connectionState: ConnectionState | "unknown";
2935
+ connectionState: ConnectionState;
2780
2936
  /**
2781
2937
  * Promise that resolves on successful initialization.
2782
2938
  */
@@ -2840,6 +2996,32 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2840
2996
  * initialization was completed.
2841
2997
  */
2842
2998
  get reachabilityEnabled(): boolean;
2999
+ /**
3000
+ * @deprecated
3001
+ * Current token.
3002
+ * @internal
3003
+ */
3004
+ get token(): string;
3005
+ /**
3006
+ * @deprecated Call constructor directly.
3007
+ *
3008
+ * Factory method to create a Conversations client instance.
3009
+ *
3010
+ * The factory method will automatically trigger connection.
3011
+ * Do not use it if you need finer-grained control.
3012
+ *
3013
+ * Since this method returns an already-initialized client, some of the events
3014
+ * will be lost because they happen *before* the initialization. It is
3015
+ * recommended that `client.onWithReplay` is used as opposed to `client.on`
3016
+ * for subscribing to client events. The `client.onWithReplay` will re-emit
3017
+ * the most recent value for a given event if it emitted before the
3018
+ * subscription.
3019
+ *
3020
+ * @param token Access token.
3021
+ * @param options Options to customize the client.
3022
+ * @returns Returns a fully initialized client.
3023
+ */
3024
+ static create(token: string, options?: ClientOptions | null): Promise<Client>;
2843
3025
  /**
2844
3026
  * Static method for push notification payload parsing. Returns parsed push as
2845
3027
  * a {@link PushNotification} object.
@@ -2851,6 +3033,11 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2851
3033
  * @param data Data to parse
2852
3034
  */
2853
3035
  private static _parsePushNotificationChatData;
3036
+ /**
3037
+ * Populate the client with init registrations.
3038
+ * @param reg The init registration to populate.
3039
+ */
3040
+ static populateInitRegistrations(reg: InitRegistration): void;
2854
3041
  /**
2855
3042
  * Gracefully shut down the client.
2856
3043
  */
@@ -2893,6 +3080,12 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2893
3080
  * on the platform.
2894
3081
  */
2895
3082
  setPushRegistrationId(channelType: NotificationsChannelType, registrationId: string): Promise<void>;
3083
+ /**
3084
+ * Unregister from push notifications.
3085
+ * @param channelType Channel type.
3086
+ * @deprecated Use removePushRegistrations() instead.
3087
+ */
3088
+ unsetPushRegistrationId(channelType: NotificationsChannelType): Promise<void>;
2896
3089
  /**
2897
3090
  * Clear existing registrations directly using provided device token.
2898
3091
  * This is useful to ensure stopped subscriptions without resubscribing.
@@ -2955,6 +3148,11 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2955
3148
  * @param channelType The channel type to subscribe to.
2956
3149
  */
2957
3150
  private _subscribeToPushNotifications;
3151
+ /**
3152
+ * Unsubscribe from push notifications.
3153
+ * @param channelType The channel type to unsubscribe from.
3154
+ */
3155
+ private _unsubscribeFromPushNotifications;
2958
3156
  }
2959
3157
  declare class NotificationTypes {
2960
3158
  static readonly TYPING_INDICATOR = "twilio.ipmsg.typing_indicator";
@@ -2964,7 +3162,4 @@ declare class NotificationTypes {
2964
3162
  static readonly REMOVED_FROM_CONVERSATION = "twilio.conversations.removed_from_conversation";
2965
3163
  static readonly CONSUMPTION_UPDATE = "twilio.channel.consumption_update";
2966
3164
  }
2967
- export { Conversation, ConversationBindings, ConversationEmailBinding, ConversationUpdateReason, ConversationStatus, NotificationLevel, ConversationState, ConversationUpdatedEventArgs, SendMediaOptions, SendEmailOptions, LastMessage, Participant, ParticipantUpdateReason, ParticipantType, ParticipantUpdatedEventArgs, ParticipantBindings, ParticipantEmailBinding, ParticipantEmailLevel, Message, MessageUpdateReason, MessageType, MessageUpdatedEventArgs, Media, AggregatedDeliveryReceipt, DeliveryAmount, DetailedDeliveryReceipt, DeliveryStatus, RestPaginator, MessageBuilder, UnsentMessage, Paginator, ParticipantBindingOptions, User, UserUpdateReason, UserUpdatedEventArgs, PushNotification, PushNotificationType, PushNotificationDescriptor, PushNotificationData, NotificationTypes, Client, State, ConnectionState, NotificationsChannelType, ClientOptions, CreateConversationOptions, ConversationLimits, CancellablePromise$0 as CancellablePromise, CancellationError, ContentDataActionUrl, ContentDataActionPhone, ContentDataActionReply, ContentDataActionOther, ContentDataAction, ContentDataText, ContentDataMedia, ContentDataLocation, ContentDataReply, ContentDataQuickReply, ContentDataCallToAction, ContentDataListPicker, ContentDataListItem, ContentDataCard, ContentDataOther, ContentData, ContentTemplate, ContentTemplateVariable, ChannelMetadata, LogLevel };
2968
- export { JSONValue, JSONObject, JSONArray } from "@twilio/shared";
2969
- export { MediaCategory } from "@twilio/mcs-client";
2970
- export { ChannelType } from "@twilio/notifications";
3165
+ export { Conversation, ConversationBindings, ConversationEmailBinding, ConversationUpdateReason, ConversationStatus, NotificationLevel, ConversationState, ConversationUpdatedEventArgs, SendMediaOptions, SendEmailOptions, LastMessage, Participant, ParticipantUpdateReason, ParticipantType, ParticipantUpdatedEventArgs, ParticipantBindings, ParticipantEmailBinding, ParticipantEmailLevel, Message, MessageUpdateReason, MessageType, MessageUpdatedEventArgs, Media, MediaCategory$0 as MediaCategory, AggregatedDeliveryReceipt, DeliveryAmount, DetailedDeliveryReceipt, DeliveryStatus, RestPaginator, MessageBuilder, UnsentMessage, Paginator, ParticipantBindingOptions, User, UserUpdateReason, UserUpdatedEventArgs, PushNotification, PushNotificationType, PushNotificationDescriptor, PushNotificationData, NotificationTypes, Client, State, ConnectionState, NotificationsChannelType, ClientOptions, CreateConversationOptions, ConversationLimits, JSONValue, JSONObject, JSONArray, CancellablePromise, ContentDataActionUrl, ContentDataActionPhone, ContentDataActionReply, ContentDataActionOther, ContentDataAction, ContentDataText, ContentDataMedia, ContentDataLocation, ContentDataReply, ContentDataQuickReply, ContentDataCallToAction, ContentDataListPicker, ContentDataListItem, ContentDataCard, ContentDataOther, ContentData, ContentTemplate, ContentTemplateVariable, ChannelMetadata, RecipientDescriptor, EmailRecipientDescriptor, UnknownRecipientDescriptor, EmailRecipientLevel };