@twilio/conversations 2.0.1-rc.7 → 2.1.0-rc.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.
- package/CHANGELOG.md +56 -0
- package/builds/browser.js +249 -65
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +86 -9
- package/builds/lib.js +249 -65
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +254 -251
- package/builds/twilio-conversations.min.js +3 -3
- package/dist/conversation.js +24 -10
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +1 -1
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +1 -1
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +7 -3
- package/dist/data/participants.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/attributes.js +147 -0
- package/dist/interfaces/attributes.js.map +1 -0
- package/dist/message-builder.js +52 -0
- package/dist/message-builder.js.map +1 -1
- package/dist/message.js +35 -4
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/participant.js +20 -3
- package/dist/participant.js.map +1 -1
- package/dist/user.js +2 -1
- package/dist/user.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/AggregatedDeliveryReceipt.html +15 -0
- package/docs/classes/Client.html +15 -0
- package/docs/classes/Conversation.html +24 -2
- package/docs/classes/DetailedDeliveryReceipt.html +15 -0
- package/docs/classes/Media.html +15 -0
- package/docs/classes/Message.html +83 -2
- package/docs/classes/MessageBuilder.html +91 -0
- package/docs/classes/Participant.html +45 -1
- package/docs/classes/PushNotification.html +15 -0
- package/docs/classes/RestPaginator.html +15 -0
- package/docs/classes/UnsentMessage.html +15 -0
- package/docs/classes/User.html +15 -0
- package/docs/index.html +37 -3
- package/docs/interfaces/ClientOptions.html +15 -0
- package/docs/interfaces/ConversationBindings.html +3118 -0
- package/docs/interfaces/ConversationEmailBinding.html +3118 -0
- package/docs/interfaces/ConversationState.html +15 -0
- package/docs/interfaces/CreateConversationOptions.html +15 -0
- package/docs/interfaces/LastMessage.html +15 -0
- package/docs/interfaces/Paginator.html +15 -0
- package/docs/interfaces/ParticipantBindings.html +3118 -0
- package/docs/interfaces/ParticipantEmailBinding.html +3118 -0
- package/docs/interfaces/PushNotificationData.html +15 -0
- package/docs/interfaces/SendEmailOptions.html +15 -0
- package/docs/interfaces/SendMediaOptions.html +15 -0
- package/docs/modules.html +37 -3
- package/package.json +9 -9
package/builds/lib.d.ts
CHANGED
@@ -292,6 +292,7 @@ interface ParticipantDescriptor {
|
|
292
292
|
lastConsumptionTimestamp: number;
|
293
293
|
type: ParticipantType;
|
294
294
|
userInfo: string;
|
295
|
+
bindings?: Object;
|
295
296
|
}
|
296
297
|
interface ParticipantServices {
|
297
298
|
users: Users;
|
@@ -303,15 +304,35 @@ interface ParticipantLinks {
|
|
303
304
|
/**
|
304
305
|
* The reason for the `updated` event being emitted by a participant.
|
305
306
|
*/
|
306
|
-
type ParticipantUpdateReason = "attributes" | "dateCreated" | "dateUpdated" | "roleSid" | "lastReadMessageIndex" | "lastReadTimestamp";
|
307
|
+
type ParticipantUpdateReason = "attributes" | "dateCreated" | "dateUpdated" | "roleSid" | "lastReadMessageIndex" | "lastReadTimestamp" | "bindings";
|
307
308
|
/**
|
308
309
|
* Type of a participant.
|
309
310
|
*/
|
310
|
-
type ParticipantType = "chat" | "sms" | "whatsapp";
|
311
|
+
type ParticipantType = "chat" | "sms" | "whatsapp" | "email";
|
311
312
|
interface ParticipantUpdatedEventArgs {
|
312
313
|
participant: Participant;
|
313
314
|
updateReasons: ParticipantUpdateReason[];
|
314
315
|
}
|
316
|
+
/**
|
317
|
+
* Bindings for conversation participant.
|
318
|
+
*/
|
319
|
+
interface ParticipantBindings {
|
320
|
+
email?: ParticipantEmailBinding;
|
321
|
+
}
|
322
|
+
/**
|
323
|
+
* Email participation level.
|
324
|
+
* to = to/from
|
325
|
+
* cc = cc
|
326
|
+
*/
|
327
|
+
type ParticipantEmailLevel = "to" | "cc";
|
328
|
+
/**
|
329
|
+
* Bindings for email participant.
|
330
|
+
*/
|
331
|
+
interface ParticipantEmailBinding {
|
332
|
+
name: string;
|
333
|
+
address: string;
|
334
|
+
level: ParticipantEmailLevel;
|
335
|
+
}
|
315
336
|
/**
|
316
337
|
* A participant represents a remote client in a conversation.
|
317
338
|
*/
|
@@ -360,9 +381,19 @@ declare class Participant extends ReplayEventEmitter<ParticipantEvents> {
|
|
360
381
|
get lastReadTimestamp(): Date;
|
361
382
|
get roleSid(): string;
|
362
383
|
/**
|
363
|
-
*
|
384
|
+
* Type of the participant.
|
364
385
|
*/
|
365
386
|
get type(): ParticipantType;
|
387
|
+
/**
|
388
|
+
* Get the bindings mapping for the current participant.
|
389
|
+
* Available binding depends on the participant type.
|
390
|
+
* You could access it as `participant.bindings.sms?.address` or
|
391
|
+
* using the type dynamically `participant.bindings[participant.type]`
|
392
|
+
* just be aware that the binding information has different structure for
|
393
|
+
* each participant type.
|
394
|
+
* See also {ParticipantEmailBinding}, the only available currently binding descriptor.
|
395
|
+
*/
|
396
|
+
get bindings(): ParticipantBindings;
|
366
397
|
/**
|
367
398
|
* @internal
|
368
399
|
*/
|
@@ -422,6 +453,9 @@ declare class Participant extends ReplayEventEmitter<ParticipantEvents> {
|
|
422
453
|
*/
|
423
454
|
updateAttributes(attributes: any): Promise<Participant>;
|
424
455
|
}
|
456
|
+
interface ParticipantBindingOptions {
|
457
|
+
email?: ParticipantEmailBinding;
|
458
|
+
}
|
425
459
|
/**
|
426
460
|
* Category of media. Possible values are as follows:
|
427
461
|
* * `'media'`
|
@@ -730,14 +764,14 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
730
764
|
*/
|
731
765
|
get attributes(): Object;
|
732
766
|
/**
|
733
|
-
*
|
767
|
+
* Type of the message.
|
734
768
|
*/
|
735
769
|
get type(): MessageType;
|
736
770
|
/**
|
737
|
-
* One of the attached media.
|
771
|
+
* One of the attached media (if present).
|
738
772
|
* @deprecated Use attachedMedia instead. Note that the latter is now an array.
|
739
773
|
*/
|
740
|
-
get media(): Media;
|
774
|
+
get media(): Media | null;
|
741
775
|
/**
|
742
776
|
* Return all media attachments, except email body/history attachments, without temporary urls.
|
743
777
|
*/
|
@@ -757,6 +791,18 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
757
791
|
* @returns Array of media descriptors matching given categories.
|
758
792
|
*/
|
759
793
|
getMediaByCategory(categories: Array<MediaCategory>): Array<Media> | null;
|
794
|
+
/**
|
795
|
+
* Get a media descriptor for an email body attachment of a provided type.
|
796
|
+
* Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.
|
797
|
+
* @param type Type of email body to request, defaults to `text/plain`.
|
798
|
+
*/
|
799
|
+
getEmailBody(type?: string): Media | null;
|
800
|
+
/**
|
801
|
+
* Get a media descriptor for an email history attachment of a provided type.
|
802
|
+
* Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.
|
803
|
+
* @param type Type of email history to request, defaults to `text/plain`.
|
804
|
+
*/
|
805
|
+
getEmailHistory(type?: string): Media | null;
|
760
806
|
_update(data: any): void;
|
761
807
|
/**
|
762
808
|
* Get the participant who is the author of the message.
|
@@ -897,6 +943,8 @@ declare class UnsentMessage {
|
|
897
943
|
declare class MessageBuilder {
|
898
944
|
private readonly limits;
|
899
945
|
private readonly message;
|
946
|
+
private emailBodies;
|
947
|
+
private emailHistories;
|
900
948
|
/**
|
901
949
|
* @internal
|
902
950
|
*/
|
@@ -916,6 +964,18 @@ declare class MessageBuilder {
|
|
916
964
|
* @param attributes Message attributes.
|
917
965
|
*/
|
918
966
|
setAttributes(attributes: any): MessageBuilder;
|
967
|
+
/**
|
968
|
+
* Set email body with given MIME-type.
|
969
|
+
* @param mimeType Format of the body to set (text/plain or text/html).
|
970
|
+
* @param body Body payload in selected format.
|
971
|
+
*/
|
972
|
+
setEmailBody(mimeType: string, body: FormData | SendMediaOptions): MessageBuilder;
|
973
|
+
/**
|
974
|
+
* Set email history with given MIME-type.
|
975
|
+
* @param mimeType Format of the history to set (text/plain or text/html).
|
976
|
+
* @param history History payload in selected format.
|
977
|
+
*/
|
978
|
+
setEmailHistory(mimeType: string, history: FormData | SendMediaOptions): MessageBuilder;
|
919
979
|
/**
|
920
980
|
* Adds media to the message.
|
921
981
|
* @param payload Media to add.
|
@@ -967,6 +1027,7 @@ interface ConversationDescriptor {
|
|
967
1027
|
dateCreated: any;
|
968
1028
|
dateUpdated: any;
|
969
1029
|
notificationLevel?: NotificationLevel;
|
1030
|
+
bindings?: ConversationBindings;
|
970
1031
|
}
|
971
1032
|
interface ConversationLinks {
|
972
1033
|
self: string;
|
@@ -976,7 +1037,7 @@ interface ConversationLinks {
|
|
976
1037
|
/**
|
977
1038
|
* The reason for the `updated` event being emitted by a conversation.
|
978
1039
|
*/
|
979
|
-
type ConversationUpdateReason = "attributes" | "createdBy" | "dateCreated" | "dateUpdated" | "friendlyName" | "lastReadMessageIndex" | "state" | "status" | "uniqueName" | "lastMessage" | "notificationLevel";
|
1040
|
+
type ConversationUpdateReason = "attributes" | "createdBy" | "dateCreated" | "dateUpdated" | "friendlyName" | "lastReadMessageIndex" | "state" | "status" | "uniqueName" | "lastMessage" | "notificationLevel" | "bindings";
|
980
1041
|
/**
|
981
1042
|
* The status of the conversation, relative to the client: whether
|
982
1043
|
* the conversation has been `joined` or the client is
|
@@ -1007,6 +1068,19 @@ interface ConversationUpdatedEventArgs {
|
|
1007
1068
|
conversation: Conversation;
|
1008
1069
|
updateReasons: ConversationUpdateReason[];
|
1009
1070
|
}
|
1071
|
+
/**
|
1072
|
+
* Binding for email conversation.
|
1073
|
+
*/
|
1074
|
+
interface ConversationBindings {
|
1075
|
+
email?: ConversationEmailBinding;
|
1076
|
+
}
|
1077
|
+
/**
|
1078
|
+
* Binding for email conversation.
|
1079
|
+
*/
|
1080
|
+
interface ConversationEmailBinding {
|
1081
|
+
name?: string;
|
1082
|
+
projected_address: string;
|
1083
|
+
}
|
1010
1084
|
/**
|
1011
1085
|
* Configuration for attaching a media file to a message.
|
1012
1086
|
* These options can be passed to {@link Conversation.sendMessage} and
|
@@ -1197,6 +1271,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1197
1271
|
* User notification level for this conversation.
|
1198
1272
|
*/
|
1199
1273
|
get notificationLevel(): NotificationLevel;
|
1274
|
+
get bindings(): ConversationBindings;
|
1200
1275
|
get limits(): Limits;
|
1201
1276
|
/**
|
1202
1277
|
* State of the conversation.
|
@@ -1255,8 +1330,9 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1255
1330
|
* @param proxyAddress Proxy (Twilio) address of the participant.
|
1256
1331
|
* @param address User address of the participant.
|
1257
1332
|
* @param attributes Attributes to be attached to the participant.
|
1333
|
+
* @param bindingOptions Options for adding email participants - name and CC/To level.
|
1258
1334
|
*/
|
1259
|
-
addNonChatParticipant(proxyAddress: string, address: string, attributes?: any): Promise<void>;
|
1335
|
+
addNonChatParticipant(proxyAddress: string, address: string, attributes?: Record<string, any>, bindingOptions?: ParticipantBindingOptions): Promise<void>;
|
1260
1336
|
/**
|
1261
1337
|
* Advance the conversation's last read message index to the current read horizon.
|
1262
1338
|
* Rejects if the user is not a participant of the conversation.
|
@@ -1360,6 +1436,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1360
1436
|
/**
|
1361
1437
|
* New interface to prepare for sending a message.
|
1362
1438
|
* Use instead of `sendMessage`.
|
1439
|
+
* @return A MessageBuilder to help set all message sending options.
|
1363
1440
|
*/
|
1364
1441
|
prepareMessage(): MessageBuilder;
|
1365
1442
|
/**
|
@@ -1957,4 +2034,4 @@ declare class NotificationTypes {
|
|
1957
2034
|
static readonly REMOVED_FROM_CONVERSATION = "twilio.conversations.removed_from_conversation";
|
1958
2035
|
static readonly CONSUMPTION_UPDATE = "twilio.channel.consumption_update";
|
1959
2036
|
}
|
1960
|
-
export { Conversation, ConversationUpdateReason, ConversationStatus, NotificationLevel, ConversationState, ConversationUpdatedEventArgs, SendMediaOptions, SendEmailOptions, LastMessage, Participant, ParticipantUpdateReason, ParticipantType, ParticipantUpdatedEventArgs, Message, MessageUpdateReason, MessageType, MessageUpdatedEventArgs, Media, MediaCategory$0 as MediaCategory, AggregatedDeliveryReceipt, DeliveryAmount, DetailedDeliveryReceipt, DeliveryStatus, RestPaginator, MessageBuilder, UnsentMessage, Paginator, User, UserUpdateReason, UserUpdatedEventArgs, PushNotification, PushNotificationType, PushNotificationDescriptor, PushNotificationData, NotificationTypes, Client, State, ConnectionState, NotificationsChannelType, ClientOptions, CreateConversationOptions };
|
2037
|
+
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 };
|