@twilio/conversations 2.4.1-rc.0 → 2.4.1-rc.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.
package/builds/lib.d.ts CHANGED
@@ -6,8 +6,7 @@ import { ConnectionState as TwilsockConnectionState } from "twilsock";
6
6
  import { ReplayEventEmitter } from "@twilio/replay-event-emitter";
7
7
  import { ChannelType, Notifications } from "@twilio/notifications";
8
8
  import { Notifications as NotificationClient } from "@twilio/notifications";
9
- import { CancellablePromise, McsClient, MediaCategory, McsMedia } from "@twilio/mcs-client";
10
- import { MediaCategory as McsMediaCategory } from "@twilio/mcs-client";
9
+ import { CancellablePromise, McsClient, MediaCategory, McsMedia, McsMediaCategory, McsMediaState } from "@twilio/mcs-client";
11
10
  interface ConfigurationResponse {
12
11
  options: {
13
12
  consumption_report_interval: string;
@@ -523,13 +522,6 @@ interface ParticipantBindingOptions {
523
522
  * * `'history'`
524
523
  */
525
524
  type MediaCategory$0 = McsMediaCategory;
526
- interface MediaState {
527
- sid: string;
528
- category: MediaCategory$0;
529
- filename: string | null;
530
- contentType: string;
531
- size: number;
532
- }
533
525
  interface MediaServices {
534
526
  mcsClient: McsClient;
535
527
  }
@@ -543,7 +535,7 @@ declare class Media {
543
535
  /**
544
536
  * @internal
545
537
  */
546
- constructor(data: MediaState | McsMedia, services: MediaServices);
538
+ constructor(data: McsMediaState | McsMedia, services: MediaServices);
547
539
  /**
548
540
  * Server-assigned unique identifier for the media.
549
541
  */
@@ -576,7 +568,7 @@ declare class Media {
576
568
  /**
577
569
  * @internal
578
570
  */
579
- _state(): Record<string, unknown>;
571
+ _state(): McsMediaState;
580
572
  }
581
573
  /**
582
574
  * Signifies the amount of participants which have the status for the message.
package/builds/lib.js CHANGED
@@ -2191,10 +2191,12 @@ var Media = /*#__PURE__*/function () {
2191
2191
  while (1) {
2192
2192
  switch (_context.prev = _context.next) {
2193
2193
  case 0:
2194
- fetchMediaRequest = _this._fetchMcsMedia();
2194
+ fetchMediaRequest = _this.mcsMedia ? undefined : _this._fetchMcsMedia();
2195
2195
  contentUrlRequest = (_this$mcsMedia = _this.mcsMedia) === null || _this$mcsMedia === void 0 ? void 0 : _this$mcsMedia.getContentUrl();
2196
2196
  onCancel(function () {
2197
- fetchMediaRequest.cancel();
2197
+ if (fetchMediaRequest) {
2198
+ fetchMediaRequest.cancel();
2199
+ }
2198
2200
 
2199
2201
  if (contentUrlRequest) {
2200
2202
  contentUrlRequest.cancel();
@@ -2202,7 +2204,7 @@ var Media = /*#__PURE__*/function () {
2202
2204
  });
2203
2205
  _context.prev = 3;
2204
2206
 
2205
- if (_this.mcsMedia) {
2207
+ if (contentUrlRequest) {
2206
2208
  _context.next = 9;
2207
2209
  break;
2208
2210
  }
@@ -2212,7 +2214,7 @@ var Media = /*#__PURE__*/function () {
2212
2214
 
2213
2215
  case 7:
2214
2216
  mcsMedia = _context.sent;
2215
- contentUrlRequest = mcsMedia.getContentUrl();
2217
+ contentUrlRequest = mcsMedia === null || mcsMedia === void 0 ? void 0 : mcsMedia.getContentUrl();
2216
2218
 
2217
2219
  case 9:
2218
2220
  _context.t0 = resolve;
@@ -2269,13 +2271,11 @@ var Media = /*#__PURE__*/function () {
2269
2271
  while (1) {
2270
2272
  switch (_context2.prev = _context2.next) {
2271
2273
  case 0:
2272
- request = _this2.services.mcsClient.get(_this2.state.sid);
2273
-
2274
- if (!_this2.services.mcsClient) {
2275
- _context2.next = 14;
2276
- break;
2274
+ if (_this2.services.mcsClient === null) {
2275
+ reject(new Error("Media Content Service is unavailable"));
2277
2276
  }
2278
2277
 
2278
+ request = _this2.services.mcsClient.get(_this2.state.sid);
2279
2279
  onCancel(function () {
2280
2280
  return request.cancel();
2281
2281
  });
@@ -2285,27 +2285,22 @@ var Media = /*#__PURE__*/function () {
2285
2285
 
2286
2286
  case 6:
2287
2287
  _this2.mcsMedia = _context2.sent;
2288
+ _this2.state = _this2.mcsMedia._state();
2288
2289
  resolve(_this2.mcsMedia);
2289
- _context2.next = 13;
2290
+ _context2.next = 14;
2290
2291
  break;
2291
2292
 
2292
- case 10:
2293
- _context2.prev = 10;
2293
+ case 11:
2294
+ _context2.prev = 11;
2294
2295
  _context2.t0 = _context2["catch"](3);
2295
2296
  reject(_context2.t0);
2296
2297
 
2297
- case 13:
2298
- return _context2.abrupt("return");
2299
-
2300
2298
  case 14:
2301
- reject(new Error("Media Content Service is unavailable"));
2302
-
2303
- case 15:
2304
2299
  case "end":
2305
2300
  return _context2.stop();
2306
2301
  }
2307
2302
  }
2308
- }, _callee2, null, [[3, 10]]);
2303
+ }, _callee2, null, [[3, 11]]);
2309
2304
  }));
2310
2305
 
2311
2306
  return function (_x4, _x5, _x6) {
@@ -2320,7 +2315,7 @@ var Media = /*#__PURE__*/function () {
2320
2315
  }, {
2321
2316
  key: "_state",
2322
2317
  value: function _state() {
2323
- return this.mcsMedia ? this.mcsMedia._state() : this.state;
2318
+ return this.state;
2324
2319
  }
2325
2320
  }]);
2326
2321
 
@@ -7883,7 +7878,7 @@ function PushNotification(data) {
7883
7878
  this.data = data.data || {};
7884
7879
  });
7885
7880
 
7886
- var version = "2.4.1-rc.0";
7881
+ var version = "2.4.1-rc.1";
7887
7882
 
7888
7883
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7889
7884