@twilio/conversations 3.0.1-rc.102 → 3.0.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 (122) hide show
  1. package/README.md +2 -2
  2. package/builds/browser.esm.js +10846 -0
  3. package/builds/browser.esm.js.map +1 -0
  4. package/builds/browser.js +891 -260
  5. package/builds/browser.js.map +1 -1
  6. package/builds/lib.d.ts +162 -52
  7. package/builds/lib.esm.d.ts +3178 -0
  8. package/builds/lib.esm.js +10845 -0
  9. package/builds/lib.js +900 -260
  10. package/builds/lib.js.map +1 -1
  11. package/builds/twilio-conversations.js +9407 -10424
  12. package/builds/twilio-conversations.js.map +1 -0
  13. package/builds/twilio-conversations.min.js +2 -1
  14. package/builds/twilio-conversations.min.js.map +1 -0
  15. package/dist/aggregated-delivery-receipt.js +1 -5
  16. package/dist/aggregated-delivery-receipt.js.map +1 -1
  17. package/dist/channel-metadata-client.js +5 -10
  18. package/dist/channel-metadata-client.js.map +1 -1
  19. package/dist/client.js +218 -204
  20. package/dist/client.js.map +1 -1
  21. package/dist/command-executor.js +6 -10
  22. package/dist/command-executor.js.map +1 -1
  23. package/dist/configuration.js +14 -14
  24. package/dist/configuration.js.map +1 -1
  25. package/dist/content-client.js +5 -9
  26. package/dist/content-client.js.map +1 -1
  27. package/dist/content-template.js +1 -7
  28. package/dist/content-template.js.map +1 -1
  29. package/dist/conversation.js +170 -134
  30. package/dist/conversation.js.map +1 -1
  31. package/dist/data/conversations.js +44 -46
  32. package/dist/data/conversations.js.map +1 -1
  33. package/dist/data/messages.js +18 -22
  34. package/dist/data/messages.js.map +1 -1
  35. package/dist/data/participants.js +22 -25
  36. package/dist/data/participants.js.map +1 -1
  37. package/dist/data/users.js +10 -14
  38. package/dist/data/users.js.map +1 -1
  39. package/dist/detailed-delivery-receipt.js +1 -5
  40. package/dist/detailed-delivery-receipt.js.map +1 -1
  41. package/dist/index.js +17 -46
  42. package/dist/index.js.map +1 -1
  43. package/dist/interfaces/notification-types.js +1 -5
  44. package/dist/interfaces/notification-types.js.map +1 -1
  45. package/dist/interfaces/rules.js +7 -13
  46. package/dist/interfaces/rules.js.map +1 -1
  47. package/dist/logger.js +9 -29
  48. package/dist/logger.js.map +1 -1
  49. package/dist/media.js +32 -25
  50. package/dist/media.js.map +1 -1
  51. package/dist/message-builder.js +43 -47
  52. package/dist/message-builder.js.map +1 -1
  53. package/dist/message-recipients-client.js +231 -0
  54. package/dist/message-recipients-client.js.map +1 -0
  55. package/dist/message.js +120 -98
  56. package/dist/message.js.map +1 -1
  57. package/dist/node_modules/quick-lru/index.js +1 -5
  58. package/dist/node_modules/quick-lru/index.js.map +1 -1
  59. package/dist/node_modules/tslib/tslib.es6.js +7 -6
  60. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  61. package/dist/packages/conversations/package.json.js +2 -6
  62. package/dist/packages/conversations/package.json.js.map +1 -1
  63. package/dist/participant.js +32 -37
  64. package/dist/participant.js.map +1 -1
  65. package/dist/push-notification.js +1 -5
  66. package/dist/push-notification.js.map +1 -1
  67. package/dist/rest-paginator.js +1 -5
  68. package/dist/rest-paginator.js.map +1 -1
  69. package/dist/services/network.js +3 -7
  70. package/dist/services/network.js.map +1 -1
  71. package/dist/services/typing-indicator.js +7 -10
  72. package/dist/services/typing-indicator.js.map +1 -1
  73. package/dist/unsent-message.js +5 -9
  74. package/dist/unsent-message.js.map +1 -1
  75. package/dist/user.js +21 -30
  76. package/dist/user.js.map +1 -1
  77. package/dist/util/deferred.js +1 -5
  78. package/dist/util/deferred.js.map +1 -1
  79. package/dist/util/index.js +36 -9
  80. package/dist/util/index.js.map +1 -1
  81. package/dist/utils/uuid.js +145 -0
  82. package/dist/utils/uuid.js.map +1 -0
  83. package/package.json +14 -17
  84. package/docs/assets/css/main.css +0 -2660
  85. package/docs/assets/images/icons.png +0 -0
  86. package/docs/assets/images/icons@2x.png +0 -0
  87. package/docs/assets/images/widgets.png +0 -0
  88. package/docs/assets/images/widgets@2x.png +0 -0
  89. package/docs/assets/js/main.js +0 -248
  90. package/docs/assets/js/search.js +0 -1
  91. package/docs/classes/AggregatedDeliveryReceipt.html +0 -3184
  92. package/docs/classes/CancellablePromise.html +0 -3213
  93. package/docs/classes/ChannelMetadata.html +0 -3050
  94. package/docs/classes/Client.html +0 -4278
  95. package/docs/classes/ContentTemplate.html +0 -3116
  96. package/docs/classes/ContentTemplateVariable.html +0 -3116
  97. package/docs/classes/Conversation.html +0 -4359
  98. package/docs/classes/DetailedDeliveryReceipt.html +0 -3163
  99. package/docs/classes/Media.html +0 -3167
  100. package/docs/classes/Message.html +0 -3803
  101. package/docs/classes/MessageBuilder.html +0 -3318
  102. package/docs/classes/Participant.html +0 -3444
  103. package/docs/classes/PushNotification.html +0 -3130
  104. package/docs/classes/RestPaginator.html +0 -3160
  105. package/docs/classes/UnsentMessage.html +0 -3042
  106. package/docs/classes/User.html +0 -3349
  107. package/docs/index.html +0 -4333
  108. package/docs/interfaces/ClientOptions.html +0 -3050
  109. package/docs/interfaces/ConversationBindings.html +0 -3001
  110. package/docs/interfaces/ConversationEmailBinding.html +0 -3001
  111. package/docs/interfaces/ConversationLimits.html +0 -3098
  112. package/docs/interfaces/ConversationState.html +0 -3050
  113. package/docs/interfaces/ConversationUpdatedEventArgs.html +0 -3001
  114. package/docs/interfaces/CreateConversationOptions.html +0 -3066
  115. package/docs/interfaces/LastMessage.html +0 -3050
  116. package/docs/interfaces/Paginator.html +0 -3141
  117. package/docs/interfaces/ParticipantBindings.html +0 -3001
  118. package/docs/interfaces/ParticipantEmailBinding.html +0 -3001
  119. package/docs/interfaces/PushNotificationData.html +0 -3114
  120. package/docs/interfaces/SendEmailOptions.html +0 -3034
  121. package/docs/interfaces/SendMediaOptions.html +0 -3068
  122. package/docs/modules.html +0 -4334
package/dist/client.js CHANGED
@@ -126,8 +126,6 @@ This software includes platform.js under the following license.
126
126
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
127
127
 
128
128
  */
129
- 'use strict';
130
-
131
129
  var global =
132
130
  typeof global !== "undefined"
133
131
  ? global
@@ -137,31 +135,30 @@ var global =
137
135
  ? window
138
136
  : {};
139
137
 
140
- Object.defineProperty(exports, '__esModule', { value: true });
141
-
142
- var tslib_es6 = require('./node_modules/tslib/tslib.es6.js');
143
- var logger = require('./logger.js');
144
- var configuration = require('./configuration.js');
145
- var user = require('./user.js');
146
- var network = require('./services/network.js');
147
- var notificationTypes = require('./interfaces/notification-types.js');
148
- var twilsock = require('twilsock');
149
- var notifications = require('@twilio/notifications');
150
- var twilioSync = require('twilio-sync');
151
- var mcsClient = require('@twilio/mcs-client');
152
- var conversations = require('./data/conversations.js');
153
- var users = require('./data/users.js');
154
- var typingIndicator = require('./services/typing-indicator.js');
155
- var pushNotification = require('./push-notification.js');
156
- var index = require('./util/index.js');
157
- var declarativeTypeValidator = require('@twilio/declarative-type-validator');
158
- var _package = require('./packages/conversations/package.json.js');
159
- var commandExecutor = require('./command-executor.js');
160
- var replayEventEmitter = require('@twilio/replay-event-emitter');
161
- var media = require('./media.js');
162
- var deprecationDecorator = require('@twilio/deprecation-decorator');
163
- var contentClient = require('./content-client.js');
164
- var channelMetadataClient = require('./channel-metadata-client.js');
138
+ import { __decorate, __metadata } from './node_modules/tslib/tslib.es6.js';
139
+ import { Logger } from './logger.js';
140
+ import { Configuration } from './configuration.js';
141
+ import { User } from './user.js';
142
+ import { Network } from './services/network.js';
143
+ import { NotificationTypes } from './interfaces/notification-types.js';
144
+ import { InitRegistration, TwilsockClient, TelemetryEventDescription, TelemetryPoint } from 'twilsock';
145
+ import { Notifications } from '@twilio/notifications';
146
+ import { SyncClient } from 'twilio-sync';
147
+ import { CancellablePromise, McsClient } from '@twilio/mcs-client';
148
+ import { Conversations } from './data/conversations.js';
149
+ import { Users } from './data/users.js';
150
+ import { TypingIndicator } from './services/typing-indicator.js';
151
+ import { PushNotification } from './push-notification.js';
152
+ import { deepClone, parseToNumber } from './util/index.js';
153
+ import { validateTypesAsync, nonEmptyString, objectSchema, literal, pureObject, nonEmptyArray, validateTypes, validateConstructorTypes } from '@twilio/declarative-type-validator';
154
+ import { version } from './packages/conversations/package.json.js';
155
+ import { CommandExecutor } from './command-executor.js';
156
+ import { ReplayEventEmitter } from '@twilio/replay-event-emitter';
157
+ import { Media } from './media.js';
158
+ import { deprecated, deprecationWarning } from '@twilio/deprecation-decorator';
159
+ import { ContentClient } from './content-client.js';
160
+ import { ChannelMetadataClient } from './channel-metadata-client.js';
161
+ import { MessageRecipientsClient } from './message-recipients-client.js';
165
162
 
166
163
  var Client_1;
167
164
  /**
@@ -172,9 +169,9 @@ class ClientServices {
172
169
  /**
173
170
  * A client is the starting point to the Twilio Conversations functionality.
174
171
  */
175
- exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventEmitter {
172
+ let Client = Client_1 = class Client extends ReplayEventEmitter {
176
173
  /**
177
- * Returned Conversations instance is not yet fully initialized. Calling any
174
+ * Returned Conversations Client instance is not yet fully initialized. Calling any
178
175
  * operations will block until it is. Use connection events to monitor when
179
176
  * client becomes fully available (connectionStateChanged with state
180
177
  * 'connected') or not available (connectionStateChange with state 'denied',
@@ -190,20 +187,20 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
190
187
  /**
191
188
  * Current version of the Conversations client.
192
189
  */
193
- this.version = _package.version;
190
+ this.version = version;
194
191
  /**
195
192
  * Client connection state.
196
193
  */
197
194
  this.connectionState = "unknown";
198
195
  /**
199
- * Current version of the Conversations client.
196
+ * Parse a push notification payload.
200
197
  */
201
198
  this.parsePushNotification = Client_1.parsePushNotification;
202
199
  this._fpaToken = fpaToken !== null && fpaToken !== void 0 ? fpaToken : "";
203
200
  this._options = options !== null && options !== void 0 ? options : {};
204
201
  if (!this._options.disableDeepClone) {
205
202
  let options = Object.assign(Object.assign({}, this._options), { transport: undefined, twilsockClient: undefined });
206
- options = index.deepClone(options);
203
+ options = deepClone(options);
207
204
  options.transport = this._options.transport;
208
205
  options.twilsockClient = this._options.twilsockClient;
209
206
  this._options = options;
@@ -218,7 +215,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
218
215
  }
219
216
  if (!this._options.clientMetadata.hasOwnProperty("sdk")) {
220
217
  this._options.clientMetadata.sdk = "JS";
221
- this._options.clientMetadata.sdkv = _package.version;
218
+ this._options.clientMetadata.sdkv = version;
222
219
  }
223
220
  // Enable session local storage for Sync
224
221
  this._options.Sync = this._options.Sync || {};
@@ -232,7 +229,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
232
229
  throw new Error("A valid Twilio token should be provided");
233
230
  }
234
231
  this._services = new ClientServices();
235
- this._myself = new user.User("", "", null, this._services);
232
+ this._myself = new User("", "", null, this._services);
236
233
  const startTwilsock = !this._options.twilsockClient;
237
234
  // Create default init registrations if none were provided.
238
235
  // Otherwise, the outside party have to list all the init registrations they
@@ -240,45 +237,46 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
240
237
  // Init registrations passed to the Conversations client will be passed down
241
238
  // to the Sync client as well.
242
239
  if (!this._options.initRegistrations) {
243
- const initRegistration = new twilsock.InitRegistration(productId);
240
+ const initRegistration = new InitRegistration(productId);
244
241
  Client_1.populateInitRegistrations(initRegistration);
245
242
  this._options.initRegistrations = [initRegistration];
246
243
  }
247
244
  this._services.twilsockClient = this._options.twilsockClient =
248
- (_b = this._options.twilsockClient) !== null && _b !== void 0 ? _b : new twilsock.TwilsockClient(fpaToken, productId, this._options);
249
- this._services.twilsockClient.on("tokenAboutToExpire", () => this.emit("tokenAboutToExpire"));
250
- this._services.twilsockClient.on("tokenExpired", () => this.emit("tokenExpired"));
251
- this._services.twilsockClient.on("connectionError", (error) => this.emit("connectionError", error));
245
+ (_b = this._options.twilsockClient) !== null && _b !== void 0 ? _b : new TwilsockClient(fpaToken, productId, this._options);
246
+ this._services.twilsockClient.on(Client_1.tokenAboutToExpire, () => this.emit(Client_1.tokenAboutToExpire));
247
+ this._services.twilsockClient.on(Client_1.tokenExpired, () => this.emit(Client_1.tokenExpired));
248
+ this._services.twilsockClient.on(Client_1.connectionError, (error) => this.emit(Client_1.connectionError, error));
252
249
  this._services.twilsockClient.on("stateChanged", (state) => {
253
250
  Client_1._logger.debug(`Handling stateChanged for ConversationsClient: new state ${state}`);
254
251
  if (state !== this.connectionState) {
255
252
  this.connectionState = state;
256
- this.emit("connectionStateChanged", this.connectionState);
253
+ this.emit(Client_1.connectionStateChanged, this.connectionState);
257
254
  }
258
255
  });
259
256
  this._services.transport = this._options.transport = ((_c = this._options
260
257
  .transport) !== null && _c !== void 0 ? _c : this._options.twilsockClient);
261
258
  this._services.notificationClient = this._options.notificationsClient =
262
- (_d = this._options.notificationsClient) !== null && _d !== void 0 ? _d : new notifications.Notifications(fpaToken, this._options);
259
+ (_d = this._options.notificationsClient) !== null && _d !== void 0 ? _d : new Notifications(fpaToken, this._options);
263
260
  this._services.syncClient = this._options.syncClient =
264
- (_e = this._options.syncClient) !== null && _e !== void 0 ? _e : new twilioSync.SyncClient(fpaToken, this._options);
261
+ (_e = this._options.syncClient) !== null && _e !== void 0 ? _e : new SyncClient(fpaToken, this._options);
265
262
  const configurationOptions = (options === null || options === void 0 ? void 0 : options.Chat) || (options === null || options === void 0 ? void 0 : options.IPMessaging) || options || {};
266
263
  const region = configurationOptions.region || (options === null || options === void 0 ? void 0 : options.region);
267
264
  const baseUrl = configurationOptions.apiUri ||
268
265
  configurationOptions.typingUri ||
269
266
  `https://aim.${region || "us1"}.twilio.com`;
270
- this._services.commandExecutor = new commandExecutor.CommandExecutor(baseUrl, { transport: this._options.transport }, productId);
271
- this._services.contentClient = new contentClient.ContentClient(this._services);
267
+ this._services.commandExecutor = new CommandExecutor(baseUrl, { transport: this._options.transport }, productId);
268
+ this._services.contentClient = new ContentClient(this._services);
272
269
  const emitFailed = (error) => {
273
270
  this._rejectEnsureReady(error);
274
- this.emit("stateChanged", "failed");
275
- this.emit("initFailed", { error });
271
+ this.emit(Client_1.stateChanged, "failed");
272
+ this.emit(Client_1.initFailed, { error });
276
273
  };
277
274
  const emitDisconnected = () => {
278
275
  emitFailed({
279
276
  terminal: true,
280
277
  message: "Twilsock has disconnected.",
281
278
  });
279
+ this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
282
280
  };
283
281
  this._services.twilsockClient.once("connectionError", emitFailed);
284
282
  this._services.twilsockClient.once("disconnected", emitDisconnected);
@@ -288,9 +286,9 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
288
286
  this._services.twilsockClient.off("disconnected", emitDisconnected);
289
287
  try {
290
288
  const startupEvent = "conversations.client.startup";
291
- this._services.twilsockClient.addPartialTelemetryEvent(new twilsock.TelemetryEventDescription(startupEvent, "Conversations client startup", new Date()), startupEvent, twilsock.TelemetryPoint.Start);
289
+ this._services.twilsockClient.addPartialTelemetryEvent(new TelemetryEventDescription(startupEvent, "Conversations client startup", new Date()), startupEvent, TelemetryPoint.Start);
292
290
  await this._initialize();
293
- this._services.twilsockClient.addPartialTelemetryEvent(new twilsock.TelemetryEventDescription("", "", new Date()), startupEvent, twilsock.TelemetryPoint.End);
291
+ this._services.twilsockClient.addPartialTelemetryEvent(new TelemetryEventDescription("", "", new Date()), startupEvent, TelemetryPoint.End);
294
292
  }
295
293
  catch (err) {
296
294
  // Fail ChatClient if initialization is incomplete
@@ -299,16 +297,13 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
299
297
  message: err.message,
300
298
  };
301
299
  this._rejectEnsureReady(connectionError);
302
- this.emit("stateChanged", "failed");
303
- this.emit("initFailed", {
300
+ this.emit(Client_1.stateChanged, "failed");
301
+ this.emit(Client_1.initFailed, {
304
302
  error: connectionError,
305
303
  });
306
304
  }
307
305
  });
308
- this._ensureReady = new Promise((resolve, reject) => {
309
- this._resolveEnsureReady = resolve;
310
- this._rejectEnsureReady = reject;
311
- }).catch(() => void 0); // @todo How to process unhandled rejection here?
306
+ this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
312
307
  if (startTwilsock) {
313
308
  this._services.twilsockClient.connect();
314
309
  }
@@ -400,7 +395,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
400
395
  body = ((_a = apsPayload.alert) === null || _a === void 0 ? void 0 : _a.body) || null;
401
396
  title = ((_b = apsPayload.alert) === null || _b === void 0 ? void 0 : _b.title) || null;
402
397
  }
403
- return new pushNotification.PushNotification({
398
+ return new PushNotification({
404
399
  title,
405
400
  body,
406
401
  sound: apsPayload.sound || null,
@@ -417,7 +412,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
417
412
  throw new Error("Provided push notification payload does not contain Programmable Chat push notification type");
418
413
  }
419
414
  const data = Client_1._parsePushNotificationChatData(notificationPayload.data);
420
- return new pushNotification.PushNotification({
415
+ return new PushNotification({
421
416
  title: dataPayload.twi_title || null,
422
417
  body: dataPayload.twi_body || null,
423
418
  sound: dataPayload.twi_sound || null,
@@ -441,7 +436,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
441
436
  continue;
442
437
  }
443
438
  if (key === "message_index" || key === "media_count") {
444
- const number = index.parseToNumber(value);
439
+ const number = parseToNumber(value);
445
440
  if (number !== null) {
446
441
  result[Client_1._supportedPushDataFields[key]] = number;
447
442
  }
@@ -467,8 +462,8 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
467
462
  * @param reg The init registration to populate.
468
463
  */
469
464
  static populateInitRegistrations(reg) {
470
- reg.populateInitRegistrations([notificationTypes.NotificationTypes.TYPING_INDICATOR]);
471
- twilioSync.SyncClient.populateInitRegistrations(reg);
465
+ reg.populateInitRegistrations([NotificationTypes.TYPING_INDICATOR]);
466
+ SyncClient.populateInitRegistrations(reg);
472
467
  }
473
468
  /**
474
469
  * Gracefully shut down the client.
@@ -504,7 +499,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
504
499
  if (!conversation) {
505
500
  conversation = await this.peekConversationBySid(conversationSid);
506
501
  if (conversation) {
507
- deprecationDecorator.deprecationWarning("The method getConversationBySid is deprecated to retrieve conversations you're not part of. Use peekConversationBySid instead.");
502
+ deprecationWarning("The method getConversationBySid is deprecated to retrieve conversations you're not part of. Use peekConversationBySid instead.");
508
503
  }
509
504
  }
510
505
  if (!conversation) {
@@ -515,7 +510,6 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
515
510
  /**
516
511
  * Peek a conversation by its SID.
517
512
  * @param conversationSid Conversation sid
518
- * @internal
519
513
  */
520
514
  async peekConversationBySid(conversationSid) {
521
515
  await this._ensureReady;
@@ -628,7 +622,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
628
622
  * @param mediaSids Set of media sids to query for the content URL.
629
623
  */
630
624
  getTemporaryContentUrlsForMediaSids(mediaSids) {
631
- return new mcsClient.CancellablePromise(async (resolve, reject, onCancel) => {
625
+ return new CancellablePromise(async (resolve, reject, onCancel) => {
632
626
  if (!this._services.mcsClient || !mediaSids) {
633
627
  reject(new Error("Media Content Service is unavailable"));
634
628
  return;
@@ -671,12 +665,13 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
671
665
  */
672
666
  async _initialize() {
673
667
  const configurationResponse = await this._services.commandExecutor.fetchResource("Client/v2/Configuration");
674
- this._configuration = new configuration.Configuration(this._options, configurationResponse, Client_1._logger);
675
- this._services.channelMetadataClient = new channelMetadataClient.ChannelMetadataClient(this._services, this._configuration);
668
+ this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
669
+ this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
670
+ this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
676
671
  this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
677
- this._services.typingIndicator = new typingIndicator.TypingIndicator(this.getConversationBySid.bind(this), this._configuration, this._services);
678
- this._services.network = new network.Network(this._configuration, this._services);
679
- this._services.users = new users.Users(this._myself, this._configuration, this._services);
672
+ this._services.typingIndicator = new TypingIndicator(this.getConversationBySid.bind(this), this._configuration, this._services);
673
+ this._services.network = new Network(this._configuration, this._services);
674
+ this._services.users = new Users(this._myself, this._configuration, this._services);
680
675
  this._services.users.on("userSubscribed", (user) => {
681
676
  this.emit("userSubscribed", user);
682
677
  });
@@ -684,7 +679,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
684
679
  this._services.users.on("userUnsubscribed", (user) => {
685
680
  this.emit("userUnsubscribed", user);
686
681
  });
687
- this._conversationsEntity = new conversations.Conversations(this._configuration, this._services);
682
+ this._conversationsEntity = new Conversations(this._configuration, this._services);
688
683
  this._conversationsEntity.on("conversationAdded", (conversation) => {
689
684
  this.emit("conversationAdded", conversation);
690
685
  });
@@ -714,15 +709,16 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
714
709
  .fetchConversations()
715
710
  .then(() => this._conversationsEntity)
716
711
  .catch((error) => {
712
+ console.error("Failed to fetch conversations _conversationsPromise -> client.ts", error);
717
713
  throw error;
718
714
  });
719
715
  await this._services.users.myself._ensureFetched();
720
716
  Client_1._supportedPushChannels.forEach((channelType) => this._subscribeToPushNotifications(channelType));
721
717
  this._services.typingIndicator.initialize();
722
- this._services.mcsClient = new mcsClient.McsClient(this._fpaToken, this._configuration.links.mediaService, this._configuration.links.mediaSetService, Object.assign(Object.assign({}, this._options), { transport: undefined }));
718
+ this._services.mcsClient = new McsClient(this._fpaToken, this._configuration.links.mediaService, this._configuration.links.mediaSetService, Object.assign(Object.assign({}, this._options), { transport: undefined }));
723
719
  this._resolveEnsureReady();
724
- this.emit("stateChanged", "initialized");
725
- this.emit("initialized");
720
+ this.emit(Client_1.stateChanged, "initialized");
721
+ this.emit(Client_1.initialized);
726
722
  }
727
723
  /**
728
724
  * Subscribe to push notifications.
@@ -730,11 +726,11 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
730
726
  */
731
727
  _subscribeToPushNotifications(channelType) {
732
728
  [
733
- notificationTypes.NotificationTypes.NEW_MESSAGE,
734
- notificationTypes.NotificationTypes.ADDED_TO_CONVERSATION,
735
- notificationTypes.NotificationTypes.REMOVED_FROM_CONVERSATION,
736
- notificationTypes.NotificationTypes.TYPING_INDICATOR,
737
- notificationTypes.NotificationTypes.CONSUMPTION_UPDATE,
729
+ NotificationTypes.NEW_MESSAGE,
730
+ NotificationTypes.ADDED_TO_CONVERSATION,
731
+ NotificationTypes.REMOVED_FROM_CONVERSATION,
732
+ NotificationTypes.TYPING_INDICATOR,
733
+ NotificationTypes.CONSUMPTION_UPDATE,
738
734
  ].forEach((messageType) => {
739
735
  this._services.notificationClient.subscribe(channelType, messageType);
740
736
  });
@@ -745,15 +741,31 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
745
741
  */
746
742
  _unsubscribeFromPushNotifications(channelType) {
747
743
  [
748
- notificationTypes.NotificationTypes.NEW_MESSAGE,
749
- notificationTypes.NotificationTypes.ADDED_TO_CONVERSATION,
750
- notificationTypes.NotificationTypes.REMOVED_FROM_CONVERSATION,
751
- notificationTypes.NotificationTypes.TYPING_INDICATOR,
752
- notificationTypes.NotificationTypes.CONSUMPTION_UPDATE,
744
+ NotificationTypes.NEW_MESSAGE,
745
+ NotificationTypes.ADDED_TO_CONVERSATION,
746
+ NotificationTypes.REMOVED_FROM_CONVERSATION,
747
+ NotificationTypes.TYPING_INDICATOR,
748
+ NotificationTypes.CONSUMPTION_UPDATE,
753
749
  ].forEach((messageType) => {
754
750
  this._services.notificationClient.unsubscribe(channelType, messageType);
755
751
  });
756
752
  }
753
+ /**
754
+ * Initialize the ensureReady promise.
755
+ */
756
+ _initializeEnsureReady(throwErrorsAlways) {
757
+ this._ensureReady = new Promise((resolve, reject) => {
758
+ this._resolveEnsureReady = resolve;
759
+ this._rejectEnsureReady = reject;
760
+ }).catch((error) => {
761
+ if (throwErrorsAlways) {
762
+ throw error;
763
+ }
764
+ else {
765
+ return void 0;
766
+ }
767
+ });
768
+ }
757
769
  };
758
770
  /**
759
771
  * Fired when a conversation becomes visible to the client. The event is also
@@ -764,7 +776,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
764
776
  * 1. {@link Conversation} `conversation` - the conversation in question
765
777
  * @event
766
778
  */
767
- exports.Client.conversationAdded = "conversationAdded";
779
+ Client.conversationAdded = "conversationAdded";
768
780
  /**
769
781
  * Fired when the client joins a conversation.
770
782
  *
@@ -772,7 +784,7 @@ exports.Client.conversationAdded = "conversationAdded";
772
784
  * 1. {@link Conversation} `conversation` - the conversation in question
773
785
  * @event
774
786
  */
775
- exports.Client.conversationJoined = "conversationJoined";
787
+ Client.conversationJoined = "conversationJoined";
776
788
  /**
777
789
  * Fired when the client leaves a conversation.
778
790
  *
@@ -780,7 +792,7 @@ exports.Client.conversationJoined = "conversationJoined";
780
792
  * 1. {@link Conversation} `conversation` - the conversation in question
781
793
  * @event
782
794
  */
783
- exports.Client.conversationLeft = "conversationLeft";
795
+ Client.conversationLeft = "conversationLeft";
784
796
  /**
785
797
  * Fired when a conversation is no longer visible to the client.
786
798
  *
@@ -788,7 +800,7 @@ exports.Client.conversationLeft = "conversationLeft";
788
800
  * 1. {@link Conversation} `conversation` - the conversation in question
789
801
  * @event
790
802
  */
791
- exports.Client.conversationRemoved = "conversationRemoved";
803
+ Client.conversationRemoved = "conversationRemoved";
792
804
  /**
793
805
  * Fired when the attributes or the metadata of a conversation have been
794
806
  * updated. During conversation's creation and initialization, this event
@@ -803,7 +815,7 @@ exports.Client.conversationRemoved = "conversationRemoved";
803
815
  * for the update
804
816
  * @event
805
817
  */
806
- exports.Client.conversationUpdated = "conversationUpdated";
818
+ Client.conversationUpdated = "conversationUpdated";
807
819
  /**
808
820
  * Fired when a participant has joined a conversation.
809
821
  *
@@ -811,7 +823,7 @@ exports.Client.conversationUpdated = "conversationUpdated";
811
823
  * 1. {@link Participant} `participant` - the participant in question
812
824
  * @event
813
825
  */
814
- exports.Client.participantJoined = "participantJoined";
826
+ Client.participantJoined = "participantJoined";
815
827
  /**
816
828
  * Fired when a participant has left a conversation.
817
829
  *
@@ -819,7 +831,7 @@ exports.Client.participantJoined = "participantJoined";
819
831
  * 1. {@link Participant} `participant` - the participant in question
820
832
  * @event
821
833
  */
822
- exports.Client.participantLeft = "participantLeft";
834
+ Client.participantLeft = "participantLeft";
823
835
  /**
824
836
  * Fired when a participant's fields have been updated.
825
837
  *
@@ -831,7 +843,7 @@ exports.Client.participantLeft = "participantLeft";
831
843
  * for the update
832
844
  * @event
833
845
  */
834
- exports.Client.participantUpdated = "participantUpdated";
846
+ Client.participantUpdated = "participantUpdated";
835
847
  /**
836
848
  * Fired when a new message has been added to the conversation on the server.
837
849
  *
@@ -839,7 +851,7 @@ exports.Client.participantUpdated = "participantUpdated";
839
851
  * 1. {@link Message} `message` - the message in question
840
852
  * @event
841
853
  */
842
- exports.Client.messageAdded = "messageAdded";
854
+ Client.messageAdded = "messageAdded";
843
855
  /**
844
856
  * Fired when a message is removed from the message list of a conversation.
845
857
  *
@@ -847,7 +859,7 @@ exports.Client.messageAdded = "messageAdded";
847
859
  * 1. {@link Message} `message` - the message in question
848
860
  * @event
849
861
  */
850
- exports.Client.messageRemoved = "messageRemoved";
862
+ Client.messageRemoved = "messageRemoved";
851
863
  /**
852
864
  * Fired when the fields of an existing message are updated with new values.
853
865
  *
@@ -859,17 +871,17 @@ exports.Client.messageRemoved = "messageRemoved";
859
871
  * the update
860
872
  * @event
861
873
  */
862
- exports.Client.messageUpdated = "messageUpdated";
874
+ Client.messageUpdated = "messageUpdated";
863
875
  /**
864
876
  * Fired when the token is about to expire and needs to be updated.
865
877
  * @event
866
878
  */
867
- exports.Client.tokenAboutToExpire = "tokenAboutToExpire";
879
+ Client.tokenAboutToExpire = "tokenAboutToExpire";
868
880
  /**
869
881
  * Fired when the token has expired.
870
882
  * @event
871
883
  */
872
- exports.Client.tokenExpired = "tokenExpired";
884
+ Client.tokenExpired = "tokenExpired";
873
885
  /**
874
886
  * Fired when a participant has stopped typing.
875
887
  *
@@ -877,7 +889,7 @@ exports.Client.tokenExpired = "tokenExpired";
877
889
  * 1. {@link Participant} `participant` - the participant in question
878
890
  * @event
879
891
  */
880
- exports.Client.typingEnded = "typingEnded";
892
+ Client.typingEnded = "typingEnded";
881
893
  /**
882
894
  * Fired when a participant has started typing.
883
895
  *
@@ -885,7 +897,7 @@ exports.Client.typingEnded = "typingEnded";
885
897
  * 1. {@link Participant} `participant` - the participant in question
886
898
  * @event
887
899
  */
888
- exports.Client.typingStarted = "typingStarted";
900
+ Client.typingStarted = "typingStarted";
889
901
  /**
890
902
  * Fired when the client has received (and parsed) a push notification via one
891
903
  * of the push channels (apn or fcm).
@@ -895,7 +907,7 @@ exports.Client.typingStarted = "typingStarted";
895
907
  * question
896
908
  * @event
897
909
  */
898
- exports.Client.pushNotification = "pushNotification";
910
+ Client.pushNotification = "pushNotification";
899
911
  /**
900
912
  * Fired when the client has subscribed to a user.
901
913
  *
@@ -903,7 +915,7 @@ exports.Client.pushNotification = "pushNotification";
903
915
  * 1. {@link User} `user` - the user in question
904
916
  * @event
905
917
  */
906
- exports.Client.userSubscribed = "userSubscribed";
918
+ Client.userSubscribed = "userSubscribed";
907
919
  /**
908
920
  * Fired when the client has unsubscribed from a user.
909
921
  *
@@ -911,7 +923,7 @@ exports.Client.userSubscribed = "userSubscribed";
911
923
  * 1. {@link User} `user` - the user in question
912
924
  * @event
913
925
  */
914
- exports.Client.userUnsubscribed = "userUnsubscribed";
926
+ Client.userUnsubscribed = "userUnsubscribed";
915
927
  /**
916
928
  * Fired when the properties or the reachability status of a user have been
917
929
  * updated.
@@ -924,7 +936,7 @@ exports.Client.userUnsubscribed = "userUnsubscribed";
924
936
  * update
925
937
  * @event
926
938
  */
927
- exports.Client.userUpdated = "userUpdated";
939
+ Client.userUpdated = "userUpdated";
928
940
  /**
929
941
  * @deprecated Use initialized or initFailed events instead
930
942
  * Fired when the state of the client has been changed.
@@ -933,12 +945,12 @@ exports.Client.userUpdated = "userUpdated";
933
945
  * 1. {@link State} `state` - the new client state
934
946
  * @event
935
947
  */
936
- exports.Client.stateChanged = "stateChanged";
948
+ Client.stateChanged = "stateChanged";
937
949
  /**
938
950
  * Fired when the client has completed initialization successfully.
939
951
  * @event
940
952
  */
941
- exports.Client.initialized = "initialized";
953
+ Client.initialized = "initialized";
942
954
  /**
943
955
  * Fired when the client initialization failed.
944
956
  *
@@ -948,7 +960,7 @@ exports.Client.initialized = "initialized";
948
960
  * * Error? `error` - the initialization error if present
949
961
  * @event
950
962
  */
951
- exports.Client.initFailed = "initFailed";
963
+ Client.initFailed = "initFailed";
952
964
  /**
953
965
  * Fired when the connection state of the client has been changed.
954
966
  *
@@ -956,7 +968,7 @@ exports.Client.initFailed = "initFailed";
956
968
  * 1. {@link ConnectionState} `state` - the new connection state
957
969
  * @event
958
970
  */
959
- exports.Client.connectionStateChanged = "connectionStateChanged";
971
+ Client.connectionStateChanged = "connectionStateChanged";
960
972
  /**
961
973
  * Fired when the connection is interrupted for an unexpected reason.
962
974
  *
@@ -969,26 +981,26 @@ exports.Client.connectionStateChanged = "connectionStateChanged";
969
981
  * * number? `errorCode` - Twilio public error code if available
970
982
  * @event
971
983
  */
972
- exports.Client.connectionError = "connectionError";
984
+ Client.connectionError = "connectionError";
973
985
  /**
974
986
  * Current version of the Conversations client.
975
987
  */
976
- exports.Client.version = _package.version;
988
+ Client.version = version;
977
989
  /**
978
990
  * Logger instance.
979
991
  */
980
- exports.Client._logger = logger.Logger.scope("Client");
992
+ Client._logger = Logger.scope("Client");
981
993
  /**
982
994
  * Supported push notification channels.
983
995
  */
984
- exports.Client._supportedPushChannels = [
996
+ Client._supportedPushChannels = [
985
997
  "fcm",
986
998
  "apn",
987
999
  ];
988
1000
  /**
989
1001
  * Supported push data fields.
990
1002
  */
991
- exports.Client._supportedPushDataFields = {
1003
+ Client._supportedPushDataFields = {
992
1004
  conversation_sid: "conversationSid",
993
1005
  conversation_title: "conversationTitle",
994
1006
  message_sid: "messageSid",
@@ -996,105 +1008,107 @@ exports.Client._supportedPushDataFields = {
996
1008
  media_count: "mediaCount",
997
1009
  media: "media", // object
998
1010
  };
999
- tslib_es6.__decorate([
1000
- deprecationDecorator.deprecated("token"),
1001
- tslib_es6.__metadata("design:type", String),
1002
- tslib_es6.__metadata("design:paramtypes", [])
1003
- ], exports.Client.prototype, "token", null);
1004
- tslib_es6.__decorate([
1005
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString),
1006
- tslib_es6.__metadata("design:type", Function),
1007
- tslib_es6.__metadata("design:paramtypes", [String]),
1008
- tslib_es6.__metadata("design:returntype", Promise)
1009
- ], exports.Client.prototype, "updateToken", null);
1010
- tslib_es6.__decorate([
1011
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString),
1012
- tslib_es6.__metadata("design:type", Function),
1013
- tslib_es6.__metadata("design:paramtypes", [String]),
1014
- tslib_es6.__metadata("design:returntype", Promise)
1015
- ], exports.Client.prototype, "getConversationBySid", null);
1016
- tslib_es6.__decorate([
1017
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString),
1018
- tslib_es6.__metadata("design:type", Function),
1019
- tslib_es6.__metadata("design:paramtypes", [String]),
1020
- tslib_es6.__metadata("design:returntype", Promise)
1021
- ], exports.Client.prototype, "peekConversationBySid", null);
1022
- tslib_es6.__decorate([
1023
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString),
1024
- tslib_es6.__metadata("design:type", Function),
1025
- tslib_es6.__metadata("design:paramtypes", [String]),
1026
- tslib_es6.__metadata("design:returntype", Promise)
1027
- ], exports.Client.prototype, "getConversationByUniqueName", null);
1028
- tslib_es6.__decorate([
1029
- declarativeTypeValidator.validateTypesAsync([
1011
+ __decorate([
1012
+ deprecated("token"),
1013
+ __metadata("design:type", String),
1014
+ __metadata("design:paramtypes", [])
1015
+ ], Client.prototype, "token", null);
1016
+ __decorate([
1017
+ validateTypesAsync(nonEmptyString),
1018
+ __metadata("design:type", Function),
1019
+ __metadata("design:paramtypes", [String]),
1020
+ __metadata("design:returntype", Promise)
1021
+ ], Client.prototype, "updateToken", null);
1022
+ __decorate([
1023
+ validateTypesAsync(nonEmptyString),
1024
+ __metadata("design:type", Function),
1025
+ __metadata("design:paramtypes", [String]),
1026
+ __metadata("design:returntype", Promise)
1027
+ ], Client.prototype, "getConversationBySid", null);
1028
+ __decorate([
1029
+ validateTypesAsync(nonEmptyString),
1030
+ __metadata("design:type", Function),
1031
+ __metadata("design:paramtypes", [String]),
1032
+ __metadata("design:returntype", Promise)
1033
+ ], Client.prototype, "peekConversationBySid", null);
1034
+ __decorate([
1035
+ validateTypesAsync(nonEmptyString),
1036
+ __metadata("design:type", Function),
1037
+ __metadata("design:paramtypes", [String]),
1038
+ __metadata("design:returntype", Promise)
1039
+ ], Client.prototype, "getConversationByUniqueName", null);
1040
+ __decorate([
1041
+ validateTypesAsync([
1030
1042
  "undefined",
1031
- declarativeTypeValidator.objectSchema("conversation options", {
1043
+ objectSchema("conversation options", {
1032
1044
  friendlyName: ["string", "undefined"],
1033
1045
  isPrivate: ["boolean", "undefined"],
1034
1046
  uniqueName: ["string", "undefined"],
1035
1047
  }),
1036
1048
  ]),
1037
- tslib_es6.__metadata("design:type", Function),
1038
- tslib_es6.__metadata("design:paramtypes", [Object]),
1039
- tslib_es6.__metadata("design:returntype", Promise)
1040
- ], exports.Client.prototype, "createConversation", null);
1041
- tslib_es6.__decorate([
1042
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.literal("fcm", "apn"), "string"),
1043
- tslib_es6.__metadata("design:type", Function),
1044
- tslib_es6.__metadata("design:paramtypes", [String, String]),
1045
- tslib_es6.__metadata("design:returntype", Promise)
1046
- ], exports.Client.prototype, "setPushRegistrationId", null);
1047
- tslib_es6.__decorate([
1048
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.literal("fcm", "apn")),
1049
- tslib_es6.__metadata("design:type", Function),
1050
- tslib_es6.__metadata("design:paramtypes", [String]),
1051
- tslib_es6.__metadata("design:returntype", Promise)
1052
- ], exports.Client.prototype, "unsetPushRegistrationId", null);
1053
- tslib_es6.__decorate([
1054
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.literal("fcm", "apn"), declarativeTypeValidator.nonEmptyString),
1055
- tslib_es6.__metadata("design:type", Function),
1056
- tslib_es6.__metadata("design:paramtypes", [String, String]),
1057
- tslib_es6.__metadata("design:returntype", Promise)
1058
- ], exports.Client.prototype, "removePushRegistrations", null);
1059
- tslib_es6.__decorate([
1060
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.pureObject),
1061
- tslib_es6.__metadata("design:type", Function),
1062
- tslib_es6.__metadata("design:paramtypes", [Object]),
1063
- tslib_es6.__metadata("design:returntype", Promise)
1064
- ], exports.Client.prototype, "handlePushNotification", null);
1065
- tslib_es6.__decorate([
1066
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString),
1067
- tslib_es6.__metadata("design:type", Function),
1068
- tslib_es6.__metadata("design:paramtypes", [String]),
1069
- tslib_es6.__metadata("design:returntype", Promise)
1070
- ], exports.Client.prototype, "getUser", null);
1071
- tslib_es6.__decorate([
1072
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyArray("strings", "string")),
1073
- tslib_es6.__metadata("design:type", Function),
1074
- tslib_es6.__metadata("design:paramtypes", [Array]),
1075
- tslib_es6.__metadata("design:returntype", mcsClient.CancellablePromise)
1076
- ], exports.Client.prototype, "getTemporaryContentUrlsForMediaSids", null);
1077
- tslib_es6.__decorate([
1078
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyArray("media", media.Media)),
1079
- tslib_es6.__metadata("design:type", Function),
1080
- tslib_es6.__metadata("design:paramtypes", [Array]),
1081
- tslib_es6.__metadata("design:returntype", mcsClient.CancellablePromise)
1082
- ], exports.Client.prototype, "getTemporaryContentUrlsForMedia", null);
1083
- tslib_es6.__decorate([
1084
- deprecationDecorator.deprecated("Client.create()", "new Client()"),
1085
- declarativeTypeValidator.validateTypesAsync("string", ["undefined", declarativeTypeValidator.pureObject]),
1086
- tslib_es6.__metadata("design:type", Function),
1087
- tslib_es6.__metadata("design:paramtypes", [String, Object]),
1088
- tslib_es6.__metadata("design:returntype", Promise)
1089
- ], exports.Client, "create", null);
1090
- tslib_es6.__decorate([
1091
- declarativeTypeValidator.validateTypes(declarativeTypeValidator.pureObject),
1092
- tslib_es6.__metadata("design:type", Function),
1093
- tslib_es6.__metadata("design:paramtypes", [Object]),
1094
- tslib_es6.__metadata("design:returntype", pushNotification.PushNotification)
1095
- ], exports.Client, "parsePushNotification", null);
1096
- exports.Client = Client_1 = tslib_es6.__decorate([
1097
- declarativeTypeValidator.validateConstructorTypes(declarativeTypeValidator.nonEmptyString, [declarativeTypeValidator.pureObject, "undefined"]),
1098
- tslib_es6.__metadata("design:paramtypes", [String, Object])
1099
- ], exports.Client);
1049
+ __metadata("design:type", Function),
1050
+ __metadata("design:paramtypes", [Object]),
1051
+ __metadata("design:returntype", Promise)
1052
+ ], Client.prototype, "createConversation", null);
1053
+ __decorate([
1054
+ validateTypesAsync(literal("fcm", "apn"), "string"),
1055
+ __metadata("design:type", Function),
1056
+ __metadata("design:paramtypes", [String, String]),
1057
+ __metadata("design:returntype", Promise)
1058
+ ], Client.prototype, "setPushRegistrationId", null);
1059
+ __decorate([
1060
+ validateTypesAsync(literal("fcm", "apn")),
1061
+ __metadata("design:type", Function),
1062
+ __metadata("design:paramtypes", [String]),
1063
+ __metadata("design:returntype", Promise)
1064
+ ], Client.prototype, "unsetPushRegistrationId", null);
1065
+ __decorate([
1066
+ validateTypesAsync(literal("fcm", "apn"), nonEmptyString),
1067
+ __metadata("design:type", Function),
1068
+ __metadata("design:paramtypes", [String, String]),
1069
+ __metadata("design:returntype", Promise)
1070
+ ], Client.prototype, "removePushRegistrations", null);
1071
+ __decorate([
1072
+ validateTypesAsync(pureObject),
1073
+ __metadata("design:type", Function),
1074
+ __metadata("design:paramtypes", [Object]),
1075
+ __metadata("design:returntype", Promise)
1076
+ ], Client.prototype, "handlePushNotification", null);
1077
+ __decorate([
1078
+ validateTypesAsync(nonEmptyString),
1079
+ __metadata("design:type", Function),
1080
+ __metadata("design:paramtypes", [String]),
1081
+ __metadata("design:returntype", Promise)
1082
+ ], Client.prototype, "getUser", null);
1083
+ __decorate([
1084
+ validateTypesAsync(nonEmptyArray("strings", "string")),
1085
+ __metadata("design:type", Function),
1086
+ __metadata("design:paramtypes", [Array]),
1087
+ __metadata("design:returntype", CancellablePromise)
1088
+ ], Client.prototype, "getTemporaryContentUrlsForMediaSids", null);
1089
+ __decorate([
1090
+ validateTypesAsync(nonEmptyArray("media", Media)),
1091
+ __metadata("design:type", Function),
1092
+ __metadata("design:paramtypes", [Array]),
1093
+ __metadata("design:returntype", CancellablePromise)
1094
+ ], Client.prototype, "getTemporaryContentUrlsForMedia", null);
1095
+ __decorate([
1096
+ deprecated("Client.create()", "new Client()"),
1097
+ validateTypesAsync("string", ["undefined", pureObject]),
1098
+ __metadata("design:type", Function),
1099
+ __metadata("design:paramtypes", [String, Object]),
1100
+ __metadata("design:returntype", Promise)
1101
+ ], Client, "create", null);
1102
+ __decorate([
1103
+ validateTypes(pureObject),
1104
+ __metadata("design:type", Function),
1105
+ __metadata("design:paramtypes", [Object]),
1106
+ __metadata("design:returntype", PushNotification)
1107
+ ], Client, "parsePushNotification", null);
1108
+ Client = Client_1 = __decorate([
1109
+ validateConstructorTypes(nonEmptyString, [pureObject, "undefined"]),
1110
+ __metadata("design:paramtypes", [String, Object])
1111
+ ], Client);
1112
+
1113
+ export { Client };
1100
1114
  //# sourceMappingURL=client.js.map