@twilio/conversations 3.0.1-rc.103 → 3.0.1

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 (124) hide show
  1. package/README.md +2 -2
  2. package/builds/browser.esm.js +10846 -0
  3. package/builds/browser.esm.js.map +1 -0
  4. package/builds/browser.js +579 -218
  5. package/builds/browser.js.map +1 -1
  6. package/builds/lib.d.ts +40 -27
  7. package/builds/lib.esm.d.ts +3178 -0
  8. package/builds/lib.esm.js +10845 -0
  9. package/builds/lib.js +588 -218
  10. package/builds/lib.js.map +1 -1
  11. package/builds/twilio-conversations.js +9111 -10398
  12. package/builds/twilio-conversations.js.map +1 -0
  13. package/builds/twilio-conversations.min.js +2 -1
  14. package/builds/twilio-conversations.min.js.map +1 -0
  15. package/dist/aggregated-delivery-receipt.js +1 -5
  16. package/dist/aggregated-delivery-receipt.js.map +1 -1
  17. package/dist/channel-metadata-client.js +5 -10
  18. package/dist/channel-metadata-client.js.map +1 -1
  19. package/dist/client.js +218 -206
  20. package/dist/client.js.map +1 -1
  21. package/dist/command-executor.js +6 -10
  22. package/dist/command-executor.js.map +1 -1
  23. package/dist/configuration.js +6 -10
  24. package/dist/configuration.js.map +1 -1
  25. package/dist/content-client.js +5 -9
  26. package/dist/content-client.js.map +1 -1
  27. package/dist/content-template.js +1 -7
  28. package/dist/content-template.js.map +1 -1
  29. package/dist/conversation.js +166 -136
  30. package/dist/conversation.js.map +1 -1
  31. package/dist/data/conversations.js +44 -46
  32. package/dist/data/conversations.js.map +1 -1
  33. package/dist/data/messages.js +18 -22
  34. package/dist/data/messages.js.map +1 -1
  35. package/dist/data/participants.js +22 -25
  36. package/dist/data/participants.js.map +1 -1
  37. package/dist/data/users.js +10 -14
  38. package/dist/data/users.js.map +1 -1
  39. package/dist/detailed-delivery-receipt.js +1 -5
  40. package/dist/detailed-delivery-receipt.js.map +1 -1
  41. package/dist/index.js +17 -49
  42. package/dist/index.js.map +1 -1
  43. package/dist/interfaces/notification-types.js +1 -5
  44. package/dist/interfaces/notification-types.js.map +1 -1
  45. package/dist/interfaces/rules.js +7 -13
  46. package/dist/interfaces/rules.js.map +1 -1
  47. package/dist/logger.js +9 -29
  48. package/dist/logger.js.map +1 -1
  49. package/dist/media.js +32 -25
  50. package/dist/media.js.map +1 -1
  51. package/dist/message-builder.js +43 -47
  52. package/dist/message-builder.js.map +1 -1
  53. package/dist/message-recipients-client.js +10 -16
  54. package/dist/message-recipients-client.js.map +1 -1
  55. package/dist/message.js +114 -98
  56. package/dist/message.js.map +1 -1
  57. package/dist/node_modules/quick-lru/index.js +1 -5
  58. package/dist/node_modules/quick-lru/index.js.map +1 -1
  59. package/dist/node_modules/tslib/tslib.es6.js +7 -6
  60. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  61. package/dist/packages/conversations/package.json.js +2 -6
  62. package/dist/packages/conversations/package.json.js.map +1 -1
  63. package/dist/participant.js +32 -37
  64. package/dist/participant.js.map +1 -1
  65. package/dist/push-notification.js +1 -5
  66. package/dist/push-notification.js.map +1 -1
  67. package/dist/rest-paginator.js +1 -5
  68. package/dist/rest-paginator.js.map +1 -1
  69. package/dist/services/network.js +3 -7
  70. package/dist/services/network.js.map +1 -1
  71. package/dist/services/typing-indicator.js +7 -10
  72. package/dist/services/typing-indicator.js.map +1 -1
  73. package/dist/unsent-message.js +5 -9
  74. package/dist/unsent-message.js.map +1 -1
  75. package/dist/user.js +21 -30
  76. package/dist/user.js.map +1 -1
  77. package/dist/util/deferred.js +1 -5
  78. package/dist/util/deferred.js.map +1 -1
  79. package/dist/util/index.js +36 -9
  80. package/dist/util/index.js.map +1 -1
  81. package/dist/utils/uuid.js +145 -0
  82. package/dist/utils/uuid.js.map +1 -0
  83. package/package.json +14 -17
  84. package/docs/assets/css/main.css +0 -2660
  85. package/docs/assets/images/icons.png +0 -0
  86. package/docs/assets/images/icons@2x.png +0 -0
  87. package/docs/assets/images/widgets.png +0 -0
  88. package/docs/assets/images/widgets@2x.png +0 -0
  89. package/docs/assets/js/main.js +0 -248
  90. package/docs/assets/js/search.js +0 -1
  91. package/docs/classes/AggregatedDeliveryReceipt.html +0 -3184
  92. package/docs/classes/CancellablePromise.html +0 -3213
  93. package/docs/classes/ChannelMetadata.html +0 -3050
  94. package/docs/classes/Client.html +0 -4278
  95. package/docs/classes/ContentTemplate.html +0 -3116
  96. package/docs/classes/ContentTemplateVariable.html +0 -3116
  97. package/docs/classes/Conversation.html +0 -4382
  98. package/docs/classes/DetailedDeliveryReceipt.html +0 -3163
  99. package/docs/classes/EmailRecipientDescriptor.html +0 -3098
  100. package/docs/classes/Media.html +0 -3167
  101. package/docs/classes/Message.html +0 -3826
  102. package/docs/classes/MessageBuilder.html +0 -3318
  103. package/docs/classes/Participant.html +0 -3444
  104. package/docs/classes/PushNotification.html +0 -3130
  105. package/docs/classes/RestPaginator.html +0 -3160
  106. package/docs/classes/UnknownRecipientDescriptor.html +0 -3067
  107. package/docs/classes/UnsentMessage.html +0 -3042
  108. package/docs/classes/User.html +0 -3349
  109. package/docs/index.html +0 -4373
  110. package/docs/interfaces/ClientOptions.html +0 -3066
  111. package/docs/interfaces/ConversationBindings.html +0 -3001
  112. package/docs/interfaces/ConversationEmailBinding.html +0 -3001
  113. package/docs/interfaces/ConversationLimits.html +0 -3098
  114. package/docs/interfaces/ConversationState.html +0 -3050
  115. package/docs/interfaces/ConversationUpdatedEventArgs.html +0 -3001
  116. package/docs/interfaces/CreateConversationOptions.html +0 -3066
  117. package/docs/interfaces/LastMessage.html +0 -3050
  118. package/docs/interfaces/Paginator.html +0 -3141
  119. package/docs/interfaces/ParticipantBindings.html +0 -3001
  120. package/docs/interfaces/ParticipantEmailBinding.html +0 -3001
  121. package/docs/interfaces/PushNotificationData.html +0 -3114
  122. package/docs/interfaces/SendEmailOptions.html +0 -3034
  123. package/docs/interfaces/SendMediaOptions.html +0 -3068
  124. package/docs/modules.html +0 -4374
package/builds/lib.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { SyncClient, SyncDocument, SyncList } from "twilio-sync";
3
2
  import { LogLevelDesc } from "loglevel";
4
3
  import { Transport, TwilsockClient, InitRegistration, TransportResult } from "twilsock";
@@ -6,8 +5,7 @@ import { ConnectionState as TwilsockConnectionState } from "twilsock";
6
5
  import { ReplayEventEmitter } from "@twilio/replay-event-emitter";
7
6
  import { ChannelType, Notifications } from "@twilio/notifications";
8
7
  import { Notifications as NotificationClient } from "@twilio/notifications";
9
- import { CancellablePromise, McsClient, MediaCategory, McsMedia } from "@twilio/mcs-client";
10
- import { MediaCategory as McsMediaCategory } from "@twilio/mcs-client";
8
+ import { CancellablePromise, McsClient, MediaCategory, McsMedia, McsMediaCategory, McsMediaState } from "@twilio/mcs-client";
11
9
  interface ConfigurationResponse {
12
10
  options: {
13
11
  consumption_report_interval: string;
@@ -524,13 +522,6 @@ interface ParticipantBindingOptions {
524
522
  * * `'history'`
525
523
  */
526
524
  type MediaCategory$0 = McsMediaCategory;
527
- interface MediaState {
528
- sid: string;
529
- category: MediaCategory$0;
530
- filename: string | null;
531
- contentType: string;
532
- size: number;
533
- }
534
525
  interface MediaServices {
535
526
  mcsClient: McsClient;
536
527
  }
@@ -544,7 +535,7 @@ declare class Media {
544
535
  /**
545
536
  * @internal
546
537
  */
547
- constructor(data: MediaState | McsMedia, services: MediaServices);
538
+ constructor(data: McsMediaState | McsMedia, services: MediaServices);
548
539
  /**
549
540
  * Server-assigned unique identifier for the media.
550
541
  */
@@ -574,6 +565,10 @@ declare class Media {
574
565
  */
575
566
  getContentTemporaryUrl(): CancellablePromise<string | null>;
576
567
  private _fetchMcsMedia;
568
+ /**
569
+ * @internal
570
+ */
571
+ _state(): McsMediaState;
577
572
  }
578
573
  /**
579
574
  * Signifies the amount of participants which have the status for the message.
@@ -1245,6 +1240,9 @@ interface Paginator<T> {
1245
1240
  */
1246
1241
  prevPage(): Promise<Paginator<T>>;
1247
1242
  }
1243
+ interface PaginatorOptions {
1244
+ pageSize?: number;
1245
+ }
1248
1246
  type MessageRecipientsClientServices = {
1249
1247
  commandExecutor: CommandExecutor;
1250
1248
  };
@@ -1315,7 +1313,7 @@ declare class MessageRecipientsClient {
1315
1313
  getRecipientsFromMessage(conversationSid: string, messageSid: string): Promise<RecipientDescriptor[]>;
1316
1314
  getRecipientsFromConversation(conversationSid: string, paginatorOptions?: {
1317
1315
  pageToken?: string;
1318
- pageSize?: string;
1316
+ pageSize?: number;
1319
1317
  }): Promise<Paginator<RecipientDescriptor>>;
1320
1318
  private _wrapResponse;
1321
1319
  }
@@ -1340,9 +1338,9 @@ interface MessageLinks {
1340
1338
  /**
1341
1339
  * The reason for the `updated` event being emitted by a message.
1342
1340
  */
1343
- type MessageUpdateReason = "body" | "lastUpdatedBy" | "dateCreated" | "dateUpdated" | "attributes" | "author" | "deliveryReceipt" | "subject";
1341
+ type MessageUpdateReason = "body" | "lastUpdatedBy" | "dateCreated" | "dateUpdated" | "attributes" | "author" | "deliveryReceipt" | "subject" | "media";
1344
1342
  /**
1345
- * Type of a message.
1343
+ * Type of message.
1346
1344
  */
1347
1345
  type MessageType = "text" | "media";
1348
1346
  interface MessageUpdatedEventArgs {
@@ -1370,6 +1368,7 @@ interface MessageData {
1370
1368
  * A message in a conversation.
1371
1369
  */
1372
1370
  declare class Message extends ReplayEventEmitter<MessageEvents> {
1371
+ #private;
1373
1372
  /**
1374
1373
  * Conversation that the message is in.
1375
1374
  */
@@ -2120,11 +2119,6 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2120
2119
  * @internal
2121
2120
  */
2122
2121
  readonly _links: ConversationLinks;
2123
- /**
2124
- * Map of participants.
2125
- * @internal
2126
- */
2127
- readonly _participants: Map<string, Participant>;
2128
2122
  /**
2129
2123
  * Configuration of the client that the conversation belongs to.
2130
2124
  */
@@ -2149,6 +2143,11 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2149
2143
  * Sync list containing messages.
2150
2144
  */
2151
2145
  private _messagesList?;
2146
+ /**
2147
+ * Map of participants.
2148
+ * @internal
2149
+ */
2150
+ readonly _participants: Map<string, Participant>;
2152
2151
  /**
2153
2152
  * Participants entity.
2154
2153
  */
@@ -2165,6 +2164,10 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2165
2164
  * Promise for the conversation entity document.
2166
2165
  */
2167
2166
  private _entityPromise;
2167
+ /**
2168
+ * Promise for the messages list.
2169
+ */
2170
+ private _streamsPromise;
2168
2171
  /**
2169
2172
  * Conversation entity document.
2170
2173
  */
@@ -2219,7 +2222,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2219
2222
  */
2220
2223
  get notificationLevel(): NotificationLevel;
2221
2224
  /**
2222
- * Conversation bindings. Undocumented feature (for now).
2225
+ * Conversation bindings. An undocumented feature (for now).
2223
2226
  * @internal
2224
2227
  */
2225
2228
  get bindings(): ConversationBindings;
@@ -2428,12 +2431,13 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2428
2431
  updateUniqueName(uniqueName: string | null): Promise<Conversation>;
2429
2432
  /**
2430
2433
  * Get recipients of all messages in the conversation.
2434
+ * @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.
2431
2435
  */
2432
- getMessageRecipients(): Promise<Paginator<RecipientDescriptor>>;
2436
+ getMessageRecipients(options?: PaginatorOptions): Promise<Paginator<RecipientDescriptor>>;
2433
2437
  /**
2434
2438
  * Load and subscribe to this conversation and do not subscribe to its
2435
2439
  * participants and messages. This or _subscribeStreams will need to be called
2436
- * before any events on conversation will fire.
2440
+ * before any events in the conversation will fire.
2437
2441
  * @internal
2438
2442
  */
2439
2443
  _subscribe(): Promise<SyncDocument>;
@@ -2446,7 +2450,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2446
2450
  * will throw an exception that will be caught and handled gracefully.
2447
2451
  * @internal
2448
2452
  */
2449
- _fetchStreams(): Promise<void>;
2453
+ _fetchStreams(): Promise<boolean>;
2450
2454
  /**
2451
2455
  * Load the attributes of this conversation and instantiate its participants
2452
2456
  * and messages. This or _subscribe will need to be called before any events
@@ -2668,6 +2672,7 @@ interface ClientOptions {
2668
2672
  disableDeepClone?: boolean;
2669
2673
  typingUri?: string;
2670
2674
  apiUri?: string;
2675
+ throwErrorsAlways?: boolean;
2671
2676
  }
2672
2677
  type ConnectionError = {
2673
2678
  terminal: boolean;
@@ -2689,6 +2694,11 @@ interface CreateConversationOptions {
2689
2694
  * A unique identifier of the conversation.
2690
2695
  */
2691
2696
  uniqueName?: string;
2697
+ /**
2698
+ * The access control for the conversation.
2699
+ * null for existing conversations, 'restricted' for conversations that need to support users with restricted access
2700
+ */
2701
+ access?: string;
2692
2702
  }
2693
2703
  /**
2694
2704
  * A client is the starting point to the Twilio Conversations functionality.
@@ -2936,7 +2946,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2936
2946
  /**
2937
2947
  * Promise that resolves on successful initialization.
2938
2948
  */
2939
- private readonly _ensureReady;
2949
+ private _ensureReady;
2940
2950
  /**
2941
2951
  * Options passed to the client.
2942
2952
  */
@@ -2974,7 +2984,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2974
2984
  */
2975
2985
  private _conversationsPromise;
2976
2986
  /**
2977
- * Returned Conversations instance is not yet fully initialized. Calling any
2987
+ * Returned Conversations Client instance is not yet fully initialized. Calling any
2978
2988
  * operations will block until it is. Use connection events to monitor when
2979
2989
  * client becomes fully available (connectionStateChanged with state
2980
2990
  * 'connected') or not available (connectionStateChange with state 'denied',
@@ -3055,7 +3065,6 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
3055
3065
  /**
3056
3066
  * Peek a conversation by its SID.
3057
3067
  * @param conversationSid Conversation sid
3058
- * @internal
3059
3068
  */
3060
3069
  peekConversationBySid(conversationSid: string): Promise<Conversation>;
3061
3070
  /**
@@ -3101,7 +3110,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
3101
3110
  */
3102
3111
  removePushRegistrations(channelType: ChannelType, registrationId: string): Promise<void>;
3103
3112
  /**
3104
- * Current version of the Conversations client.
3113
+ * Parse a push notification payload.
3105
3114
  */
3106
3115
  parsePushNotification: typeof Client.parsePushNotification;
3107
3116
  /**
@@ -3153,6 +3162,10 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
3153
3162
  * @param channelType The channel type to unsubscribe from.
3154
3163
  */
3155
3164
  private _unsubscribeFromPushNotifications;
3165
+ /**
3166
+ * Initialize the ensureReady promise.
3167
+ */
3168
+ private _initializeEnsureReady;
3156
3169
  }
3157
3170
  declare class NotificationTypes {
3158
3171
  static readonly TYPING_INDICATOR = "twilio.ipmsg.typing_indicator";