@twilio/conversations 2.0.0 → 2.0.1-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +4 -12
  2. package/dist/browser.js +11 -20
  3. package/dist/browser.js.map +1 -1
  4. package/dist/docs/index.html +4 -10
  5. package/dist/docs/modules.html +4 -10
  6. package/dist/lib/aggregated-delivery-receipt.js +227 -0
  7. package/dist/lib/aggregated-delivery-receipt.js.map +1 -0
  8. package/dist/lib/client.js +872 -0
  9. package/dist/lib/client.js.map +1 -0
  10. package/dist/lib/command-executor.js +203 -0
  11. package/dist/lib/command-executor.js.map +1 -0
  12. package/dist/lib/configuration.js +196 -0
  13. package/dist/lib/configuration.js.map +1 -0
  14. package/dist/lib/conversation.js +973 -0
  15. package/dist/lib/conversation.js.map +1 -0
  16. package/dist/lib/data/conversations.js +443 -0
  17. package/dist/lib/data/conversations.js.map +1 -0
  18. package/dist/lib/data/messages.js +341 -0
  19. package/dist/lib/data/messages.js.map +1 -0
  20. package/dist/lib/data/participants.js +313 -0
  21. package/dist/lib/data/participants.js.map +1 -0
  22. package/dist/lib/data/users.js +228 -0
  23. package/dist/lib/data/users.js.map +1 -0
  24. package/dist/lib/detailed-delivery-receipt.js +154 -0
  25. package/dist/lib/detailed-delivery-receipt.js.map +1 -0
  26. package/dist/lib/index.js +167 -0
  27. package/dist/lib/index.js.map +1 -0
  28. package/dist/lib/interfaces/notification-types.js +143 -0
  29. package/dist/lib/interfaces/notification-types.js.map +1 -0
  30. package/dist/lib/logger.js +190 -0
  31. package/dist/lib/logger.js.map +1 -0
  32. package/dist/lib/media.js +213 -0
  33. package/dist/lib/media.js.map +1 -0
  34. package/dist/lib/message-builder.js +209 -0
  35. package/dist/lib/message-builder.js.map +1 -0
  36. package/dist/lib/message.js +450 -0
  37. package/dist/lib/message.js.map +1 -0
  38. package/dist/lib/node_modules/tslib/tslib.es6.js +161 -0
  39. package/dist/lib/node_modules/tslib/tslib.es6.js.map +1 -0
  40. package/dist/lib/packages/conversations/package.json.js +136 -0
  41. package/dist/lib/packages/conversations/package.json.js.map +1 -0
  42. package/dist/lib/participant.js +346 -0
  43. package/dist/lib/participant.js.map +1 -0
  44. package/dist/lib/push-notification.js +152 -0
  45. package/dist/lib/push-notification.js.map +1 -0
  46. package/dist/lib/rest-paginator.js +175 -0
  47. package/dist/lib/rest-paginator.js.map +1 -0
  48. package/dist/lib/services/network.js +205 -0
  49. package/dist/lib/services/network.js.map +1 -0
  50. package/dist/lib/services/typing-indicator.js +235 -0
  51. package/dist/lib/services/typing-indicator.js.map +1 -0
  52. package/dist/lib/unsent-message.js +159 -0
  53. package/dist/lib/unsent-message.js.map +1 -0
  54. package/dist/lib/user.js +392 -0
  55. package/dist/lib/user.js.map +1 -0
  56. package/dist/lib/util/deferred.js +154 -0
  57. package/dist/lib/util/deferred.js.map +1 -0
  58. package/dist/lib/util/index.js +206 -0
  59. package/dist/lib/util/index.js.map +1 -0
  60. package/dist/lib.js +11 -20
  61. package/dist/lib.js.map +1 -1
  62. package/dist/twilio-conversations.js +1937 -1097
  63. package/dist/twilio-conversations.min.js +3 -3
  64. package/package.json +15 -14
  65. package/CHANGELOG.md +0 -219
  66. package/dist/post-install.js +0 -29
  67. package/dist/react-native.js +0 -4039
  68. package/dist/react-native.js.map +0 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ Visit our official site for more detalis: [https://www.twilio.com/conversations]
7
7
 
8
8
  Instantiating and using
9
9
  ------------
10
- To use the library you need [to generate a token](https://www.twilio.com/docs/conversations/create-tokens) and pass it to the conversations Client `create` factory.
10
+ To use the library you need [to generate a token](https://www.twilio.com/docs/conversations/create-tokens) and pass it to the Conversations Client constructor.
11
11
 
12
12
  ### NPM
13
13
  ```
@@ -48,17 +48,9 @@ directly in your web app using a `<script>` tag.
48
48
  ```html
49
49
  <script src="https://media.twiliocdn.com/sdk/js/conversations/v2.0/twilio-conversations.min.js"></script>
50
50
  ```
51
- Using this method, `twilio-conversations.js` will set a browser global `Twilio.Conversations` through which you can use the client :
51
+ Using this method, `twilio-conversations.js` will set a browser global `Twilio.Conversations` through which you can use the client:
52
52
  ```
53
- Twilio.Conversations.Client.create(token).then(client => {
54
- // Use client
55
- });
56
- ```
57
-
58
- or, if you prefer `async`/`await` syntax:
59
- ```
60
- let client = await Twilio.Conversations.Client.create(token);
61
- // Use client
53
+ const client = new Twilio.Conversations.Client(token);
62
54
  ```
63
55
 
64
56
  ### Security
@@ -72,7 +64,7 @@ number. While less flexible it is significantly more secure, which is required b
72
64
  To consume securely use the following script snippet format:
73
65
 
74
66
  ```html
75
- <script src="https://media.twiliocdn.com/sdk/js/conversations/releases/2.0.0/twilio-conversations.min.js"
67
+ <script src="https://media.twiliocdn.com/sdk/js/conversations/releases/2.0.1/twilio-conversations.min.js"
76
68
  integrity="sha256-<HASH FROM THE CHANGELOGS PAGE>"
77
69
  crossorigin="anonymous"></script>
78
70
  ```
package/dist/browser.js CHANGED
@@ -161,9 +161,9 @@ require('core-js/modules/web.dom-collections.iterator.js');
161
161
  require('core-js/modules/es.regexp.exec.js');
162
162
  require('core-js/modules/es.string.replace.js');
163
163
  require('core-js/modules/es.array.join.js');
164
- var JsonDiff = require('rfc6902');
165
164
  var declarativeTypeValidator = require('@twilio/declarative-type-validator');
166
165
  var replayEventEmitter = require('@twilio/replay-event-emitter');
166
+ var isEqual = require('lodash.isequal');
167
167
  require('core-js/modules/es.array.slice.js');
168
168
  require('core-js/modules/es.function.name.js');
169
169
  require('core-js/modules/es.symbol.description.js');
@@ -244,7 +244,7 @@ var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallChec
244
244
  var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
245
245
  var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
246
246
  var loglevelLog__namespace = /*#__PURE__*/_interopNamespace(loglevelLog);
247
- var JsonDiff__namespace = /*#__PURE__*/_interopNamespace(JsonDiff);
247
+ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
248
248
  var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
249
249
  var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
250
250
 
@@ -459,21 +459,12 @@ var Configuration = function Configuration() {
459
459
  }
460
460
  };
461
461
 
462
- /**
463
- * Checks if objects are equal
464
- */
465
-
466
- function isDeepEqual(o1, o2) {
467
- return JsonDiff__namespace.createPatch(o1, o2).length === 0;
468
- }
469
462
  /**
470
463
  * Deep-clone an object. Note that this does not work on object containing
471
464
  * functions.
472
465
  * @param {object} obj - the object to deep-clone
473
466
  * @returns {object}
474
467
  */
475
-
476
-
477
468
  function deepClone(obj) {
478
469
  return JSON.parse(JSON.stringify(obj));
479
470
  }
@@ -719,7 +710,7 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
719
710
  case 9:
720
711
  updateAttributes = parseAttributes(value.value, "Retrieved malformed attributes from the server for user: ".concat(this.state.identity), log$8);
721
712
 
722
- if (!isDeepEqual(this.state.attributes, updateAttributes)) {
713
+ if (!isEqual__default['default'](this.state.attributes, updateAttributes)) {
723
714
  this.state.attributes = updateAttributes;
724
715
  updateReasons.push('attributes');
725
716
  }
@@ -1432,7 +1423,7 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1432
1423
  var updateReasons = [];
1433
1424
  var updateAttributes = parseAttributes(data.attributes, 'Retrieved malformed attributes from the server for participant: ' + this.state.sid, log$7);
1434
1425
 
1435
- if (data.attributes && !isDeepEqual(this.state.attributes, updateAttributes)) {
1426
+ if (data.attributes && !isEqual__default['default'](this.state.attributes, updateAttributes)) {
1436
1427
  this.state.attributes = updateAttributes;
1437
1428
  updateReasons.push('attributes');
1438
1429
  }
@@ -2647,7 +2638,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2647
2638
 
2648
2639
  var updatedAttributes = parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(this.sid), log$5);
2649
2640
 
2650
- if (!isDeepEqual(this.state.attributes, updatedAttributes)) {
2641
+ if (!isEqual__default['default'](this.state.attributes, updatedAttributes)) {
2651
2642
  this.state.attributes = updatedAttributes;
2652
2643
  updateReasons.push('attributes');
2653
2644
  }
@@ -4210,7 +4201,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4210
4201
  break;
4211
4202
 
4212
4203
  case fieldMappings.attributes:
4213
- if (isDeepEqual(this.channelState.attributes, update.attributes)) {
4204
+ if (isEqual__default['default'](this.channelState.attributes, update.attributes)) {
4214
4205
  break;
4215
4206
  }
4216
4207
 
@@ -4246,7 +4237,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4246
4237
  updateReasons.add(localKey);
4247
4238
  }
4248
4239
 
4249
- if (isDeepEqual(this.channelState.lastMessage, {})) {
4240
+ if (isEqual__default['default'](this.channelState.lastMessage, {})) {
4250
4241
  delete this.channelState.lastMessage;
4251
4242
  }
4252
4243
 
@@ -4259,7 +4250,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4259
4250
  state.dateUpdated = new Date(state.dateUpdated);
4260
4251
  }
4261
4252
 
4262
- if (isDeepEqual(this.channelState.state, state)) {
4253
+ if (isEqual__default['default'](this.channelState.state, state)) {
4263
4254
  break;
4264
4255
  }
4265
4256
 
@@ -5687,7 +5678,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
5687
5678
  conversationsMap = _context4.sent;
5688
5679
  _context4.next = 5;
5689
5680
  return conversationsMap.getItems({
5690
- from: sid
5681
+ key: sid
5691
5682
  });
5692
5683
 
5693
5684
  case 5:
@@ -5925,7 +5916,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
5925
5916
  updateData.lastConsumedMessageIndex = data.lastConsumedMessageIndex;
5926
5917
  }
5927
5918
 
5928
- if (!isDeepEqual(updateData, {})) {
5919
+ if (!isEqual__default['default'](updateData, {})) {
5929
5920
  conversation._update(updateData);
5930
5921
  }
5931
5922
 
@@ -6608,7 +6599,7 @@ function PushNotification(data) {
6608
6599
  this.data = data.data || {};
6609
6600
  };
6610
6601
 
6611
- var version = "2.0.0";
6602
+ var version = "2.0.1-rc.5";
6612
6603
 
6613
6604
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6614
6605