@twilio/conversations 2.0.0-rc.3 → 2.0.1-canary.2
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/README.md +24 -27
- package/{dist → builds}/browser.js +20 -21
- package/builds/browser.js.map +1 -0
- package/{dist → builds}/lib.d.ts +19 -3
- package/{dist → builds}/lib.js +20 -21
- package/builds/lib.js.map +1 -0
- package/{dist → builds}/twilio-conversations.js +1946 -1098
- package/builds/twilio-conversations.min.js +156 -0
- package/dist/aggregated-delivery-receipt.js +227 -0
- package/dist/aggregated-delivery-receipt.js.map +1 -0
- package/dist/client.js +872 -0
- package/dist/client.js.map +1 -0
- package/dist/command-executor.js +203 -0
- package/dist/command-executor.js.map +1 -0
- package/dist/configuration.js +196 -0
- package/dist/configuration.js.map +1 -0
- package/dist/conversation.js +973 -0
- package/dist/conversation.js.map +1 -0
- package/dist/data/conversations.js +443 -0
- package/dist/data/conversations.js.map +1 -0
- package/dist/data/messages.js +341 -0
- package/dist/data/messages.js.map +1 -0
- package/dist/data/participants.js +313 -0
- package/dist/data/participants.js.map +1 -0
- package/dist/data/users.js +228 -0
- package/dist/data/users.js.map +1 -0
- package/dist/detailed-delivery-receipt.js +154 -0
- package/dist/detailed-delivery-receipt.js.map +1 -0
- package/dist/index.js +167 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/notification-types.js +143 -0
- package/dist/interfaces/notification-types.js.map +1 -0
- package/dist/logger.js +190 -0
- package/dist/logger.js.map +1 -0
- package/dist/media.js +213 -0
- package/dist/media.js.map +1 -0
- package/dist/message-builder.js +209 -0
- package/dist/message-builder.js.map +1 -0
- package/dist/message.js +450 -0
- package/dist/message.js.map +1 -0
- package/dist/node_modules/tslib/tslib.es6.js +161 -0
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/packages/conversations/package.json.js +136 -0
- package/dist/packages/conversations/package.json.js.map +1 -0
- package/dist/participant.js +346 -0
- package/dist/participant.js.map +1 -0
- package/dist/push-notification.js +152 -0
- package/dist/push-notification.js.map +1 -0
- package/dist/rest-paginator.js +175 -0
- package/dist/rest-paginator.js.map +1 -0
- package/dist/services/network.js +205 -0
- package/dist/services/network.js.map +1 -0
- package/dist/services/typing-indicator.js +235 -0
- package/dist/services/typing-indicator.js.map +1 -0
- package/dist/unsent-message.js +159 -0
- package/dist/unsent-message.js.map +1 -0
- package/dist/user.js +392 -0
- package/dist/user.js.map +1 -0
- package/dist/util/deferred.js +154 -0
- package/dist/util/deferred.js.map +1 -0
- package/dist/util/index.js +206 -0
- package/dist/util/index.js.map +1 -0
- package/{dist/docs → docs}/assets/css/main.css +0 -0
- package/{dist/docs → docs}/assets/images/icons.png +0 -0
- package/{dist/docs → docs}/assets/images/icons@2x.png +0 -0
- package/{dist/docs → docs}/assets/images/widgets.png +0 -0
- package/{dist/docs → docs}/assets/images/widgets@2x.png +0 -0
- package/{dist/docs → docs}/assets/js/main.js +0 -0
- package/{dist/docs → docs}/assets/js/search.js +0 -0
- package/{dist/docs → docs}/classes/AggregatedDeliveryReceipt.html +0 -0
- package/{dist/docs → docs}/classes/Client.html +0 -0
- package/{dist/docs → docs}/classes/Conversation.html +0 -0
- package/{dist/docs → docs}/classes/DetailedDeliveryReceipt.html +0 -0
- package/{dist/docs → docs}/classes/Media.html +0 -0
- package/{dist/docs → docs}/classes/Message.html +0 -0
- package/{dist/docs → docs}/classes/MessageBuilder.html +0 -0
- package/{dist/docs → docs}/classes/Participant.html +0 -0
- package/{dist/docs → docs}/classes/PushNotification.html +0 -0
- package/{dist/docs → docs}/classes/RestPaginator.html +0 -0
- package/{dist/docs → docs}/classes/UnsentMessage.html +0 -0
- package/{dist/docs → docs}/classes/User.html +0 -0
- package/{dist/docs → docs}/index.html +24 -23
- package/{dist/docs → docs}/interfaces/ClientOptions.html +0 -0
- package/{dist/docs → docs}/interfaces/ConversationState.html +0 -0
- package/{dist/docs → docs}/interfaces/CreateConversationOptions.html +0 -0
- package/{dist/docs → docs}/interfaces/LastMessage.html +0 -0
- package/{dist/docs → docs}/interfaces/Paginator.html +0 -0
- package/{dist/docs → docs}/interfaces/PushNotificationData.html +1 -1
- package/{dist/docs → docs}/interfaces/SendEmailOptions.html +0 -0
- package/{dist/docs → docs}/interfaces/SendMediaOptions.html +2 -1
- package/{dist/docs → docs}/modules.html +24 -23
- package/package.json +27 -24
- package/CHANGELOG.md +0 -201
- package/dist/browser.js.map +0 -1
- package/dist/lib.js.map +0 -1
- package/dist/post-install.js +0 -29
- package/dist/react-native.js +0 -4031
- package/dist/react-native.js.map +0 -1
- package/dist/twilio-conversations.min.js +0 -156
@@ -0,0 +1,206 @@
|
|
1
|
+
/*
|
2
|
+
@license
|
3
|
+
The following license applies to all parts of this software except as
|
4
|
+
documented below.
|
5
|
+
|
6
|
+
Copyright (c) 2019, Twilio, inc.
|
7
|
+
All rights reserved.
|
8
|
+
|
9
|
+
Redistribution and use in source and binary forms, with or without
|
10
|
+
modification, are permitted provided that the following conditions are
|
11
|
+
met:
|
12
|
+
|
13
|
+
1. Redistributions of source code must retain the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer.
|
15
|
+
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright
|
17
|
+
notice, this list of conditions and the following disclaimer in
|
18
|
+
the documentation and/or other materials provided with the
|
19
|
+
distribution.
|
20
|
+
|
21
|
+
3. Neither the name of Twilio nor the names of its contributors may
|
22
|
+
be used to endorse or promote products derived from this software
|
23
|
+
without specific prior written permission.
|
24
|
+
|
25
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
26
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
27
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
28
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
29
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
30
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
31
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
32
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
33
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
34
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
35
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
36
|
+
|
37
|
+
This software includes javascript-state-machine under the following license.
|
38
|
+
|
39
|
+
Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
|
40
|
+
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
43
|
+
in the Software without restriction, including without limitation the rights
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
46
|
+
furnished to do so, subject to the following conditions:
|
47
|
+
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
49
|
+
copies or substantial portions of the Software.
|
50
|
+
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
57
|
+
|
58
|
+
This software includes loglevel under the following license.
|
59
|
+
|
60
|
+
Copyright (c) 2013 Tim Perry
|
61
|
+
|
62
|
+
Permission is hereby granted, free of charge, to any person
|
63
|
+
obtaining a copy of this software and associated documentation
|
64
|
+
files (the "Software"), to deal in the Software without
|
65
|
+
restriction, including without limitation the rights to use,
|
66
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
67
|
+
copies of the Software, and to permit persons to whom the
|
68
|
+
Software is furnished to do so, subject to the following
|
69
|
+
conditions:
|
70
|
+
|
71
|
+
The above copyright notice and this permission notice shall be
|
72
|
+
included in all copies or substantial portions of the Software.
|
73
|
+
|
74
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
75
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
76
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
77
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
78
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
79
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
80
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
81
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
82
|
+
|
83
|
+
This software includes q under the following license.
|
84
|
+
|
85
|
+
Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
|
86
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
87
|
+
of this software and associated documentation files (the "Software"), to
|
88
|
+
deal in the Software without restriction, including without limitation the
|
89
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
90
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
91
|
+
furnished to do so, subject to the following conditions:
|
92
|
+
|
93
|
+
The above copyright notice and this permission notice shall be included in
|
94
|
+
all copies or substantial portions of the Software.
|
95
|
+
|
96
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
97
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
98
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
99
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
100
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
101
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
102
|
+
IN THE SOFTWARE.
|
103
|
+
|
104
|
+
This software includes platform.js under the following license.
|
105
|
+
|
106
|
+
Copyright 2014 Benjamin Tan <https://d10.github.io/>
|
107
|
+
Copyright 2011-2015 John-David Dalton <http://allyoucanleet.com/>
|
108
|
+
|
109
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
110
|
+
a copy of this software and associated documentation files (the
|
111
|
+
"Software"), to deal in the Software without restriction, including
|
112
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
113
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
114
|
+
permit persons to whom the Software is furnished to do so, subject to
|
115
|
+
the following conditions:
|
116
|
+
|
117
|
+
The above copyright notice and this permission notice shall be
|
118
|
+
included in all copies or substantial portions of the Software.
|
119
|
+
|
120
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
121
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
122
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
123
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
124
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
125
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
126
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
127
|
+
|
128
|
+
*/
|
129
|
+
'use strict';
|
130
|
+
|
131
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Deep-clone an object. Note that this does not work on object containing
|
135
|
+
* functions.
|
136
|
+
* @param {object} obj - the object to deep-clone
|
137
|
+
* @returns {object}
|
138
|
+
*/
|
139
|
+
function deepClone(obj) {
|
140
|
+
return JSON.parse(JSON.stringify(obj));
|
141
|
+
}
|
142
|
+
function parseToNumber(value) {
|
143
|
+
if (typeof value !== 'undefined' && !isNaN(Number(value))) {
|
144
|
+
return Number(value);
|
145
|
+
}
|
146
|
+
return null;
|
147
|
+
}
|
148
|
+
// timeString cannot be typed `string` because in member.ts
|
149
|
+
// call to parseTime(data.lastReadTimestamp) uses number not a string for timestamp.
|
150
|
+
function parseTime(timeString) {
|
151
|
+
try {
|
152
|
+
return new Date(timeString);
|
153
|
+
}
|
154
|
+
catch (e) {
|
155
|
+
return null;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
function parseAttributes(rawAttributes, warningMessage, log) {
|
159
|
+
let attributes = {};
|
160
|
+
if (rawAttributes) {
|
161
|
+
try {
|
162
|
+
attributes = JSON.parse(rawAttributes);
|
163
|
+
}
|
164
|
+
catch (e) {
|
165
|
+
log.warn(warningMessage, e);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
return attributes;
|
169
|
+
}
|
170
|
+
/**
|
171
|
+
* Construct URI with query parameters
|
172
|
+
*/
|
173
|
+
class UriBuilder {
|
174
|
+
constructor(base) {
|
175
|
+
this.base = base.replace(/\/$/, '');
|
176
|
+
this.args = [];
|
177
|
+
this.paths = [];
|
178
|
+
}
|
179
|
+
arg(name, value) {
|
180
|
+
if (typeof value !== 'undefined') {
|
181
|
+
this.args.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));
|
182
|
+
}
|
183
|
+
return this;
|
184
|
+
}
|
185
|
+
path(name) {
|
186
|
+
this.paths.push(encodeURIComponent(name));
|
187
|
+
return this;
|
188
|
+
}
|
189
|
+
build() {
|
190
|
+
let result = this.base;
|
191
|
+
if (this.paths.length) {
|
192
|
+
result += '/' + this.paths.join('/');
|
193
|
+
}
|
194
|
+
if (this.args.length) {
|
195
|
+
result += '?' + this.args.join('&');
|
196
|
+
}
|
197
|
+
return result;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
exports.UriBuilder = UriBuilder;
|
202
|
+
exports.deepClone = deepClone;
|
203
|
+
exports.parseAttributes = parseAttributes;
|
204
|
+
exports.parseTime = parseTime;
|
205
|
+
exports.parseToNumber = parseToNumber;
|
206
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/util/index.ts"],"sourcesContent":["import { Logger } from '../logger';\n\n/**\n * Deep-clone an object. Note that this does not work on object containing\n * functions.\n * @param {object} obj - the object to deep-clone\n * @returns {object}\n */\nfunction deepClone<T>(obj: T): T {\n return JSON.parse(JSON.stringify(obj)) as T;\n}\n\nfunction parseToNumber(value) {\n if (typeof value !== 'undefined' && !isNaN(Number(value))) {\n return Number(value);\n }\n return null;\n}\n\n// timeString cannot be typed `string` because in member.ts\n// call to parseTime(data.lastReadTimestamp) uses number not a string for timestamp.\nfunction parseTime(timeString): Date {\n try {\n return new Date(timeString);\n } catch (e) {\n return null;\n }\n}\n\nfunction parseAttributes(rawAttributes, warningMessage: string, log: Logger): Object {\n let attributes = {};\n if (rawAttributes) {\n try {\n attributes = JSON.parse(rawAttributes);\n } catch (e) {\n log.warn(warningMessage, e);\n }\n }\n\n return attributes;\n}\n\n/**\n * Construct URI with query parameters\n */\nclass UriBuilder {\n private base: string;\n private args: string[];\n private paths: string[];\n\n constructor(base: string) {\n this.base = base.replace(/\\/$/, '');\n this.args = [];\n this.paths = [];\n }\n\n public arg(name: string, value: any): UriBuilder {\n if (typeof value !== 'undefined') {\n this.args.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));\n }\n return this;\n }\n\n public path(name: string): UriBuilder {\n this.paths.push(encodeURIComponent(name));\n return this;\n }\n\n public build(): string {\n let result = this.base;\n if (this.paths.length) {\n result += '/' + this.paths.join('/');\n }\n\n if (this.args.length) {\n result += '?' + this.args.join('&');\n }\n return result;\n }\n}\n\nexport { deepClone, UriBuilder, parseToNumber, parseTime, parseAttributes };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;AAMA,SAAS,SAAS,CAAI,GAAM;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAM,CAAC;AAC9C,CAAC;AAED,SAAS,aAAa,CAAC,KAAK;IAC1B,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;QACzD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACtB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;AACA;AACA,SAAS,SAAS,CAAC,UAAU;IAC3B,IAAI;QACF,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED,SAAS,eAAe,CAAC,aAAa,EAAE,cAAsB,EAAE,GAAW;IACzE,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,aAAa,EAAE;QACjB,IAAI;YACF,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;SAC7B;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;AAGA,MAAM,UAAU;IAKd,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;KACjB;IAEM,GAAG,CAAC,IAAY,EAAE,KAAU;QACjC,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;SAC5E;QACD,OAAO,IAAI,CAAC;KACb;IAEM,IAAI,CAAC,IAAY;QACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;KACb;IAEM,KAAK;QACV,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACrB,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtC;QAED,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACpB,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrC;QACD,OAAO,MAAM,CAAC;KACf;;;;;;;;;"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -2818,27 +2818,34 @@ img {
|
|
2818
2818
|
<a href="#instantiating-and-using" id="instantiating-and-using" style="color: inherit; text-decoration: none;">
|
2819
2819
|
<h2>Instantiating and using</h2>
|
2820
2820
|
</a>
|
2821
|
-
<p>To use the library you need <a href="https://www.twilio.com/docs/conversations/create-tokens">to generate a token</a> and pass it to the
|
2821
|
+
<p>To use the library you need <a href="https://www.twilio.com/docs/conversations/create-tokens">to generate a token</a> and pass it to the Conversations Client constructor.</p>
|
2822
2822
|
<a href="#npm" id="npm" style="color: inherit; text-decoration: none;">
|
2823
2823
|
<h3>NPM</h3>
|
2824
2824
|
</a>
|
2825
2825
|
<pre><code><span style="color: #001080">npm</span><span style="color: #000000"> </span><span style="color: #001080">install</span><span style="color: #000000"> --</span><span style="color: #001080">save</span><span style="color: #000000"> @</span><span style="color: #001080">twilio</span><span style="color: #000000">/</span><span style="color: #001080">conversations</span>
|
2826
2826
|
</code></pre>
|
2827
|
-
<p>Using this method, you can <code>require</code> <code>twilio-conversations</code> and then use the
|
2828
|
-
|
2829
|
-
<span style="color: #
|
2830
|
-
<span style="color: #
|
2831
|
-
<span style="color: #
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
<span style="color: #
|
2836
|
-
<span style="color: #
|
2827
|
+
<p>Using this method, you can <code>require</code> <code>twilio-conversations</code> and then use the
|
2828
|
+
client:</p>
|
2829
|
+
<pre><code><span style="color: #0000FF">const</span><span style="color: #000000"> { </span><span style="color: #0070C1">Client</span><span style="color: #000000"> } = </span><span style="color: #795E26">require</span><span style="color: #000000">(</span><span style="color: #A31515">'@twilio/conversations'</span><span style="color: #000000">);</span>
|
2830
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">Client</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2831
|
+
<span style="color: #008000">// Before you use the client, subscribe to the `'stateChanged'` event and wait </span>
|
2832
|
+
<span style="color: #008000">// for the `'initialized'` state to be reported.</span>
|
2833
|
+
<span style="color: #001080">client</span><span style="color: #000000">.</span><span style="color: #795E26">on</span><span style="color: #000000">(</span><span style="color: #A31515">'stateChanged'</span><span style="color: #000000">, (</span><span style="color: #001080">state</span><span style="color: #000000">) </span><span style="color: #0000FF">=></span><span style="color: #000000"> {</span>
|
2834
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (</span><span style="color: #001080">state</span><span style="color: #000000"> === </span><span style="color: #A31515">'initialized'</span><span style="color: #000000">) {</span>
|
2835
|
+
<span style="color: #000000"> </span><span style="color: #008000">// Use the client</span>
|
2836
|
+
<span style="color: #000000"> }</span>
|
2837
|
+
<span style="color: #000000">}</span>
|
2837
2838
|
</code></pre>
|
2838
2839
|
<p>The SDK could also be imported using the ES module syntax:</p>
|
2839
|
-
<pre><code><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">
|
2840
|
-
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #
|
2841
|
-
<span style="color: #008000">//
|
2840
|
+
<pre><code><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">Client</span><span style="color: #000000"> } </span><span style="color: #AF00DB">from</span><span style="color: #000000"> </span><span style="color: #A31515">'@twilio/conversations'</span><span style="color: #000000">;</span>
|
2841
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">Client</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2842
|
+
<span style="color: #008000">// Before you use the client, subscribe to the `'stateChanged'` event and wait </span>
|
2843
|
+
<span style="color: #008000">// for the `'initialized'` state to be reported.</span>
|
2844
|
+
<span style="color: #001080">client</span><span style="color: #000000">.</span><span style="color: #795E26">on</span><span style="color: #000000">(</span><span style="color: #A31515">'stateChanged'</span><span style="color: #000000">, (</span><span style="color: #001080">state</span><span style="color: #000000">) </span><span style="color: #0000FF">=></span><span style="color: #000000"> {</span>
|
2845
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (</span><span style="color: #001080">state</span><span style="color: #000000"> === </span><span style="color: #A31515">'initialized'</span><span style="color: #000000">) {</span>
|
2846
|
+
<span style="color: #000000"> </span><span style="color: #008000">// Use the client</span>
|
2847
|
+
<span style="color: #000000"> }</span>
|
2848
|
+
<span style="color: #000000">}</span>
|
2842
2849
|
</code></pre>
|
2843
2850
|
<a href="#cdn" id="cdn" style="color: inherit; text-decoration: none;">
|
2844
2851
|
<h3>CDN</h3>
|
@@ -2847,14 +2854,8 @@ img {
|
|
2847
2854
|
directly in your web app using a <code><script></code> tag.</p>
|
2848
2855
|
<pre><code class="language-html"><span style="color: #800000"><script</span><span style="color: #000000FF"> </span><span style="color: #FF0000">src</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"https://media.twiliocdn.com/sdk/js/conversations/v2.0/twilio-conversations.min.js"</span><span style="color: #800000">></script></span>
|
2849
2856
|
</code></pre>
|
2850
|
-
<p>Using this method, <code>twilio-conversations.js</code> will set a browser global <code>Twilio.Conversations</code> through which you can use the client
|
2851
|
-
<pre><code><span style="color: #
|
2852
|
-
<span style="color: #000000"> </span><span style="color: #008000">// Use client</span>
|
2853
|
-
<span style="color: #000000">});</span>
|
2854
|
-
</code></pre>
|
2855
|
-
<p>or, if you prefer <code>async</code>/<code>await</code> syntax:</p>
|
2856
|
-
<pre><code><span style="color: #0000FF">let</span><span style="color: #000000"> </span><span style="color: #001080">client</span><span style="color: #000000"> = </span><span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">Twilio</span><span style="color: #000000">.</span><span style="color: #001080">Conversations</span><span style="color: #000000">.</span><span style="color: #001080">Client</span><span style="color: #000000">.</span><span style="color: #795E26">create</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2857
|
-
<span style="color: #008000">// Use client</span>
|
2857
|
+
<p>Using this method, <code>twilio-conversations.js</code> will set a browser global <code>Twilio.Conversations</code> through which you can use the client:</p>
|
2858
|
+
<pre><code><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #001080">Twilio</span><span style="color: #000000">.</span><span style="color: #001080">Conversations</span><span style="color: #000000">.</span><span style="color: #795E26">Client</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2858
2859
|
</code></pre>
|
2859
2860
|
<a href="#security" id="security" style="color: inherit; text-decoration: none;">
|
2860
2861
|
<h3>Security</h3>
|
@@ -2864,7 +2865,7 @@ img {
|
|
2864
2865
|
<p>If you require more security you will have to consume SDK by using <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity">SRI</a> and using an exact version
|
2865
2866
|
number. While less flexible it is significantly more secure, which is required by some applications.</p>
|
2866
2867
|
<p>To consume securely use the following script snippet format:</p>
|
2867
|
-
<pre><code class="language-html"><span style="color: #800000"><script</span><span style="color: #000000FF"> </span><span style="color: #FF0000">src</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"https://media.twiliocdn.com/sdk/js/conversations/releases/2.0.
|
2868
|
+
<pre><code class="language-html"><span style="color: #800000"><script</span><span style="color: #000000FF"> </span><span style="color: #FF0000">src</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"https://media.twiliocdn.com/sdk/js/conversations/releases/2.0.1/twilio-conversations.min.js"</span>
|
2868
2869
|
<span style="color: #000000FF"> </span><span style="color: #FF0000">integrity</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"sha256-<HASH FROM THE CHANGELOGS PAGE>"</span>
|
2869
2870
|
<span style="color: #000000FF"> </span><span style="color: #FF0000">crossorigin</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"anonymous"</span><span style="color: #800000">></script></span>
|
2870
2871
|
</code></pre>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -2826,7 +2826,8 @@ img {
|
|
2826
2826
|
<div class="tsd-comment tsd-typography">
|
2827
2827
|
<div class="lead">
|
2828
2828
|
<p>Configuration for attaching a media file to a message.
|
2829
|
-
|
2829
|
+
These options can be passed to <a href="../classes/Conversation.html#sendMessage">Conversation.sendMessage</a> and
|
2830
|
+
<a href="../classes/MessageBuilder.html#addMedia">MessageBuilder.addMedia</a>.</p>
|
2830
2831
|
</div>
|
2831
2832
|
</div>
|
2832
2833
|
</section>
|
@@ -2820,27 +2820,34 @@ img {
|
|
2820
2820
|
<a href="#instantiating-and-using" id="instantiating-and-using" style="color: inherit; text-decoration: none;">
|
2821
2821
|
<h2>Instantiating and using</h2>
|
2822
2822
|
</a>
|
2823
|
-
<p>To use the library you need <a href="https://www.twilio.com/docs/conversations/create-tokens">to generate a token</a> and pass it to the
|
2823
|
+
<p>To use the library you need <a href="https://www.twilio.com/docs/conversations/create-tokens">to generate a token</a> and pass it to the Conversations Client constructor.</p>
|
2824
2824
|
<a href="#npm" id="npm" style="color: inherit; text-decoration: none;">
|
2825
2825
|
<h3>NPM</h3>
|
2826
2826
|
</a>
|
2827
2827
|
<pre><code><span style="color: #001080">npm</span><span style="color: #000000"> </span><span style="color: #001080">install</span><span style="color: #000000"> --</span><span style="color: #001080">save</span><span style="color: #000000"> @</span><span style="color: #001080">twilio</span><span style="color: #000000">/</span><span style="color: #001080">conversations</span>
|
2828
2828
|
</code></pre>
|
2829
|
-
<p>Using this method, you can <code>require</code> <code>twilio-conversations</code> and then use the
|
2830
|
-
|
2831
|
-
<
|
2832
|
-
<span style="color: #
|
2833
|
-
<span style="color: #
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
<span style="color: #
|
2838
|
-
<span style="color: #
|
2829
|
+
<p>Using this method, you can <code>require</code> <code>twilio-conversations</code> and then use the
|
2830
|
+
client:</p>
|
2831
|
+
<pre><code><span style="color: #0000FF">const</span><span style="color: #000000"> { </span><span style="color: #0070C1">Client</span><span style="color: #000000"> } = </span><span style="color: #795E26">require</span><span style="color: #000000">(</span><span style="color: #A31515">'@twilio/conversations'</span><span style="color: #000000">);</span>
|
2832
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">Client</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2833
|
+
<span style="color: #008000">// Before you use the client, subscribe to the `'stateChanged'` event and wait </span>
|
2834
|
+
<span style="color: #008000">// for the `'initialized'` state to be reported.</span>
|
2835
|
+
<span style="color: #001080">client</span><span style="color: #000000">.</span><span style="color: #795E26">on</span><span style="color: #000000">(</span><span style="color: #A31515">'stateChanged'</span><span style="color: #000000">, (</span><span style="color: #001080">state</span><span style="color: #000000">) </span><span style="color: #0000FF">=></span><span style="color: #000000"> {</span>
|
2836
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (</span><span style="color: #001080">state</span><span style="color: #000000"> === </span><span style="color: #A31515">'initialized'</span><span style="color: #000000">) {</span>
|
2837
|
+
<span style="color: #000000"> </span><span style="color: #008000">// Use the client</span>
|
2838
|
+
<span style="color: #000000"> }</span>
|
2839
|
+
<span style="color: #000000">}</span>
|
2839
2840
|
</code></pre>
|
2840
2841
|
<p>The SDK could also be imported using the ES module syntax:</p>
|
2841
|
-
<pre><code><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">
|
2842
|
-
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #
|
2843
|
-
<span style="color: #008000">//
|
2842
|
+
<pre><code><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">Client</span><span style="color: #000000"> } </span><span style="color: #AF00DB">from</span><span style="color: #000000"> </span><span style="color: #A31515">'@twilio/conversations'</span><span style="color: #000000">;</span>
|
2843
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">Client</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2844
|
+
<span style="color: #008000">// Before you use the client, subscribe to the `'stateChanged'` event and wait </span>
|
2845
|
+
<span style="color: #008000">// for the `'initialized'` state to be reported.</span>
|
2846
|
+
<span style="color: #001080">client</span><span style="color: #000000">.</span><span style="color: #795E26">on</span><span style="color: #000000">(</span><span style="color: #A31515">'stateChanged'</span><span style="color: #000000">, (</span><span style="color: #001080">state</span><span style="color: #000000">) </span><span style="color: #0000FF">=></span><span style="color: #000000"> {</span>
|
2847
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (</span><span style="color: #001080">state</span><span style="color: #000000"> === </span><span style="color: #A31515">'initialized'</span><span style="color: #000000">) {</span>
|
2848
|
+
<span style="color: #000000"> </span><span style="color: #008000">// Use the client</span>
|
2849
|
+
<span style="color: #000000"> }</span>
|
2850
|
+
<span style="color: #000000">}</span>
|
2844
2851
|
</code></pre>
|
2845
2852
|
<a href="#cdn" id="cdn" style="color: inherit; text-decoration: none;">
|
2846
2853
|
<h3>CDN</h3>
|
@@ -2849,14 +2856,8 @@ img {
|
|
2849
2856
|
directly in your web app using a <code><script></code> tag.</p>
|
2850
2857
|
<pre><code class="language-html"><span style="color: #800000"><script</span><span style="color: #000000FF"> </span><span style="color: #FF0000">src</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"https://media.twiliocdn.com/sdk/js/conversations/v2.0/twilio-conversations.min.js"</span><span style="color: #800000">></script></span>
|
2851
2858
|
</code></pre>
|
2852
|
-
<p>Using this method, <code>twilio-conversations.js</code> will set a browser global <code>Twilio.Conversations</code> through which you can use the client
|
2853
|
-
<pre><code><span style="color: #
|
2854
|
-
<span style="color: #000000"> </span><span style="color: #008000">// Use client</span>
|
2855
|
-
<span style="color: #000000">});</span>
|
2856
|
-
</code></pre>
|
2857
|
-
<p>or, if you prefer <code>async</code>/<code>await</code> syntax:</p>
|
2858
|
-
<pre><code><span style="color: #0000FF">let</span><span style="color: #000000"> </span><span style="color: #001080">client</span><span style="color: #000000"> = </span><span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">Twilio</span><span style="color: #000000">.</span><span style="color: #001080">Conversations</span><span style="color: #000000">.</span><span style="color: #001080">Client</span><span style="color: #000000">.</span><span style="color: #795E26">create</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2859
|
-
<span style="color: #008000">// Use client</span>
|
2859
|
+
<p>Using this method, <code>twilio-conversations.js</code> will set a browser global <code>Twilio.Conversations</code> through which you can use the client:</p>
|
2860
|
+
<pre><code><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">client</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #001080">Twilio</span><span style="color: #000000">.</span><span style="color: #001080">Conversations</span><span style="color: #000000">.</span><span style="color: #795E26">Client</span><span style="color: #000000">(</span><span style="color: #001080">token</span><span style="color: #000000">);</span>
|
2860
2861
|
</code></pre>
|
2861
2862
|
<a href="#security" id="security" style="color: inherit; text-decoration: none;">
|
2862
2863
|
<h3>Security</h3>
|
@@ -2866,7 +2867,7 @@ img {
|
|
2866
2867
|
<p>If you require more security you will have to consume SDK by using <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity">SRI</a> and using an exact version
|
2867
2868
|
number. While less flexible it is significantly more secure, which is required by some applications.</p>
|
2868
2869
|
<p>To consume securely use the following script snippet format:</p>
|
2869
|
-
<pre><code class="language-html"><span style="color: #800000"><script</span><span style="color: #000000FF"> </span><span style="color: #FF0000">src</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"https://media.twiliocdn.com/sdk/js/conversations/releases/2.0.
|
2870
|
+
<pre><code class="language-html"><span style="color: #800000"><script</span><span style="color: #000000FF"> </span><span style="color: #FF0000">src</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"https://media.twiliocdn.com/sdk/js/conversations/releases/2.0.1/twilio-conversations.min.js"</span>
|
2870
2871
|
<span style="color: #000000FF"> </span><span style="color: #FF0000">integrity</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"sha256-<HASH FROM THE CHANGELOGS PAGE>"</span>
|
2871
2872
|
<span style="color: #000000FF"> </span><span style="color: #FF0000">crossorigin</span><span style="color: #000000FF">=</span><span style="color: #0000FF">"anonymous"</span><span style="color: #800000">></script></span>
|
2872
2873
|
</code></pre>
|