@twilio/conversations 2.4.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/README.md +1 -1
- package/builds/browser.js +113 -50
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +9 -12
- package/builds/lib.js +113 -50
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +472 -257
- package/builds/twilio-conversations.min.js +1 -1
- package/dist/media.js +27 -16
- package/dist/media.js.map +1 -1
- package/dist/message.js +36 -11
- package/dist/message.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +7 -0
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/docs/index.html +4 -4
- package/docs/modules.html +3 -3
- package/package.json +8 -8
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:
|
538
|
+
constructor(data: McsMediaState | McsMedia, services: MediaServices);
|
547
539
|
/**
|
548
540
|
* Server-assigned unique identifier for the media.
|
549
541
|
*/
|
@@ -573,6 +565,10 @@ declare class Media {
|
|
573
565
|
*/
|
574
566
|
getContentTemporaryUrl(): CancellablePromise<string | null>;
|
575
567
|
private _fetchMcsMedia;
|
568
|
+
/**
|
569
|
+
* @internal
|
570
|
+
*/
|
571
|
+
_state(): McsMediaState;
|
576
572
|
}
|
577
573
|
/**
|
578
574
|
* Signifies the amount of participants which have the status for the message.
|
@@ -1229,9 +1225,9 @@ interface MessageLinks {
|
|
1229
1225
|
/**
|
1230
1226
|
* The reason for the `updated` event being emitted by a message.
|
1231
1227
|
*/
|
1232
|
-
type MessageUpdateReason = "body" | "lastUpdatedBy" | "dateCreated" | "dateUpdated" | "attributes" | "author" | "deliveryReceipt" | "subject";
|
1228
|
+
type MessageUpdateReason = "body" | "lastUpdatedBy" | "dateCreated" | "dateUpdated" | "attributes" | "author" | "deliveryReceipt" | "subject" | "media";
|
1233
1229
|
/**
|
1234
|
-
* Type of
|
1230
|
+
* Type of message.
|
1235
1231
|
*/
|
1236
1232
|
type MessageType = "text" | "media";
|
1237
1233
|
interface MessageUpdatedEventArgs {
|
@@ -1259,6 +1255,7 @@ interface MessageData {
|
|
1259
1255
|
* A message in a conversation.
|
1260
1256
|
*/
|
1261
1257
|
declare class Message extends ReplayEventEmitter<MessageEvents> {
|
1258
|
+
#private;
|
1262
1259
|
/**
|
1263
1260
|
* Conversation that the message is in.
|
1264
1261
|
*/
|
package/builds/lib.js
CHANGED
@@ -212,6 +212,7 @@ require('isomorphic-form-data');
|
|
212
212
|
require('core-js/modules/es.array.sort.js');
|
213
213
|
require('core-js/modules/es.string.includes.js');
|
214
214
|
require('core-js/modules/es.string.starts-with.js');
|
215
|
+
require('core-js/modules/es.weak-set.js');
|
215
216
|
var deprecationDecorator = require('@twilio/deprecation-decorator');
|
216
217
|
require('core-js/modules/es.object.entries.js');
|
217
218
|
require('core-js/modules/es.array.find.js');
|
@@ -2102,6 +2103,8 @@ var Media = /*#__PURE__*/function () {
|
|
2102
2103
|
* @internal
|
2103
2104
|
*/
|
2104
2105
|
function Media(data, services) {
|
2106
|
+
var _data$filename;
|
2107
|
+
|
2105
2108
|
_classCallCheck__default["default"](this, Media);
|
2106
2109
|
|
2107
2110
|
_defineProperty__default["default"](this, "mcsMedia", null);
|
@@ -2115,7 +2118,7 @@ var Media = /*#__PURE__*/function () {
|
|
2115
2118
|
this.state = {
|
2116
2119
|
sid: data.sid,
|
2117
2120
|
category: data.category,
|
2118
|
-
filename: data.filename,
|
2121
|
+
filename: (_data$filename = data.filename) !== null && _data$filename !== void 0 ? _data$filename : null,
|
2119
2122
|
contentType: data.contentType,
|
2120
2123
|
size: data.size
|
2121
2124
|
};
|
@@ -2188,10 +2191,12 @@ var Media = /*#__PURE__*/function () {
|
|
2188
2191
|
while (1) {
|
2189
2192
|
switch (_context.prev = _context.next) {
|
2190
2193
|
case 0:
|
2191
|
-
fetchMediaRequest = _this._fetchMcsMedia();
|
2194
|
+
fetchMediaRequest = _this.mcsMedia ? undefined : _this._fetchMcsMedia();
|
2192
2195
|
contentUrlRequest = (_this$mcsMedia = _this.mcsMedia) === null || _this$mcsMedia === void 0 ? void 0 : _this$mcsMedia.getContentUrl();
|
2193
2196
|
onCancel(function () {
|
2194
|
-
fetchMediaRequest
|
2197
|
+
if (fetchMediaRequest) {
|
2198
|
+
fetchMediaRequest.cancel();
|
2199
|
+
}
|
2195
2200
|
|
2196
2201
|
if (contentUrlRequest) {
|
2197
2202
|
contentUrlRequest.cancel();
|
@@ -2199,7 +2204,7 @@ var Media = /*#__PURE__*/function () {
|
|
2199
2204
|
});
|
2200
2205
|
_context.prev = 3;
|
2201
2206
|
|
2202
|
-
if (
|
2207
|
+
if (contentUrlRequest) {
|
2203
2208
|
_context.next = 9;
|
2204
2209
|
break;
|
2205
2210
|
}
|
@@ -2209,7 +2214,7 @@ var Media = /*#__PURE__*/function () {
|
|
2209
2214
|
|
2210
2215
|
case 7:
|
2211
2216
|
mcsMedia = _context.sent;
|
2212
|
-
contentUrlRequest = mcsMedia.getContentUrl();
|
2217
|
+
contentUrlRequest = mcsMedia === null || mcsMedia === void 0 ? void 0 : mcsMedia.getContentUrl();
|
2213
2218
|
|
2214
2219
|
case 9:
|
2215
2220
|
_context.t0 = resolve;
|
@@ -2266,13 +2271,11 @@ var Media = /*#__PURE__*/function () {
|
|
2266
2271
|
while (1) {
|
2267
2272
|
switch (_context2.prev = _context2.next) {
|
2268
2273
|
case 0:
|
2269
|
-
|
2270
|
-
|
2271
|
-
if (!_this2.services.mcsClient) {
|
2272
|
-
_context2.next = 14;
|
2273
|
-
break;
|
2274
|
+
if (_this2.services.mcsClient === null) {
|
2275
|
+
reject(new Error("Media Content Service is unavailable"));
|
2274
2276
|
}
|
2275
2277
|
|
2278
|
+
request = _this2.services.mcsClient.get(_this2.state.sid);
|
2276
2279
|
onCancel(function () {
|
2277
2280
|
return request.cancel();
|
2278
2281
|
});
|
@@ -2282,27 +2285,22 @@ var Media = /*#__PURE__*/function () {
|
|
2282
2285
|
|
2283
2286
|
case 6:
|
2284
2287
|
_this2.mcsMedia = _context2.sent;
|
2288
|
+
_this2.state = _this2.mcsMedia._state();
|
2285
2289
|
resolve(_this2.mcsMedia);
|
2286
|
-
_context2.next =
|
2290
|
+
_context2.next = 14;
|
2287
2291
|
break;
|
2288
2292
|
|
2289
|
-
case
|
2290
|
-
_context2.prev =
|
2293
|
+
case 11:
|
2294
|
+
_context2.prev = 11;
|
2291
2295
|
_context2.t0 = _context2["catch"](3);
|
2292
2296
|
reject(_context2.t0);
|
2293
2297
|
|
2294
|
-
case 13:
|
2295
|
-
return _context2.abrupt("return");
|
2296
|
-
|
2297
2298
|
case 14:
|
2298
|
-
reject(new Error("Media Content Service is unavailable"));
|
2299
|
-
|
2300
|
-
case 15:
|
2301
2299
|
case "end":
|
2302
2300
|
return _context2.stop();
|
2303
2301
|
}
|
2304
2302
|
}
|
2305
|
-
}, _callee2, null, [[3,
|
2303
|
+
}, _callee2, null, [[3, 11]]);
|
2306
2304
|
}));
|
2307
2305
|
|
2308
2306
|
return function (_x4, _x5, _x6) {
|
@@ -2310,6 +2308,15 @@ var Media = /*#__PURE__*/function () {
|
|
2310
2308
|
};
|
2311
2309
|
}());
|
2312
2310
|
}
|
2311
|
+
/**
|
2312
|
+
* @internal
|
2313
|
+
*/
|
2314
|
+
|
2315
|
+
}, {
|
2316
|
+
key: "_state",
|
2317
|
+
value: function _state() {
|
2318
|
+
return this.state;
|
2319
|
+
}
|
2313
2320
|
}]);
|
2314
2321
|
|
2315
2322
|
return Media;
|
@@ -2807,6 +2814,12 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
|
|
2807
2814
|
function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
|
2808
2815
|
|
2809
2816
|
function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
2817
|
+
|
2818
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
2819
|
+
|
2820
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
2821
|
+
|
2822
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
2810
2823
|
var log$3 = Logger.scope("Message");
|
2811
2824
|
|
2812
2825
|
var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
|
@@ -2816,6 +2829,10 @@ global["XMLHttpRequest"] || require("xmlhttprequest").XMLHttpRequest;
|
|
2816
2829
|
*/
|
2817
2830
|
|
2818
2831
|
|
2832
|
+
var _wrapMedia = /*#__PURE__*/new WeakSet();
|
2833
|
+
|
2834
|
+
var _assignMedias = /*#__PURE__*/new WeakSet();
|
2835
|
+
|
2819
2836
|
var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
2820
2837
|
_inherits__default["default"](Message, _ReplayEventEmitter);
|
2821
2838
|
|
@@ -2829,13 +2846,18 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
2829
2846
|
* @internal
|
2830
2847
|
*/
|
2831
2848
|
function Message(index, data, conversation, links, configuration, services) {
|
2832
|
-
var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid, _data$channelMetadata;
|
2849
|
+
var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid, _data$channelMetadata, _data$medias, _data$media;
|
2833
2850
|
|
2834
2851
|
var _this;
|
2835
2852
|
|
2836
2853
|
_classCallCheck__default["default"](this, Message);
|
2837
2854
|
|
2838
2855
|
_this = _super.call(this);
|
2856
|
+
|
2857
|
+
_classPrivateMethodInitSpec(_assertThisInitialized__default["default"](_this), _assignMedias);
|
2858
|
+
|
2859
|
+
_classPrivateMethodInitSpec(_assertThisInitialized__default["default"](_this), _wrapMedia);
|
2860
|
+
|
2839
2861
|
_this.conversation = conversation;
|
2840
2862
|
_this.links = links;
|
2841
2863
|
_this.configuration = configuration;
|
@@ -2852,27 +2874,17 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
2852
2874
|
lastUpdatedBy: (_data$lastUpdatedBy = data.lastUpdatedBy) !== null && _data$lastUpdatedBy !== void 0 ? _data$lastUpdatedBy : null,
|
2853
2875
|
attributes: parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(data.sid), log$3),
|
2854
2876
|
type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type : "text",
|
2855
|
-
media:
|
2856
|
-
medias:
|
2857
|
-
return new Media(m, _this.services);
|
2858
|
-
}) : data.type === "media" && data.media && !data.medias ? [new Media(_objectSpread$4(_objectSpread$4({}, data.media), {}, {
|
2859
|
-
category: "media"
|
2860
|
-
}), _this.services)] : null,
|
2877
|
+
media: null,
|
2878
|
+
medias: null,
|
2861
2879
|
participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
|
2862
2880
|
aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null,
|
2863
2881
|
hasChannelMetadata: (_data$channelMetadata = data.channelMetadata) !== null && _data$channelMetadata !== void 0 ? _data$channelMetadata : false
|
2864
2882
|
};
|
2883
|
+
|
2884
|
+
_classPrivateMethodGet(_assertThisInitialized__default["default"](_this), _assignMedias, _assignMedias2).call(_assertThisInitialized__default["default"](_this), (_data$medias = data.medias) !== null && _data$medias !== void 0 ? _data$medias : null, (_data$media = data.media) !== null && _data$media !== void 0 ? _data$media : null);
|
2885
|
+
|
2865
2886
|
return _this;
|
2866
2887
|
}
|
2867
|
-
/**
|
2868
|
-
* Fired when the properties or the body of the message has been updated.
|
2869
|
-
*
|
2870
|
-
* Parameters:
|
2871
|
-
* 1. object `data` - info object provided with the event. It has the following properties:
|
2872
|
-
* * {@link Message} message - the message in question
|
2873
|
-
* * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update
|
2874
|
-
*/
|
2875
|
-
|
2876
2888
|
|
2877
2889
|
_createClass__default["default"](Message, [{
|
2878
2890
|
key: "sid",
|
@@ -3083,6 +3095,12 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3083
3095
|
}, {
|
3084
3096
|
key: "_update",
|
3085
3097
|
value: function _update(data) {
|
3098
|
+
var _data$medias2,
|
3099
|
+
_this2 = this,
|
3100
|
+
_this$state$medias2,
|
3101
|
+
_classPrivateMethodGe2,
|
3102
|
+
_this$state$media;
|
3103
|
+
|
3086
3104
|
var updateReasons = [];
|
3087
3105
|
|
3088
3106
|
if ((data.text || typeof data.text === "string") && data.text !== this.state.body) {
|
@@ -3135,6 +3153,29 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3135
3153
|
|
3136
3154
|
updateReasons.push("deliveryReceipt");
|
3137
3155
|
}
|
3156
|
+
} // @fixme: This is a fairly heavy check.
|
3157
|
+
// Map data back and forth to perform a necessary field massage.
|
3158
|
+
|
3159
|
+
|
3160
|
+
var input = ((_data$medias2 = data.medias) !== null && _data$medias2 !== void 0 ? _data$medias2 : []).map(function (value) {
|
3161
|
+
var _classPrivateMethodGe;
|
3162
|
+
|
3163
|
+
return (_classPrivateMethodGe = _classPrivateMethodGet(_this2, _wrapMedia, _wrapMedia2).call(_this2, value)) === null || _classPrivateMethodGe === void 0 ? void 0 : _classPrivateMethodGe._state();
|
3164
|
+
}).filter(function (el) {
|
3165
|
+
return !(el === null);
|
3166
|
+
});
|
3167
|
+
var current = ((_this$state$medias2 = this.state.medias) !== null && _this$state$medias2 !== void 0 ? _this$state$medias2 : []).map(function (value) {
|
3168
|
+
return value._state();
|
3169
|
+
}).filter(function (el) {
|
3170
|
+
return !(el === null);
|
3171
|
+
});
|
3172
|
+
|
3173
|
+
if (!isEqual__default["default"](input, current) || !isEqual__default["default"]((_classPrivateMethodGe2 = _classPrivateMethodGet(this, _wrapMedia, _wrapMedia2).call(this, data.media)) === null || _classPrivateMethodGe2 === void 0 ? void 0 : _classPrivateMethodGe2._state(), (_this$state$media = this.state.media) === null || _this$state$media === void 0 ? void 0 : _this$state$media._state())) {
|
3174
|
+
var _data$medias3, _data$media2;
|
3175
|
+
|
3176
|
+
_classPrivateMethodGet(this, _assignMedias, _assignMedias2).call(this, (_data$medias3 = data.medias) !== null && _data$medias3 !== void 0 ? _data$medias3 : null, (_data$media2 = data.media) !== null && _data$media2 !== void 0 ? _data$media2 : null);
|
3177
|
+
|
3178
|
+
updateReasons.push("media");
|
3138
3179
|
}
|
3139
3180
|
|
3140
3181
|
if (updateReasons.length > 0) {
|
@@ -3152,7 +3193,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3152
3193
|
key: "getParticipant",
|
3153
3194
|
value: function () {
|
3154
3195
|
var _getParticipant = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
3155
|
-
var
|
3196
|
+
var _this3 = this;
|
3156
3197
|
|
3157
3198
|
var participant, errorMesage;
|
3158
3199
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
@@ -3168,7 +3209,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3168
3209
|
|
3169
3210
|
_context.next = 4;
|
3170
3211
|
return this.conversation.getParticipantBySid(this.state.participantSid).catch(function () {
|
3171
|
-
log$3.debug("Participant with sid \"".concat(
|
3212
|
+
log$3.debug("Participant with sid \"".concat(_this3.participantSid, "\" not found for message ").concat(_this3.sid));
|
3172
3213
|
return null;
|
3173
3214
|
});
|
3174
3215
|
|
@@ -3183,7 +3224,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3183
3224
|
|
3184
3225
|
_context.next = 8;
|
3185
3226
|
return this.conversation.getParticipantByIdentity(this.state.author).catch(function () {
|
3186
|
-
log$3.debug("Participant with identity \"".concat(
|
3227
|
+
log$3.debug("Participant with identity \"".concat(_this3.author, "\" not found for message ").concat(_this3.sid));
|
3187
3228
|
return null;
|
3188
3229
|
});
|
3189
3230
|
|
@@ -3398,7 +3439,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3398
3439
|
key: "attachTemporaryUrlsFor",
|
3399
3440
|
value: function () {
|
3400
3441
|
var _attachTemporaryUrlsFor = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(contentSet) {
|
3401
|
-
var
|
3442
|
+
var _this4 = this;
|
3402
3443
|
|
3403
3444
|
var sids;
|
3404
3445
|
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context6) {
|
@@ -3421,7 +3462,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3421
3462
|
|
3422
3463
|
case 4:
|
3423
3464
|
return _context6.abrupt("return", _context6.sent.map(function (item) {
|
3424
|
-
return new Media(item,
|
3465
|
+
return new Media(item, _this4.services);
|
3425
3466
|
}));
|
3426
3467
|
|
3427
3468
|
case 7:
|
@@ -3464,7 +3505,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3464
3505
|
}, {
|
3465
3506
|
key: "getTemporaryContentUrlsForMediaSids",
|
3466
3507
|
value: function getTemporaryContentUrlsForMediaSids(mediaSids) {
|
3467
|
-
var
|
3508
|
+
var _this5 = this;
|
3468
3509
|
|
3469
3510
|
return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
|
3470
3511
|
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7(resolve, reject, onCancel) {
|
@@ -3473,9 +3514,9 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3473
3514
|
while (1) {
|
3474
3515
|
switch (_context7.prev = _context7.next) {
|
3475
3516
|
case 0:
|
3476
|
-
mediaGetRequest =
|
3517
|
+
mediaGetRequest = _this5.services.mcsClient.mediaSetGetContentUrls(mediaSids !== null && mediaSids !== void 0 ? mediaSids : []);
|
3477
3518
|
|
3478
|
-
if (!(!
|
3519
|
+
if (!(!_this5.services.mcsClient || !mediaSids)) {
|
3479
3520
|
_context7.next = 4;
|
3480
3521
|
break;
|
3481
3522
|
}
|
@@ -3534,7 +3575,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3534
3575
|
key: "_getDetailedDeliveryReceiptsPaginator",
|
3535
3576
|
value: function () {
|
3536
3577
|
var _getDetailedDeliveryReceiptsPaginator2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8(options) {
|
3537
|
-
var
|
3578
|
+
var _this6 = this;
|
3538
3579
|
|
3539
3580
|
var messagesReceiptsUrl, url, response;
|
3540
3581
|
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context8) {
|
@@ -3551,7 +3592,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3551
3592
|
return _context8.abrupt("return", new RestPaginator(response.body.delivery_receipts.map(function (x) {
|
3552
3593
|
return new DetailedDeliveryReceipt(x);
|
3553
3594
|
}), function (pageToken, pageSize) {
|
3554
|
-
return
|
3595
|
+
return _this6._getDetailedDeliveryReceiptsPaginator({
|
3555
3596
|
pageToken: pageToken,
|
3556
3597
|
pageSize: pageSize
|
3557
3598
|
});
|
@@ -3579,7 +3620,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3579
3620
|
}, {
|
3580
3621
|
key: "getContentData",
|
3581
3622
|
value: function getContentData() {
|
3582
|
-
var
|
3623
|
+
var _this7 = this;
|
3583
3624
|
|
3584
3625
|
return new mcsClient.CancellablePromise( /*#__PURE__*/function () {
|
3585
3626
|
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9(resolve, reject, onCancel) {
|
@@ -3588,7 +3629,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3588
3629
|
while (1) {
|
3589
3630
|
switch (_context9.prev = _context9.next) {
|
3590
3631
|
case 0:
|
3591
|
-
if (!(
|
3632
|
+
if (!(_this7.state.contentSid === null)) {
|
3592
3633
|
_context9.next = 3;
|
3593
3634
|
break;
|
3594
3635
|
}
|
@@ -3597,7 +3638,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3597
3638
|
return _context9.abrupt("return");
|
3598
3639
|
|
3599
3640
|
case 3:
|
3600
|
-
bodies =
|
3641
|
+
bodies = _this7.getMediaByCategories(["body"]);
|
3601
3642
|
|
3602
3643
|
if (!(bodies === null)) {
|
3603
3644
|
_context9.next = 7;
|
@@ -3758,6 +3799,28 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3758
3799
|
return Message;
|
3759
3800
|
}(replayEventEmitter.ReplayEventEmitter);
|
3760
3801
|
|
3802
|
+
function _wrapMedia2(media) {
|
3803
|
+
var category = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
3804
|
+
return media ? category ? new Media(_objectSpread$4(_objectSpread$4({}, media), {}, {
|
3805
|
+
category: category
|
3806
|
+
}), this.services) : new Media(media, this.services) : null;
|
3807
|
+
}
|
3808
|
+
|
3809
|
+
function _assignMedias2(medias, media) {
|
3810
|
+
var _this8 = this;
|
3811
|
+
|
3812
|
+
this.state.media = _classPrivateMethodGet(this, _wrapMedia, _wrapMedia2).call(this, media); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
3813
|
+
// @ts-ignore
|
3814
|
+
|
3815
|
+
this.state.medias = medias ? medias.map(function (m) {
|
3816
|
+
return _classPrivateMethodGet(_this8, _wrapMedia, _wrapMedia2).call(_this8, m);
|
3817
|
+
}).filter(function (el) {
|
3818
|
+
return el !== null;
|
3819
|
+
}) : media && !medias ? [_classPrivateMethodGet(this, _wrapMedia, _wrapMedia2).call(this, media, "media")].filter(function (el) {
|
3820
|
+
return el !== null;
|
3821
|
+
}) : null;
|
3822
|
+
}
|
3823
|
+
|
3761
3824
|
_defineProperty__default["default"](Message, "updated", "updated");
|
3762
3825
|
|
3763
3826
|
__decorate([deprecationDecorator.deprecated("getMediaByCategory", "getMediaByCategories"), __metadata("design:type", Function), __metadata("design:paramtypes", [Array]), __metadata("design:returntype", Array)], Message.prototype, "getMediaByCategory", null);
|
@@ -7815,7 +7878,7 @@ function PushNotification(data) {
|
|
7815
7878
|
this.data = data.data || {};
|
7816
7879
|
});
|
7817
7880
|
|
7818
|
-
var version = "2.4.
|
7881
|
+
var version = "2.4.1-rc.1";
|
7819
7882
|
|
7820
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; }
|
7821
7884
|
|