@twilio/conversations 1.3.0-rc7 → 2.0.0-rc.3
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 +201 -0
- package/README.md +5 -5
- package/dist/browser.js +7866 -0
- package/dist/browser.js.map +1 -0
- package/dist/docs/assets/css/main.css +2660 -0
- package/dist/docs/assets/images/icons.png +0 -0
- package/dist/docs/assets/images/icons@2x.png +0 -0
- package/dist/docs/assets/images/widgets.png +0 -0
- package/dist/docs/assets/images/widgets@2x.png +0 -0
- package/dist/docs/assets/js/main.js +248 -0
- package/dist/docs/assets/js/search.js +1 -0
- package/dist/docs/classes/AggregatedDeliveryReceipt.html +3286 -0
- package/dist/docs/classes/Client.html +4181 -0
- package/dist/docs/classes/Conversation.html +4397 -0
- package/dist/docs/classes/DetailedDeliveryReceipt.html +3265 -0
- package/dist/docs/classes/Media.html +3295 -0
- package/dist/docs/classes/Message.html +3713 -0
- package/dist/docs/classes/MessageBuilder.html +3280 -0
- package/dist/docs/classes/Participant.html +3517 -0
- package/dist/docs/classes/PushNotification.html +3232 -0
- package/dist/docs/classes/RestPaginator.html +3262 -0
- package/dist/docs/classes/UnsentMessage.html +3144 -0
- package/dist/docs/classes/User.html +3451 -0
- package/dist/docs/index.html +3387 -212
- package/dist/docs/interfaces/ClientOptions.html +3136 -0
- package/dist/docs/interfaces/ConversationState.html +3152 -0
- package/dist/docs/interfaces/CreateConversationOptions.html +3168 -0
- package/dist/docs/interfaces/LastMessage.html +3152 -0
- package/dist/docs/interfaces/Paginator.html +3243 -0
- package/dist/docs/interfaces/PushNotificationData.html +3168 -0
- package/dist/docs/interfaces/SendEmailOptions.html +3136 -0
- package/dist/docs/interfaces/SendMediaOptions.html +3169 -0
- package/dist/docs/modules.html +3418 -0
- package/dist/lib.d.ts +1944 -0
- package/dist/lib.js +7866 -0
- package/dist/lib.js.map +1 -0
- package/dist/post-install.js +29 -0
- package/dist/react-native.js +4031 -0
- package/dist/react-native.js.map +1 -0
- package/dist/twilio-conversations.js +40905 -0
- package/dist/twilio-conversations.min.js +156 -0
- package/package.json +59 -48
- package/.circleci/config.yml +0 -650
- package/.deepsource.toml +0 -6
- package/.env.example +0 -13
- package/browser/aggregateddeliveryreceipt.js +0 -152
- package/browser/client.js +0 -991
- package/browser/configuration.js +0 -80
- package/browser/conversation.js +0 -1826
- package/browser/data/conversations.js +0 -665
- package/browser/data/messages.js +0 -522
- package/browser/data/participants.js +0 -411
- package/browser/data/users.js +0 -281
- package/browser/detaileddeliveryreceipt.js +0 -44
- package/browser/index.js +0 -4
- package/browser/interfaces/limits.js +0 -3
- package/browser/interfaces/notificationtypes.js +0 -21
- package/browser/interfaces/paginator.js +0 -53
- package/browser/interfaces/responsecodes.js +0 -20
- package/browser/interfaces/transport.js +0 -3
- package/browser/logger.js +0 -141
- package/browser/media.js +0 -198
- package/browser/message.js +0 -685
- package/browser/participant.js +0 -415
- package/browser/pushnotification.js +0 -49
- package/browser/restpaginator.js +0 -74
- package/browser/services/network.js +0 -223
- package/browser/services/readhorizon.js +0 -181
- package/browser/services/typingindicator.js +0 -142
- package/browser/session.js +0 -505
- package/browser/sessionerror.js +0 -93
- package/browser/sri.json +0 -1
- package/browser/synclist.js +0 -90
- package/browser/synclistdescriptor.js +0 -29
- package/browser/syncpaginator.js +0 -63
- package/browser/user.js +0 -431
- package/browser/util/deferred.js +0 -56
- package/browser/util/index.js +0 -108
- package/dist/@twilio/conversations.js +0 -35565
- package/dist/@twilio/conversations.min.js +0 -204
- package/dist/docs/AggregatedDeliveryReceipt.html +0 -948
- package/dist/docs/Client.html +0 -5075
- package/dist/docs/Conversation.html +0 -6018
- package/dist/docs/DetailedDeliveryReceipt.html +0 -641
- package/dist/docs/Media.html +0 -694
- package/dist/docs/Message.html +0 -1934
- package/dist/docs/Paginator.html +0 -605
- package/dist/docs/Participant.html +0 -1510
- package/dist/docs/PushNotification.html +0 -836
- package/dist/docs/SessionError.html +0 -379
- package/dist/docs/User.html +0 -1315
- package/dist/docs/classes.list.html +0 -4431
- package/dist/docs/fonts/glyphicons-halflings-regular.eot +0 -0
- package/dist/docs/fonts/glyphicons-halflings-regular.svg +0 -288
- package/dist/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/dist/docs/fonts/glyphicons-halflings-regular.woff +0 -0
- package/dist/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/dist/docs/img/glyphicons-halflings-white.png +0 -0
- package/dist/docs/img/glyphicons-halflings.png +0 -0
- package/dist/docs/quicksearch.html +0 -31
- package/dist/docs/scripts/docstrap.lib.js +0 -11
- package/dist/docs/scripts/fulltext-search-ui.js +0 -89
- package/dist/docs/scripts/fulltext-search.js +0 -36
- package/dist/docs/scripts/lunr.min.js +0 -6
- package/dist/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/dist/docs/scripts/prettify/jquery.min.js +0 -6
- package/dist/docs/scripts/prettify/lang-css.js +0 -21
- package/dist/docs/scripts/prettify/prettify.js +0 -496
- package/dist/docs/scripts/sunlight.js +0 -1157
- package/dist/docs/scripts/toc.js +0 -203
- package/dist/docs/styles/darkstrap.css +0 -960
- package/dist/docs/styles/prettify-tomorrow.css +0 -132
- package/dist/docs/styles/site.cerulean.css +0 -7008
- package/dist/docs/styles/site.cosmo.css +0 -7061
- package/dist/docs/styles/site.cyborg.css +0 -7048
- package/dist/docs/styles/site.darkly.css +0 -7171
- package/dist/docs/styles/site.darkstrap.css +0 -5638
- package/dist/docs/styles/site.dibs-bootstrap.css +0 -5899
- package/dist/docs/styles/site.flatly.css +0 -7147
- package/dist/docs/styles/site.journal.css +0 -6973
- package/dist/docs/styles/site.lumen.css +0 -7298
- package/dist/docs/styles/site.paper.css +0 -7623
- package/dist/docs/styles/site.readable.css +0 -6997
- package/dist/docs/styles/site.sandstone.css +0 -7035
- package/dist/docs/styles/site.simplex.css +0 -7023
- package/dist/docs/styles/site.slate.css +0 -7343
- package/dist/docs/styles/site.spacelab.css +0 -7055
- package/dist/docs/styles/site.superhero.css +0 -7131
- package/dist/docs/styles/site.united.css +0 -6895
- package/dist/docs/styles/site.yeti.css +0 -7195
- package/dist/docs/styles/sunlight.dark.css +0 -345
- package/dist/docs/styles/sunlight.default.css +0 -344
- package/dist/sri.json +0 -1
- package/lib/aggregateddeliveryreceipt.d.ts +0 -98
- package/lib/aggregateddeliveryreceipt.js +0 -112
- package/lib/client.d.ts +0 -317
- package/lib/client.js +0 -633
- package/lib/configuration.d.ts +0 -21
- package/lib/configuration.js +0 -41
- package/lib/conversation.d.ts +0 -460
- package/lib/conversation.js +0 -940
- package/lib/data/conversations.d.ts +0 -57
- package/lib/data/conversations.js +0 -318
- package/lib/data/messages.d.ts +0 -75
- package/lib/data/messages.js +0 -208
- package/lib/data/participants.d.ts +0 -94
- package/lib/data/participants.js +0 -204
- package/lib/data/users.d.ts +0 -42
- package/lib/data/users.js +0 -113
- package/lib/detaileddeliveryreceipt.d.ts +0 -45
- package/lib/detaileddeliveryreceipt.js +0 -34
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/lib/interfaces/limits.d.ts +0 -8
- package/lib/interfaces/limits.js +0 -2
- package/lib/interfaces/notificationtypes.d.ts +0 -8
- package/lib/interfaces/notificationtypes.js +0 -11
- package/lib/interfaces/paginator.d.ts +0 -52
- package/lib/interfaces/paginator.js +0 -28
- package/lib/interfaces/responsecodes.d.ts +0 -8
- package/lib/interfaces/responsecodes.js +0 -10
- package/lib/interfaces/transport.d.ts +0 -13
- package/lib/interfaces/transport.js +0 -2
- package/lib/logger.d.ts +0 -18
- package/lib/logger.js +0 -35
- package/lib/media.d.ts +0 -52
- package/lib/media.js +0 -69
- package/lib/message.d.ts +0 -136
- package/lib/message.js +0 -305
- package/lib/participant.d.ts +0 -142
- package/lib/participant.js +0 -219
- package/lib/pushnotification.d.ts +0 -48
- package/lib/pushnotification.js +0 -39
- package/lib/restpaginator.d.ts +0 -19
- package/lib/restpaginator.js +0 -36
- package/lib/services/network.d.ts +0 -22
- package/lib/services/network.js +0 -87
- package/lib/services/readhorizon.d.ts +0 -28
- package/lib/services/readhorizon.js +0 -112
- package/lib/services/typingindicator.d.ts +0 -50
- package/lib/services/typingindicator.js +0 -102
- package/lib/session.d.ts +0 -63
- package/lib/session.js +0 -213
- package/lib/sessionerror.d.ts +0 -12
- package/lib/sessionerror.js +0 -24
- package/lib/sri.json +0 -1
- package/lib/synclist.d.ts +0 -24
- package/lib/synclist.js +0 -28
- package/lib/synclistdescriptor.d.ts +0 -27
- package/lib/synclistdescriptor.js +0 -19
- package/lib/syncpaginator.d.ts +0 -22
- package/lib/syncpaginator.js +0 -37
- package/lib/user.d.ts +0 -98
- package/lib/user.js +0 -219
- package/lib/util/deferred.d.ts +0 -12
- package/lib/util/deferred.js +0 -22
- package/lib/util/index.d.ts +0 -28
- package/lib/util/index.js +0 -82
- package/tools/rtd-sdk-cdn-pin/.gitrepo +0 -12
- package/tools/rtd-sdk-cdn-pin/README.md +0 -54
- package/tools/rtd-sdk-cdn-pin/bintray-settings.xml.template +0 -16
- package/tools/rtd-sdk-cdn-pin/cdn-common/cdn-prepare.sh +0 -67
- package/tools/rtd-sdk-cdn-pin/cdn-pin-latest.sh +0 -19
- package/tools/rtd-sdk-cdn-pin/cdn-pin.sh +0 -19
- package/tools/rtd-sdk-cdn-pin/cdn-upload.sh +0 -13
- package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-bintray-android.sh +0 -34
- package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-npm.sh +0 -18
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-android.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-js.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-android.sh +0 -6
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-js.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-android.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-js.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch-artifact.sh +0 -26
- package/tools/sdk-release-tool/.gitrepo +0 -12
- package/tools/sdk-release-tool/Makefile +0 -49
- package/tools/sdk-release-tool/README.md +0 -275
- package/tools/sdk-release-tool/delete +0 -3
- package/tools/sdk-release-tool/download +0 -3
- package/tools/sdk-release-tool/get-cors +0 -3
- package/tools/sdk-release-tool/list +0 -3
- package/tools/sdk-release-tool/pin +0 -3
- package/tools/sdk-release-tool/pin-latest +0 -3
- package/tools/sdk-release-tool/requirements.txt +0 -4
- package/tools/sdk-release-tool/sdk-release-tool +0 -3
- package/tools/sdk-release-tool/sdk_release_tools/__init__.py +0 -0
- package/tools/sdk-release-tool/sdk_release_tools/__main__.py +0 -110
- package/tools/sdk-release-tool/sdk_release_tools/aws.py +0 -70
- package/tools/sdk-release-tool/sdk_release_tools/cli.py +0 -181
- package/tools/sdk-release-tool/sdk_release_tools/log.py +0 -24
- package/tools/sdk-release-tool/sdk_release_tools/ops.py +0 -295
- package/tools/sdk-release-tool/sdk_release_tools/rpm.py +0 -28
- package/tools/sdk-release-tool/sdk_release_tools/util.py +0 -186
- package/tools/sdk-release-tool/sdk_release_tools/versions.py +0 -362
- package/tools/sdk-release-tool/signal-sdk-js.json +0 -28
- package/tools/sdk-release-tool/tests/test_versions.py +0 -94
- package/tools/sdk-release-tool/twilio-accessmanager-android.json +0 -19
- package/tools/sdk-release-tool/twilio-accessmanager-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-auth-ios.json +0 -29
- package/tools/sdk-release-tool/twilio-authenticator-ios.json +0 -29
- package/tools/sdk-release-tool/twilio-chat-android-2.json +0 -19
- package/tools/sdk-release-tool/twilio-chat-android.json +0 -22
- package/tools/sdk-release-tool/twilio-chat-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-chat-js.json +0 -27
- package/tools/sdk-release-tool/twilio-client-android-aar.json +0 -22
- package/tools/sdk-release-tool/twilio-client-android.json +0 -22
- package/tools/sdk-release-tool/twilio-client-ios.json +0 -20
- package/tools/sdk-release-tool/twilio-client-js.json +0 -17
- package/tools/sdk-release-tool/twilio-client-sounds-js.json +0 -14
- package/tools/sdk-release-tool/twilio-common-android-maven.json +0 -16
- package/tools/sdk-release-tool/twilio-common-android.json +0 -22
- package/tools/sdk-release-tool/twilio-common-ios-rtc.json +0 -25
- package/tools/sdk-release-tool/twilio-common-ios.json +0 -25
- package/tools/sdk-release-tool/twilio-common-js.json +0 -19
- package/tools/sdk-release-tool/twilio-conversations-android.json +0 -22
- package/tools/sdk-release-tool/twilio-conversations-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-conversations-js.json +0 -27
- package/tools/sdk-release-tool/twilio-flex-js.json +0 -20
- package/tools/sdk-release-tool/twilio-flex-webchat-js.json +0 -16
- package/tools/sdk-release-tool/twilio-frame-chat-android.json +0 -22
- package/tools/sdk-release-tool/twilio-frame-chat-ios.json +0 -23
- package/tools/sdk-release-tool/twilio-frame-chat-js.json +0 -23
- package/tools/sdk-release-tool/twilio-ip-messaging-android-maven.json +0 -16
- package/tools/sdk-release-tool/twilio-ip-messaging-android.json +0 -22
- package/tools/sdk-release-tool/twilio-ip-messaging-ios.json +0 -25
- package/tools/sdk-release-tool/twilio-ip-messaging-js.json +0 -21
- package/tools/sdk-release-tool/twilio-sync-android.json +0 -22
- package/tools/sdk-release-tool/twilio-sync-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-sync-js.json +0 -39
- package/tools/sdk-release-tool/twilio-taskrouter-js.json +0 -17
- package/tools/sdk-release-tool/twilio-video-android.json +0 -22
- package/tools/sdk-release-tool/twilio-video-cpp-linux-cross-rootfs.json +0 -13
- package/tools/sdk-release-tool/twilio-video-cpp.json +0 -33
- package/tools/sdk-release-tool/twilio-video-ios.json +0 -25
- package/tools/sdk-release-tool/twilio-video-js.json +0 -19
- package/tools/sdk-release-tool/twilio-video-jsdocs.json +0 -14
- package/tools/sdk-release-tool/twilio-voice-android.json +0 -22
- package/tools/sdk-release-tool/twilio-voice-ios.json +0 -29
- package/tools/sdk-release-tool/unpin +0 -3
- package/tools/sdk-release-tool/unpin-latest +0 -3
- package/tools/sdk-release-tool/upload +0 -3
- package/twilio-chat.js.iml +0 -9
package/lib/configuration.js
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const TYPING_PATH = '/v1/typing';
|
4
|
-
const TYPING_TIMEOUT = 5;
|
5
|
-
const HTTP_CACHE_LIFETIME = 'PT5S';
|
6
|
-
const CONSUMPTION_HORIZON_SENDING_INTERVAL = 'PT5S';
|
7
|
-
const USER_INFOS_TO_SUBSCRIBE = 100;
|
8
|
-
const MINIMUM_RETRY_DELAY = 1000;
|
9
|
-
const MAXIMUM_RETRY_DELAY = 4000;
|
10
|
-
const MAXIMUM_ATTEMPTS_COUNT = 3;
|
11
|
-
const RETRY_WHEN_THROTTLED = true;
|
12
|
-
class Configuration {
|
13
|
-
constructor(options) {
|
14
|
-
options = options || {};
|
15
|
-
let constructorOptions = options.Chat || options.IPMessaging || options || {};
|
16
|
-
this.region = constructorOptions.region || options.region;
|
17
|
-
this.baseUrl = constructorOptions.apiUri || constructorOptions.typingUri ||
|
18
|
-
((!this.region || this.region === 'us1') ? 'https://aim.twilio.com' : `https://aim.${this.region}.twilio.com`);
|
19
|
-
this.typingIndicatorUri = this.baseUrl + TYPING_PATH;
|
20
|
-
this.typingIndicatorTimeoutOverride = constructorOptions.typingIndicatorTimeoutOverride;
|
21
|
-
this.httpCacheIntervalOverride = constructorOptions.httpCacheIntervalOverride;
|
22
|
-
this.consumptionReportIntervalOverride = constructorOptions.consumptionReportIntervalOverride;
|
23
|
-
this.userInfosToSubscribeOverride = constructorOptions.userInfosToSubscribeOverride;
|
24
|
-
this.retryWhenThrottledOverride = constructorOptions.retryWhenThrottledOverride;
|
25
|
-
this.backoffConfigOverride = constructorOptions.backoffConfigOverride;
|
26
|
-
this.productId = options.productId;
|
27
|
-
}
|
28
|
-
get typingIndicatorTimeoutDefault() { return TYPING_TIMEOUT * 1000; }
|
29
|
-
get httpCacheIntervalDefault() { return HTTP_CACHE_LIFETIME; }
|
30
|
-
get consumptionReportIntervalDefault() { return CONSUMPTION_HORIZON_SENDING_INTERVAL; }
|
31
|
-
get userInfosToSubscribeDefault() { return USER_INFOS_TO_SUBSCRIBE; }
|
32
|
-
get retryWhenThrottledDefault() { return RETRY_WHEN_THROTTLED; }
|
33
|
-
get backoffConfigDefault() {
|
34
|
-
return {
|
35
|
-
min: MINIMUM_RETRY_DELAY,
|
36
|
-
max: MAXIMUM_RETRY_DELAY,
|
37
|
-
maxAttemptsCount: MAXIMUM_ATTEMPTS_COUNT
|
38
|
-
};
|
39
|
-
}
|
40
|
-
}
|
41
|
-
exports.Configuration = Configuration;
|
package/lib/conversation.d.ts
DELETED
@@ -1,460 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import { EventEmitter } from 'events';
|
3
|
-
import { Participant } from './participant';
|
4
|
-
import { Message } from './message';
|
5
|
-
import { Users } from './data/users';
|
6
|
-
import { Paginator } from './interfaces/paginator';
|
7
|
-
import { Conversations } from './data/conversations';
|
8
|
-
import { McsClient, MediaCategory } from 'twilio-mcs-client';
|
9
|
-
import { SyncClient } from 'twilio-sync';
|
10
|
-
import { Session } from './session';
|
11
|
-
import { ReadHorizon } from './services/readhorizon';
|
12
|
-
import { TypingIndicator } from './services/typingindicator';
|
13
|
-
import { Network } from './services/network';
|
14
|
-
import { MediaLimits } from './interfaces/limits';
|
15
|
-
export interface ConversationServices {
|
16
|
-
session: Session;
|
17
|
-
users: Users;
|
18
|
-
typingIndicator: TypingIndicator;
|
19
|
-
readHorizon: ReadHorizon;
|
20
|
-
network: Network;
|
21
|
-
mcsClient: McsClient;
|
22
|
-
syncClient: SyncClient;
|
23
|
-
limits: MediaLimits;
|
24
|
-
}
|
25
|
-
interface ConversationDescriptor {
|
26
|
-
channel: string;
|
27
|
-
entityName: string;
|
28
|
-
uniqueName: string;
|
29
|
-
attributes: any;
|
30
|
-
createdBy?: string;
|
31
|
-
friendlyName?: string;
|
32
|
-
lastConsumedMessageIndex: number;
|
33
|
-
dateCreated: any;
|
34
|
-
dateUpdated: any;
|
35
|
-
notificationLevel?: Conversation.NotificationLevel;
|
36
|
-
bindings?: Conversation.Bindings;
|
37
|
-
}
|
38
|
-
declare namespace Conversation {
|
39
|
-
type UpdateReason = 'attributes' | 'createdBy' | 'dateCreated' | 'dateUpdated' | 'friendlyName' | 'lastReadMessageIndex' | 'state' | 'status' | 'uniqueName' | 'lastMessage' | 'notificationLevel' | 'bindings';
|
40
|
-
type Status = 'notParticipating' | 'joined';
|
41
|
-
type NotificationLevel = 'default' | 'muted';
|
42
|
-
type State = {
|
43
|
-
current: 'active' | 'inactive' | 'closed';
|
44
|
-
dateUpdated: Date;
|
45
|
-
} | undefined;
|
46
|
-
interface UpdatedEventArgs {
|
47
|
-
conversation: Conversation;
|
48
|
-
updateReasons: Conversation.UpdateReason[];
|
49
|
-
}
|
50
|
-
interface Bindings {
|
51
|
-
email?: EmailBinding;
|
52
|
-
}
|
53
|
-
interface EmailBinding {
|
54
|
-
name?: string;
|
55
|
-
projected_address: string;
|
56
|
-
}
|
57
|
-
interface SendMediaOptions {
|
58
|
-
contentType: string;
|
59
|
-
media: string | Buffer;
|
60
|
-
}
|
61
|
-
interface SendEmailOptions {
|
62
|
-
subject?: string;
|
63
|
-
}
|
64
|
-
interface LastMessage {
|
65
|
-
index?: number;
|
66
|
-
dateCreated?: Date;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
declare class UnsentMessage {
|
70
|
-
private messagesEntity;
|
71
|
-
text?: string;
|
72
|
-
attributes: any;
|
73
|
-
mediaContent: Array<[MediaCategory, FormData | Conversation.SendMediaOptions]>;
|
74
|
-
emailOptions?: Conversation.SendEmailOptions;
|
75
|
-
constructor(messagesEntity: any);
|
76
|
-
/**
|
77
|
-
* Send the prepared message to the conversation.
|
78
|
-
* @returns {Promise<number>} new Message's index in the Conversation's messages list
|
79
|
-
*/
|
80
|
-
send(): Promise<number>;
|
81
|
-
}
|
82
|
-
declare class MessageBuilder {
|
83
|
-
private readonly limits;
|
84
|
-
private readonly message;
|
85
|
-
private emailBodies;
|
86
|
-
private emailHistories;
|
87
|
-
constructor(limits: MediaLimits, messagesEntity: any);
|
88
|
-
setBody(text: string): MessageBuilder;
|
89
|
-
setSubject(subject: string): MessageBuilder;
|
90
|
-
setAttributes(attributes: any): MessageBuilder;
|
91
|
-
setEmailBody(mimeType: string, body: FormData | Conversation.SendMediaOptions): MessageBuilder;
|
92
|
-
setEmailHistory(mimeType: string, history: FormData | Conversation.SendMediaOptions): MessageBuilder;
|
93
|
-
addMedia(payload: FormData | Conversation.SendMediaOptions): MessageBuilder;
|
94
|
-
build(): UnsentMessage;
|
95
|
-
private getPayloadContentType;
|
96
|
-
}
|
97
|
-
/**
|
98
|
-
* @classdesc A Conversation represents communication between multiple Conversations Clients
|
99
|
-
* @property {any} attributes - The Conversation's custom attributes
|
100
|
-
* @property {String} createdBy - The identity of the User that created this Conversation
|
101
|
-
* @property {Date} dateCreated - The Date this Conversation was created
|
102
|
-
* @property {Date} dateUpdated - The Date this Conversation was last updated
|
103
|
-
* @property {String} [friendlyName] - The Conversation's name
|
104
|
-
* @property {Number|null} lastReadMessageIndex - Index of the last Message the User has read in this Conversation
|
105
|
-
* @property {Conversation#LastMessage} lastMessage - Last Message sent to this Conversation
|
106
|
-
* @property {Conversation#NotificationLevel} notificationLevel - User Notification level for this Conversation
|
107
|
-
* @property {String} sid - The Conversation's unique system identifier
|
108
|
-
* @property {Conversation#Status} status - The Conversation's status
|
109
|
-
* @property {Conversation#State} state - The Conversation's state
|
110
|
-
* @property {String} uniqueName - The Conversation's unique name
|
111
|
-
* @fires Conversation#participantJoined
|
112
|
-
* @fires Conversation#participantLeft
|
113
|
-
* @fires Conversation#participantUpdated
|
114
|
-
* @fires Conversation#messageAdded
|
115
|
-
* @fires Conversation#messageRemoved
|
116
|
-
* @fires Conversation#messageUpdated
|
117
|
-
* @fires Conversation#typingEnded
|
118
|
-
* @fires Conversation#typingStarted
|
119
|
-
* @fires Conversation#updated
|
120
|
-
* @fires Conversation#removed
|
121
|
-
*/
|
122
|
-
declare class Conversation extends EventEmitter {
|
123
|
-
private services;
|
124
|
-
readonly sid: string;
|
125
|
-
private readonly channelState;
|
126
|
-
private statusSource;
|
127
|
-
private entityPromise;
|
128
|
-
private entityName;
|
129
|
-
private entity;
|
130
|
-
private messagesEntity;
|
131
|
-
private participantsEntity;
|
132
|
-
private readonly participants;
|
133
|
-
constructor(services: ConversationServices, descriptor: ConversationDescriptor, sid: string);
|
134
|
-
/**
|
135
|
-
* These options can be passed to {@link Conversation#sendMessage}.
|
136
|
-
* @typedef {Object} Conversation#SendMediaOptions
|
137
|
-
* @property {String} contentType - content type of media
|
138
|
-
* @property {String | Buffer} media - content to post
|
139
|
-
*/
|
140
|
-
/**
|
141
|
-
* These options can be passed to {@link Conversation#sendMessage}.
|
142
|
-
* @typedef {Object} Conversation#SendEmailOptions
|
143
|
-
* @property {String} subject - subject for the message. Ignored for media messages.
|
144
|
-
*/
|
145
|
-
/**
|
146
|
-
* The update reason for <code>updated</code> event emitted on Conversation
|
147
|
-
* @typedef {('attributes' | 'createdBy' | 'dateCreated' | 'dateUpdated' |
|
148
|
-
'friendlyName' | 'lastReadMessageIndex' | 'state' | 'status' | 'uniqueName' | 'lastMessage' |
|
149
|
-
'notificationLevel' | 'bindings')} Conversation#UpdateReason
|
150
|
-
*/
|
151
|
-
/**
|
152
|
-
* The status of the Conversation, relative to the Client: whether the Conversation has been <code>joined</code> or the Client is
|
153
|
-
* <code>notParticipating</code> in the Conversation.
|
154
|
-
* @typedef {('notParticipating' | 'joined')} Conversation#Status
|
155
|
-
*/
|
156
|
-
/**
|
157
|
-
* The User's Notification level for Conversation, determines whether the currently logged-in User will receive
|
158
|
-
* pushes for events in this Conversation. Can be either <code>muted</code> or <code>default</code>,
|
159
|
-
* where <code>default</code> defers to global Service push configuration.
|
160
|
-
* @typedef {('default' | 'muted')} Conversation#NotificationLevel
|
161
|
-
*/
|
162
|
-
/**
|
163
|
-
* The Conversation's state.
|
164
|
-
* @typedef {Object} Conversation#State
|
165
|
-
* @property {('active' | 'inactive' | 'closed')} current - the current state
|
166
|
-
* @property {Date} dateUpdated - date at which the latest conversation state update happened
|
167
|
-
*/
|
168
|
-
get uniqueName(): string;
|
169
|
-
get status(): Conversation.Status;
|
170
|
-
get friendlyName(): string;
|
171
|
-
get dateUpdated(): any;
|
172
|
-
get dateCreated(): any;
|
173
|
-
get createdBy(): string;
|
174
|
-
get attributes(): Object;
|
175
|
-
get lastReadMessageIndex(): number | null;
|
176
|
-
get lastMessage(): Conversation.LastMessage;
|
177
|
-
get notificationLevel(): Conversation.NotificationLevel;
|
178
|
-
get state(): Conversation.State;
|
179
|
-
get bindings(): Conversation.Bindings;
|
180
|
-
get limits(): MediaLimits;
|
181
|
-
/**
|
182
|
-
* The Conversation's last message's information.
|
183
|
-
* @typedef {Object} Conversation#LastMessage
|
184
|
-
* @property {Number} index - Message's index
|
185
|
-
* @property {Date} dateCreated - Message's creation date
|
186
|
-
*/
|
187
|
-
/**
|
188
|
-
* Load and Subscribe to this Conversation and do not subscribe to its Participants and Messages.
|
189
|
-
* This or _subscribeStreams will need to be called before any events on Conversation will fire.
|
190
|
-
* @returns {Promise}
|
191
|
-
* @private
|
192
|
-
*/
|
193
|
-
_subscribe(): Promise<any>;
|
194
|
-
/**
|
195
|
-
* Load the attributes of this Conversation and instantiate its Participants and Messages.
|
196
|
-
* This or _subscribe will need to be called before any events on Conversation will fire.
|
197
|
-
* This will need to be called before any events on Participants or Messages will fire
|
198
|
-
* @returns {Promise}
|
199
|
-
* @private
|
200
|
-
*/
|
201
|
-
_subscribeStreams(): Promise<void>;
|
202
|
-
/**
|
203
|
-
* Stop listening for and firing events on this Conversation.
|
204
|
-
* @returns {Promise}
|
205
|
-
* @private
|
206
|
-
*/
|
207
|
-
_unsubscribe(): Promise<[void, any]>;
|
208
|
-
/**
|
209
|
-
* Set conversation status
|
210
|
-
* @private
|
211
|
-
*/
|
212
|
-
_setStatus(status: Conversation.Status, source: Conversations.DataSource): void;
|
213
|
-
/**
|
214
|
-
* If conversation's status update source
|
215
|
-
* @private
|
216
|
-
* @return {Conversations.DataSource}
|
217
|
-
*/
|
218
|
-
_statusSource(): Conversations.DataSource;
|
219
|
-
private static preprocessUpdate;
|
220
|
-
/**
|
221
|
-
* Updates local conversation object with new values
|
222
|
-
* @private
|
223
|
-
*/
|
224
|
-
_update(update: any): void;
|
225
|
-
/**
|
226
|
-
* @private
|
227
|
-
*/
|
228
|
-
private _onMessageAdded;
|
229
|
-
/**
|
230
|
-
* Add a participant to the Conversation by its Identity.
|
231
|
-
* @param {String} identity - Identity of the Client to add
|
232
|
-
* @param {any} [attributes] Attributes to be attached to the participant
|
233
|
-
* @returns {Promise<void>}
|
234
|
-
*/
|
235
|
-
add(identity: string, attributes?: any): Promise<void>;
|
236
|
-
/**
|
237
|
-
* Add a non-chat participant to the Conversation.
|
238
|
-
*
|
239
|
-
* @param {String} proxyAddress Proxy (Twilio) address of the participant
|
240
|
-
* @param {String} address User address of the participant
|
241
|
-
* @param {any} [attributes] Attributes to be attached to the participant
|
242
|
-
* @returns {Promise<void>}
|
243
|
-
*/
|
244
|
-
addNonChatParticipant(proxyAddress: string, address: string, attributes?: Record<string, any>): Promise<any>;
|
245
|
-
/**
|
246
|
-
* Advance Conversation's last read Message index to current read horizon.
|
247
|
-
* Rejects if User is not Participant of Conversation.
|
248
|
-
* Last read Message index is updated only if new index value is higher than previous.
|
249
|
-
* @param {Number} index - Message index to advance to as last read
|
250
|
-
* @returns {Promise<number>} resulting unread messages count in the conversation
|
251
|
-
*/
|
252
|
-
advanceLastReadMessageIndex(index: number): Promise<number>;
|
253
|
-
/**
|
254
|
-
* Delete the Conversation and unsubscribe from its events.
|
255
|
-
* @returns {Promise<Conversation>}
|
256
|
-
*/
|
257
|
-
delete(): Promise<Conversation>;
|
258
|
-
/**
|
259
|
-
* Get the custom attributes of this Conversation.
|
260
|
-
* @returns {Promise<any>} attributes of this Conversation
|
261
|
-
*/
|
262
|
-
getAttributes(): Promise<any>;
|
263
|
-
/**
|
264
|
-
* Returns messages from conversation using paginator interface.
|
265
|
-
* @param {Number} [pageSize=30] Number of messages to return in single chunk
|
266
|
-
* @param {Number} [anchor] - Index of newest Message to fetch. From the end by default
|
267
|
-
* @param {('backwards'|'forward')} [direction=backwards] - Query direction. By default it query backwards
|
268
|
-
* from newer to older. 'forward' will query in opposite direction
|
269
|
-
* @returns {Promise<Paginator<Message>>} page of messages
|
270
|
-
*/
|
271
|
-
getMessages(pageSize?: number, anchor?: number, direction?: 'backwards' | 'forward'): Promise<Paginator<Message>>;
|
272
|
-
/**
|
273
|
-
* Get a list of all Participants joined to this Conversation.
|
274
|
-
* @returns {Promise<Participant[]>}
|
275
|
-
*/
|
276
|
-
getParticipants(): Promise<Participant[]>;
|
277
|
-
/**
|
278
|
-
* Get conversation participants count.
|
279
|
-
* <br/>
|
280
|
-
* This method is semi-realtime. This means that this data will be eventually correct,
|
281
|
-
* but will also possibly be incorrect for a few seconds. The Conversation system does not
|
282
|
-
* provide real time events for counter values changes.
|
283
|
-
* <br/>
|
284
|
-
* So this is quite useful for any UI badges, but is not recommended
|
285
|
-
* to build any core application logic based on these counters being accurate in real time.
|
286
|
-
* @returns {Promise<number>}
|
287
|
-
*/
|
288
|
-
getParticipantsCount(): Promise<number>;
|
289
|
-
/**
|
290
|
-
* Get a Participant by its SID.
|
291
|
-
* @param {String} participantSid - Participant sid
|
292
|
-
* @returns {Promise<Participant>}
|
293
|
-
*/
|
294
|
-
getParticipantBySid(participantSid: string): Promise<Participant>;
|
295
|
-
/**
|
296
|
-
* Get a Participant by its identity.
|
297
|
-
* @param {String} identity - Participant identity
|
298
|
-
* @returns {Promise<Participant>}
|
299
|
-
*/
|
300
|
-
getParticipantByIdentity(identity: string): Promise<Participant>;
|
301
|
-
/**
|
302
|
-
* Get total message count in a conversation.
|
303
|
-
* <br/>
|
304
|
-
* This method is semi-realtime. This means that this data will be eventually correct,
|
305
|
-
* but will also possibly be incorrect for a few seconds. The Conversations system does not
|
306
|
-
* provide real time events for counter values changes.
|
307
|
-
* <br/>
|
308
|
-
* So this is quite useful for any UI badges, but is not recommended
|
309
|
-
* to build any core application logic based on these counters being accurate in real time.
|
310
|
-
* @returns {Promise<number>}
|
311
|
-
*/
|
312
|
-
getMessagesCount(): Promise<number>;
|
313
|
-
/**
|
314
|
-
* Get unread messages count for the User if they are a Participant of this Conversation.
|
315
|
-
* Rejects if the User is not a Participant of the Conversation.
|
316
|
-
* <br/>
|
317
|
-
* Use this method to obtain the number of unread messages together with
|
318
|
-
* updateLastReadMessageIndex() instead of relying on the
|
319
|
-
* Message indices which may have gaps. See Message.index for details.
|
320
|
-
* <br/>
|
321
|
-
* This method is semi-realtime. This means that this data will be eventually correct,
|
322
|
-
* but will also possibly be incorrect for a few seconds. The Chat system does not
|
323
|
-
* provide real time events for counter values changes.
|
324
|
-
* <br/>
|
325
|
-
* This is quite useful for any “unread messages count” badges, but is not recommended
|
326
|
-
* to build any core application logic based on these counters being accurate in real time.
|
327
|
-
* @returns {Promise<number|null>}
|
328
|
-
*/
|
329
|
-
getUnreadMessagesCount(): Promise<number | null>;
|
330
|
-
/**
|
331
|
-
* Join the Conversation and subscribe to its events.
|
332
|
-
* @returns {Promise<Conversation>}
|
333
|
-
*/
|
334
|
-
join(): Promise<Conversation>;
|
335
|
-
/**
|
336
|
-
* Leave the Conversation.
|
337
|
-
* @returns {Promise<Conversation>}
|
338
|
-
*/
|
339
|
-
leave(): Promise<Conversation>;
|
340
|
-
/**
|
341
|
-
* Remove a Participant from the Conversation. When a string is passed as the argument, it will assume that the string is an identity.
|
342
|
-
* @param {String|Participant} participant - identity or participant object to remove
|
343
|
-
* @returns {Promise<void>}
|
344
|
-
*/
|
345
|
-
removeParticipant(participant: string | Participant): Promise<void>;
|
346
|
-
/**
|
347
|
-
* Send a Message in the Conversation.
|
348
|
-
* @param {String|FormData|Conversation#SendMediaOptions|null} message - The message body for text message,
|
349
|
-
* FormData or MediaOptions for media content. Sending FormData supported only with browser engine
|
350
|
-
* @param {any} [messageAttributes] - attributes for the message
|
351
|
-
* @param {Conversation#SendEmailOptions} [emailOptions] - email options for the message
|
352
|
-
* @returns {Promise<number>} new Message's index in the Conversation's messages list
|
353
|
-
*/
|
354
|
-
sendMessage(message: string | FormData | Conversation.SendMediaOptions | null, messageAttributes?: any, emailOptions?: Conversation.SendEmailOptions): Promise<number>;
|
355
|
-
prepareMessage(): MessageBuilder;
|
356
|
-
/**
|
357
|
-
* Set last read Conversation's Message index to last known Message's index in this Conversation.
|
358
|
-
* @returns {Promise<number>} resulting unread messages count in the conversation
|
359
|
-
*/
|
360
|
-
setAllMessagesRead(): Promise<number>;
|
361
|
-
/**
|
362
|
-
* Set all messages in the conversation unread.
|
363
|
-
* @returns {Promise<number>} resulting unread messages count in the conversation
|
364
|
-
*/
|
365
|
-
setAllMessagesUnread(): Promise<number>;
|
366
|
-
/**
|
367
|
-
* Set User Notification level for this conversation.
|
368
|
-
* @param {Conversation#NotificationLevel} notificationLevel - The new user notification level
|
369
|
-
* @returns {Promise<void>}
|
370
|
-
*/
|
371
|
-
setUserNotificationLevel(notificationLevel: Conversation.NotificationLevel): Promise<void>;
|
372
|
-
/**
|
373
|
-
* Send a notification to the server indicating that this Client is currently typing in this Conversation.
|
374
|
-
* Typing ended notification is sent after a while automatically, but by calling again this method you ensure typing ended is not received.
|
375
|
-
* @returns {Promise<void>}
|
376
|
-
*/
|
377
|
-
typing(): Promise<void>;
|
378
|
-
/**
|
379
|
-
* Update the Conversation's attributes.
|
380
|
-
* @param {any} attributes - The new attributes object
|
381
|
-
* @returns {Promise<Conversation>}
|
382
|
-
*/
|
383
|
-
updateAttributes(attributes: any): Promise<Conversation>;
|
384
|
-
/**
|
385
|
-
* Update the Conversation's friendlyName.
|
386
|
-
* @param {String|null} name - The new Conversation friendlyName
|
387
|
-
* @returns {Promise<Conversation>}
|
388
|
-
*/
|
389
|
-
updateFriendlyName(name: string | null): Promise<Conversation>;
|
390
|
-
/**
|
391
|
-
* Set Conversation's last read Message index to current read horizon.
|
392
|
-
* @param {Number|null} index - Message index to set as last read.
|
393
|
-
* If null provided, then the behavior is identical to {@link Conversation#setAllMessagesUnread}
|
394
|
-
* @returns {Promise<number>} resulting unread messages count in the conversation
|
395
|
-
*/
|
396
|
-
updateLastReadMessageIndex(index: number | null): Promise<number>;
|
397
|
-
/**
|
398
|
-
* Update the Conversation's unique name.
|
399
|
-
* @param {String|null} uniqueName - New unique name for the Conversation. Setting unique name to null removes it.
|
400
|
-
* @returns {Promise<Conversation>}
|
401
|
-
*/
|
402
|
-
updateUniqueName(uniqueName: string | null): Promise<Conversation>;
|
403
|
-
}
|
404
|
-
export { ConversationDescriptor, Conversation, UnsentMessage };
|
405
|
-
/**
|
406
|
-
* Fired when a Participant has joined the Conversation.
|
407
|
-
* @event Conversation#participantJoined
|
408
|
-
* @type {Participant}
|
409
|
-
*/
|
410
|
-
/**
|
411
|
-
* Fired when a Participant has left the Conversation.
|
412
|
-
* @event Conversation#participantLeft
|
413
|
-
* @type {Participant}
|
414
|
-
*/
|
415
|
-
/**
|
416
|
-
* Fired when a Participant's fields has been updated.
|
417
|
-
* @event Conversation#participantUpdated
|
418
|
-
* @type {Object}
|
419
|
-
* @property {Participant} participant - Updated Participant
|
420
|
-
* @property {Participant#UpdateReason[]} updateReasons - Array of Participant's updated event reasons
|
421
|
-
*/
|
422
|
-
/**
|
423
|
-
* Fired when a new Message has been added to the Conversation.
|
424
|
-
* @event Conversation#messageAdded
|
425
|
-
* @type {Message}
|
426
|
-
*/
|
427
|
-
/**
|
428
|
-
* Fired when Message is removed from Conversation's message list.
|
429
|
-
* @event Conversation#messageRemoved
|
430
|
-
* @type {Message}
|
431
|
-
*/
|
432
|
-
/**
|
433
|
-
* Fired when an existing Message's fields are updated with new values.
|
434
|
-
* @event Conversation#messageUpdated
|
435
|
-
* @type {Object}
|
436
|
-
* @property {Message} message - Updated Message
|
437
|
-
* @property {Message#UpdateReason[]} updateReasons - Array of Message's updated event reasons
|
438
|
-
*/
|
439
|
-
/**
|
440
|
-
* Fired when a Participant has stopped typing.
|
441
|
-
* @event Conversation#typingEnded
|
442
|
-
* @type {Participant}
|
443
|
-
*/
|
444
|
-
/**
|
445
|
-
* Fired when a Participant has started typing.
|
446
|
-
* @event Conversation#typingStarted
|
447
|
-
* @type {Participant}
|
448
|
-
*/
|
449
|
-
/**
|
450
|
-
* Fired when a Conversation's attributes or metadata have been updated.
|
451
|
-
* @event Conversation#updated
|
452
|
-
* @type {Object}
|
453
|
-
* @property {Conversation} conversation - Updated Conversation
|
454
|
-
* @property {Conversation#UpdateReason[]} updateReasons - Array of Conversation's updated event reasons
|
455
|
-
*/
|
456
|
-
/**
|
457
|
-
* Fired when the Conversation was destroyed or currently logged in User has left private Conversation
|
458
|
-
* @event Conversation#removed
|
459
|
-
* @type {Conversation}
|
460
|
-
*/
|