@twilio/conversations 2.0.0-rc.3 → 2.0.1-rc.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/CHANGELOG.md +42 -0
- package/README.md +24 -27
- package/dist/browser.js +19 -20
- package/dist/browser.js.map +1 -1
- package/dist/docs/index.html +24 -23
- package/dist/docs/interfaces/PushNotificationData.html +1 -1
- package/dist/docs/interfaces/SendMediaOptions.html +2 -1
- package/dist/docs/modules.html +24 -23
- package/dist/lib.d.ts +19 -3
- package/dist/lib.js +19 -20
- package/dist/lib.js.map +1 -1
- package/dist/react-native.js +21 -17
- package/dist/react-native.js.map +1 -1
- package/dist/twilio-conversations.js +1945 -1097
- package/dist/twilio-conversations.min.js +3 -3
- package/package.json +10 -9
package/dist/react-native.js
CHANGED
@@ -132,9 +132,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
132
132
|
|
133
133
|
var loglevelLog = require('loglevel');
|
134
134
|
var iso8601Duration = require('iso8601-duration');
|
135
|
-
var JsonDiff = require('rfc6902');
|
136
135
|
var declarativeTypeValidator = require('@twilio/declarative-type-validator');
|
137
136
|
var replayEventEmitter = require('@twilio/replay-event-emitter');
|
137
|
+
var isEqual = require('lodash.isequal');
|
138
138
|
var operationRetrier = require('@twilio/operation-retrier');
|
139
139
|
var twilsock = require('twilsock');
|
140
140
|
var notifications = require('@twilio/notifications');
|
@@ -142,6 +142,8 @@ var twilioSync = require('twilio-sync');
|
|
142
142
|
var mcsClient = require('@twilio/mcs-client');
|
143
143
|
var uuid = require('uuid');
|
144
144
|
|
145
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
146
|
+
|
145
147
|
function _interopNamespace(e) {
|
146
148
|
if (e && e.__esModule) return e;
|
147
149
|
var n = Object.create(null);
|
@@ -163,7 +165,7 @@ function _interopNamespace(e) {
|
|
163
165
|
}
|
164
166
|
|
165
167
|
var loglevelLog__namespace = /*#__PURE__*/_interopNamespace(loglevelLog);
|
166
|
-
var
|
168
|
+
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
167
169
|
|
168
170
|
/*! *****************************************************************************
|
169
171
|
Copyright (c) Microsoft Corporation.
|
@@ -283,12 +285,6 @@ class Configuration {
|
|
283
285
|
}
|
284
286
|
}
|
285
287
|
|
286
|
-
/**
|
287
|
-
* Checks if objects are equal
|
288
|
-
*/
|
289
|
-
function isDeepEqual(o1, o2) {
|
290
|
-
return JsonDiff__namespace.createPatch(o1, o2).length === 0;
|
291
|
-
}
|
292
288
|
/**
|
293
289
|
* Deep-clone an object. Note that this does not work on object containing
|
294
290
|
* functions.
|
@@ -455,7 +451,7 @@ class User extends replayEventEmitter.ReplayEventEmitter {
|
|
455
451
|
break;
|
456
452
|
case 'attributes':
|
457
453
|
const updateAttributes = parseAttributes(value.value, `Retrieved malformed attributes from the server for user: ${this.state.identity}`, log$8);
|
458
|
-
if (!
|
454
|
+
if (!isEqual__default['default'](this.state.attributes, updateAttributes)) {
|
459
455
|
this.state.attributes = updateAttributes;
|
460
456
|
updateReasons.push('attributes');
|
461
457
|
}
|
@@ -786,7 +782,7 @@ class Participant extends replayEventEmitter.ReplayEventEmitter {
|
|
786
782
|
_update(data) {
|
787
783
|
let updateReasons = [];
|
788
784
|
let updateAttributes = parseAttributes(data.attributes, 'Retrieved malformed attributes from the server for participant: ' + this.state.sid, log$7);
|
789
|
-
if (data.attributes && !
|
785
|
+
if (data.attributes && !isEqual__default['default'](this.state.attributes, updateAttributes)) {
|
790
786
|
this.state.attributes = updateAttributes;
|
791
787
|
updateReasons.push('attributes');
|
792
788
|
}
|
@@ -1429,7 +1425,7 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
1429
1425
|
updateReasons.push('dateCreated');
|
1430
1426
|
}
|
1431
1427
|
let updatedAttributes = parseAttributes(data.attributes, `Got malformed attributes for the message ${this.sid}`, log$5);
|
1432
|
-
if (!
|
1428
|
+
if (!isEqual__default['default'](this.state.attributes, updatedAttributes)) {
|
1433
1429
|
this.state.attributes = updatedAttributes;
|
1434
1430
|
updateReasons.push('attributes');
|
1435
1431
|
}
|
@@ -2175,7 +2171,7 @@ class Conversation extends replayEventEmitter.ReplayEventEmitter {
|
|
2175
2171
|
updateReasons.add(localKey);
|
2176
2172
|
break;
|
2177
2173
|
case fieldMappings.attributes:
|
2178
|
-
if (
|
2174
|
+
if (isEqual__default['default'](this.channelState.attributes, update.attributes)) {
|
2179
2175
|
break;
|
2180
2176
|
}
|
2181
2177
|
this.channelState.attributes = update.attributes;
|
@@ -2206,7 +2202,7 @@ class Conversation extends replayEventEmitter.ReplayEventEmitter {
|
|
2206
2202
|
this.channelState.lastMessage.dateCreated = update.lastMessage.timestamp;
|
2207
2203
|
updateReasons.add(localKey);
|
2208
2204
|
}
|
2209
|
-
if (
|
2205
|
+
if (isEqual__default['default'](this.channelState.lastMessage, {})) {
|
2210
2206
|
delete this.channelState.lastMessage;
|
2211
2207
|
}
|
2212
2208
|
break;
|
@@ -2215,7 +2211,7 @@ class Conversation extends replayEventEmitter.ReplayEventEmitter {
|
|
2215
2211
|
if (state !== undefined) {
|
2216
2212
|
state.dateUpdated = new Date(state.dateUpdated);
|
2217
2213
|
}
|
2218
|
-
if (
|
2214
|
+
if (isEqual__default['default'](this.channelState.state, state)) {
|
2219
2215
|
break;
|
2220
2216
|
}
|
2221
2217
|
this.channelState.state = state;
|
@@ -2269,7 +2265,7 @@ class Conversation extends replayEventEmitter.ReplayEventEmitter {
|
|
2269
2265
|
* @param attributes Attributes to be attached to the participant.
|
2270
2266
|
*/
|
2271
2267
|
async addNonChatParticipant(proxyAddress, address, attributes) {
|
2272
|
-
return this.participantsEntity.addNonChatParticipant(proxyAddress, address, attributes
|
2268
|
+
return this.participantsEntity.addNonChatParticipant(proxyAddress, address, attributes);
|
2273
2269
|
}
|
2274
2270
|
/**
|
2275
2271
|
* Advance the conversation's last read message index to the current read horizon.
|
@@ -2928,7 +2924,7 @@ class Conversations extends replayEventEmitter.ReplayEventEmitter {
|
|
2928
2924
|
if (typeof data.lastConsumedMessageIndex !== 'undefined') {
|
2929
2925
|
updateData.lastConsumedMessageIndex = data.lastConsumedMessageIndex;
|
2930
2926
|
}
|
2931
|
-
if (!
|
2927
|
+
if (!isEqual__default['default'](updateData, {})) {
|
2932
2928
|
conversation._update(updateData);
|
2933
2929
|
}
|
2934
2930
|
conversation._subscribe().then(() => {
|
@@ -3236,7 +3232,7 @@ class PushNotification {
|
|
3236
3232
|
}
|
3237
3233
|
}
|
3238
3234
|
|
3239
|
-
var version = "2.0.
|
3235
|
+
var version = "2.0.1-rc.2";
|
3240
3236
|
|
3241
3237
|
const trimSlashes = (url) => url.replace(/(^\/+|\/+$)/g, '');
|
3242
3238
|
const isMutationConflictResponse = (response) => response.status.code === 202;
|
@@ -3446,6 +3442,13 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
3446
3442
|
* The factory method will automatically trigger connection.
|
3447
3443
|
* Do not use it if you need finer-grained control.
|
3448
3444
|
*
|
3445
|
+
* Since this method returns an already-initialized client, some of the events
|
3446
|
+
* will be lost because they happen *before* the initialization. It is
|
3447
|
+
* recommended that `client.onWithReplay` is used as opposed to `client.on`
|
3448
|
+
* for subscribing to client events. The `client.onWithReplay` will re-emit
|
3449
|
+
* the most recent value for a given event if it emitted before the
|
3450
|
+
* subscription.
|
3451
|
+
*
|
3449
3452
|
* @param token Access token.
|
3450
3453
|
* @param options Options to customize the client.
|
3451
3454
|
* @returns Returns a fully initialized client.
|
@@ -4023,6 +4026,7 @@ exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
|
|
4023
4026
|
exports.Media = Media;
|
4024
4027
|
exports.Message = Message;
|
4025
4028
|
exports.MessageBuilder = MessageBuilder;
|
4029
|
+
exports.NotificationTypes = NotificationTypes;
|
4026
4030
|
exports.Participant = Participant;
|
4027
4031
|
exports.PushNotification = PushNotification;
|
4028
4032
|
exports.RestPaginator = RestPaginator;
|