@twilio/conversations 3.0.1-rc.102 → 3.0.1-rc.103
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/browser.js +357 -87
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +124 -27
- package/builds/lib.js +357 -87
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +378 -108
- package/builds/twilio-conversations.min.js +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/configuration.js +8 -4
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +6 -0
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/message-recipients-client.js +237 -0
- package/dist/message-recipients-client.js.map +1 -0
- package/dist/message.js +6 -0
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/Conversation.html +23 -0
- package/docs/classes/EmailRecipientDescriptor.html +3098 -0
- package/docs/classes/Message.html +23 -0
- package/docs/classes/UnknownRecipientDescriptor.html +3067 -0
- package/docs/index.html +41 -1
- package/docs/interfaces/ClientOptions.html +16 -0
- package/docs/modules.html +40 -0
- package/package.json +2 -2
@@ -4487,9 +4487,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
4487
4487
|
var MAXIMUM_RETRY_DELAY$1 = 4000;
|
4488
4488
|
var MAXIMUM_ATTEMPTS_COUNT = 3;
|
4489
4489
|
var RETRY_WHEN_THROTTLED = true;
|
4490
|
+
var CHANNEL_METADATA_CACHE_CAPACITY = 100;
|
4491
|
+
var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
|
4490
4492
|
|
4491
4493
|
var Configuration$1 = /*#__PURE__*/_createClass$4(function Configuration() {
|
4492
|
-
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
|
4494
|
+
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad, _options$messageRecip;
|
4493
4495
|
|
4494
4496
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4495
4497
|
var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
|
@@ -4548,7 +4550,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
4548
4550
|
this.consumptionReportInterval = toSeconds_1(parse_1(CONSUMPTION_HORIZON_SENDING_INTERVAL));
|
4549
4551
|
}
|
4550
4552
|
|
4551
|
-
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad :
|
4553
|
+
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : CHANNEL_METADATA_CACHE_CAPACITY;
|
4554
|
+
this.messageRecipientsCacheCapacity = (_options$messageRecip = options.messageRecipientsCacheCapacity) !== null && _options$messageRecip !== void 0 ? _options$messageRecip : MESSAGE_RECIPIENTS_CACHE_CAPACITY;
|
4552
4555
|
});
|
4553
4556
|
|
4554
4557
|
var wellKnownSymbol$a = wellKnownSymbol$s;
|
@@ -6685,11 +6688,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
6685
6688
|
});
|
6686
6689
|
};
|
6687
6690
|
|
6688
|
-
function _createForOfIteratorHelper$
|
6691
|
+
function _createForOfIteratorHelper$7(o, allowArrayLike) {
|
6689
6692
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
6690
6693
|
|
6691
6694
|
if (!it) {
|
6692
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$
|
6695
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$8(o)) || allowArrayLike && o && typeof o.length === "number") {
|
6693
6696
|
if (it) o = it;
|
6694
6697
|
var i = 0;
|
6695
6698
|
|
@@ -6742,16 +6745,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
6742
6745
|
};
|
6743
6746
|
}
|
6744
6747
|
|
6745
|
-
function _unsupportedIterableToArray$
|
6748
|
+
function _unsupportedIterableToArray$8(o, minLen) {
|
6746
6749
|
if (!o) return;
|
6747
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
6750
|
+
if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
|
6748
6751
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
6749
6752
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
6750
6753
|
if (n === "Map" || n === "Set") return Array.from(o);
|
6751
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
6754
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
|
6752
6755
|
}
|
6753
6756
|
|
6754
|
-
function _arrayLikeToArray$
|
6757
|
+
function _arrayLikeToArray$8(arr, len) {
|
6755
6758
|
if (len == null || len > arr.length) len = arr.length;
|
6756
6759
|
|
6757
6760
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
@@ -6767,7 +6770,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
6767
6770
|
return [false, "an array of ".concat(name)];
|
6768
6771
|
}
|
6769
6772
|
|
6770
|
-
var _iterator = _createForOfIteratorHelper$
|
6773
|
+
var _iterator = _createForOfIteratorHelper$7(value.entries()),
|
6771
6774
|
_step;
|
6772
6775
|
|
6773
6776
|
try {
|
@@ -6811,7 +6814,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
6811
6814
|
var validateTypes_1 = browser$7.validateTypes = validateTypes;
|
6812
6815
|
var validateTypesAsync_1 = browser$7.validateTypesAsync = validateTypesAsync;
|
6813
6816
|
|
6814
|
-
function _arrayLikeToArray$
|
6817
|
+
function _arrayLikeToArray$7(arr, len) {
|
6815
6818
|
if (len == null || len > arr.length) len = arr.length;
|
6816
6819
|
|
6817
6820
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
@@ -6822,20 +6825,20 @@ this.Twilio.Conversations = (function (exports) {
|
|
6822
6825
|
}
|
6823
6826
|
|
6824
6827
|
function _arrayWithoutHoles(arr) {
|
6825
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
6828
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
|
6826
6829
|
}
|
6827
6830
|
|
6828
6831
|
function _iterableToArray(iter) {
|
6829
6832
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
6830
6833
|
}
|
6831
6834
|
|
6832
|
-
function _unsupportedIterableToArray$
|
6835
|
+
function _unsupportedIterableToArray$7(o, minLen) {
|
6833
6836
|
if (!o) return;
|
6834
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
6837
|
+
if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
|
6835
6838
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
6836
6839
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
6837
6840
|
if (n === "Map" || n === "Set") return Array.from(o);
|
6838
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
6841
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
|
6839
6842
|
}
|
6840
6843
|
|
6841
6844
|
function _nonIterableSpread() {
|
@@ -6843,7 +6846,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
6843
6846
|
}
|
6844
6847
|
|
6845
6848
|
function _toConsumableArray$1(arr) {
|
6846
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$
|
6849
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread();
|
6847
6850
|
}
|
6848
6851
|
|
6849
6852
|
var json = custom_1(function (value) {
|
@@ -10006,7 +10009,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
10006
10009
|
}
|
10007
10010
|
|
10008
10011
|
function _slicedToArray$1(arr, i) {
|
10009
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$
|
10012
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$7(arr, i) || _nonIterableRest();
|
10010
10013
|
}
|
10011
10014
|
|
10012
10015
|
var internalMetadata = {exports: {}};
|
@@ -11337,11 +11340,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
11337
11340
|
browser$5.Backoff = Backoff;
|
11338
11341
|
var Retrier_1 = browser$5.Retrier = Retrier;
|
11339
11342
|
|
11340
|
-
function _createForOfIteratorHelper$
|
11343
|
+
function _createForOfIteratorHelper$6(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$6(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
11341
11344
|
|
11342
|
-
function _unsupportedIterableToArray$
|
11345
|
+
function _unsupportedIterableToArray$6(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); }
|
11343
11346
|
|
11344
|
-
function _arrayLikeToArray$
|
11347
|
+
function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
11345
11348
|
|
11346
11349
|
var Network = /*#__PURE__*/function () {
|
11347
11350
|
function Network(configuration, services) {
|
@@ -11362,7 +11365,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
11362
11365
|
}, {
|
11363
11366
|
key: "cleanupCache",
|
11364
11367
|
value: function cleanupCache() {
|
11365
|
-
var _iterator = _createForOfIteratorHelper$
|
11368
|
+
var _iterator = _createForOfIteratorHelper$6(this.cache),
|
11366
11369
|
_step;
|
11367
11370
|
|
11368
11371
|
try {
|
@@ -26172,11 +26175,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
26172
26175
|
return TreeMap;
|
26173
26176
|
}();
|
26174
26177
|
|
26175
|
-
function _createForOfIteratorHelper$
|
26178
|
+
function _createForOfIteratorHelper$5(o, allowArrayLike) {
|
26176
26179
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
26177
26180
|
|
26178
26181
|
if (!it) {
|
26179
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$
|
26182
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") {
|
26180
26183
|
if (it) o = it;
|
26181
26184
|
var i = 0;
|
26182
26185
|
|
@@ -26229,16 +26232,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
26229
26232
|
};
|
26230
26233
|
}
|
26231
26234
|
|
26232
|
-
function _unsupportedIterableToArray$
|
26235
|
+
function _unsupportedIterableToArray$5(o, minLen) {
|
26233
26236
|
if (!o) return;
|
26234
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
26237
|
+
if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
|
26235
26238
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
26236
26239
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
26237
26240
|
if (n === "Map" || n === "Set") return Array.from(o);
|
26238
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
26241
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
|
26239
26242
|
}
|
26240
26243
|
|
26241
|
-
function _arrayLikeToArray$
|
26244
|
+
function _arrayLikeToArray$5(arr, len) {
|
26242
26245
|
if (len == null || len > arr.length) len = arr.length;
|
26243
26246
|
|
26244
26247
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
@@ -26345,7 +26348,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
26345
26348
|
key: "forEach",
|
26346
26349
|
value: function forEach(callbackfn) {
|
26347
26350
|
if (this.items) {
|
26348
|
-
var _iterator = _createForOfIteratorHelper$
|
26351
|
+
var _iterator = _createForOfIteratorHelper$5(this.items),
|
26349
26352
|
_step;
|
26350
26353
|
|
26351
26354
|
try {
|
@@ -37931,6 +37934,38 @@ this.Twilio.Conversations = (function (exports) {
|
|
37931
37934
|
|
37932
37935
|
return getChannelMetadata;
|
37933
37936
|
}()
|
37937
|
+
/**
|
37938
|
+
* Get recipients of the message.
|
37939
|
+
*/
|
37940
|
+
|
37941
|
+
}, {
|
37942
|
+
key: "getMessageRecipients",
|
37943
|
+
value: function () {
|
37944
|
+
var _getMessageRecipients = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11() {
|
37945
|
+
return _regeneratorRuntime$1.wrap(function _callee11$(_context11) {
|
37946
|
+
while (1) {
|
37947
|
+
switch (_context11.prev = _context11.next) {
|
37948
|
+
case 0:
|
37949
|
+
_context11.next = 2;
|
37950
|
+
return this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid, this.sid);
|
37951
|
+
|
37952
|
+
case 2:
|
37953
|
+
return _context11.abrupt("return", _context11.sent);
|
37954
|
+
|
37955
|
+
case 3:
|
37956
|
+
case "end":
|
37957
|
+
return _context11.stop();
|
37958
|
+
}
|
37959
|
+
}
|
37960
|
+
}, _callee11, this);
|
37961
|
+
}));
|
37962
|
+
|
37963
|
+
function getMessageRecipients() {
|
37964
|
+
return _getMessageRecipients.apply(this, arguments);
|
37965
|
+
}
|
37966
|
+
|
37967
|
+
return getMessageRecipients;
|
37968
|
+
}()
|
37934
37969
|
}]);
|
37935
37970
|
|
37936
37971
|
return Message;
|
@@ -37958,11 +37993,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
37958
37993
|
|
37959
37994
|
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty$3(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
37960
37995
|
|
37961
|
-
function _createForOfIteratorHelper$
|
37996
|
+
function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
37962
37997
|
|
37963
|
-
function _unsupportedIterableToArray$
|
37998
|
+
function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
|
37964
37999
|
|
37965
|
-
function _arrayLikeToArray$
|
38000
|
+
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
37966
38001
|
|
37967
38002
|
function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
|
37968
38003
|
|
@@ -38170,7 +38205,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38170
38205
|
return request.cancel();
|
38171
38206
|
});
|
38172
38207
|
});
|
38173
|
-
_iterator = _createForOfIteratorHelper$
|
38208
|
+
_iterator = _createForOfIteratorHelper$4(message.mediaContent);
|
38174
38209
|
_context3.prev = 4;
|
38175
38210
|
|
38176
38211
|
_iterator.s();
|
@@ -38823,11 +38858,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
38823
38858
|
|
38824
38859
|
__decorate$1([validateTypes_1([FormData, sendMediaOptions]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
|
38825
38860
|
|
38826
|
-
function _createForOfIteratorHelper$
|
38861
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
38827
38862
|
|
38828
|
-
function _unsupportedIterableToArray$
|
38863
|
+
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
38829
38864
|
|
38830
|
-
function _arrayLikeToArray$
|
38865
|
+
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
38831
38866
|
|
38832
38867
|
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
|
38833
38868
|
|
@@ -40113,6 +40148,38 @@ this.Twilio.Conversations = (function (exports) {
|
|
40113
40148
|
|
40114
40149
|
return updateUniqueName;
|
40115
40150
|
}()
|
40151
|
+
/**
|
40152
|
+
* Get recipients of all messages in the conversation.
|
40153
|
+
*/
|
40154
|
+
|
40155
|
+
}, {
|
40156
|
+
key: "getMessageRecipients",
|
40157
|
+
value: function () {
|
40158
|
+
var _getMessageRecipients = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee24() {
|
40159
|
+
return _regeneratorRuntime$1.wrap(function _callee24$(_context24) {
|
40160
|
+
while (1) {
|
40161
|
+
switch (_context24.prev = _context24.next) {
|
40162
|
+
case 0:
|
40163
|
+
_context24.next = 2;
|
40164
|
+
return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid);
|
40165
|
+
|
40166
|
+
case 2:
|
40167
|
+
return _context24.abrupt("return", _context24.sent);
|
40168
|
+
|
40169
|
+
case 3:
|
40170
|
+
case "end":
|
40171
|
+
return _context24.stop();
|
40172
|
+
}
|
40173
|
+
}
|
40174
|
+
}, _callee24, this);
|
40175
|
+
}));
|
40176
|
+
|
40177
|
+
function getMessageRecipients() {
|
40178
|
+
return _getMessageRecipients.apply(this, arguments);
|
40179
|
+
}
|
40180
|
+
|
40181
|
+
return getMessageRecipients;
|
40182
|
+
}()
|
40116
40183
|
/**
|
40117
40184
|
* Load and subscribe to this conversation and do not subscribe to its
|
40118
40185
|
* participants and messages. This or _subscribeStreams will need to be called
|
@@ -40123,31 +40190,31 @@ this.Twilio.Conversations = (function (exports) {
|
|
40123
40190
|
}, {
|
40124
40191
|
key: "_subscribe",
|
40125
40192
|
value: function () {
|
40126
|
-
var _subscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function
|
40193
|
+
var _subscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee25() {
|
40127
40194
|
var _this2 = this;
|
40128
40195
|
|
40129
|
-
return _regeneratorRuntime$1.wrap(function
|
40196
|
+
return _regeneratorRuntime$1.wrap(function _callee25$(_context25) {
|
40130
40197
|
while (1) {
|
40131
|
-
switch (
|
40198
|
+
switch (_context25.prev = _context25.next) {
|
40132
40199
|
case 0:
|
40133
40200
|
if (!this._entityPromise) {
|
40134
|
-
|
40201
|
+
_context25.next = 2;
|
40135
40202
|
break;
|
40136
40203
|
}
|
40137
40204
|
|
40138
|
-
return
|
40205
|
+
return _context25.abrupt("return", this._entityPromise);
|
40139
40206
|
|
40140
40207
|
case 2:
|
40141
40208
|
this._entityPromise = this._services.syncClient.document({
|
40142
40209
|
id: this._entityName,
|
40143
40210
|
mode: "open_existing"
|
40144
40211
|
});
|
40145
|
-
|
40146
|
-
|
40212
|
+
_context25.prev = 3;
|
40213
|
+
_context25.next = 6;
|
40147
40214
|
return this._entityPromise;
|
40148
40215
|
|
40149
40216
|
case 6:
|
40150
|
-
this._entity =
|
40217
|
+
this._entity = _context25.sent;
|
40151
40218
|
|
40152
40219
|
this._entity.on("updated", function (args) {
|
40153
40220
|
return _this2._update(args.data);
|
@@ -40159,28 +40226,28 @@ this.Twilio.Conversations = (function (exports) {
|
|
40159
40226
|
|
40160
40227
|
this._update(this._entity.data);
|
40161
40228
|
|
40162
|
-
return
|
40229
|
+
return _context25.abrupt("return", this._entity);
|
40163
40230
|
|
40164
40231
|
case 13:
|
40165
|
-
|
40166
|
-
|
40232
|
+
_context25.prev = 13;
|
40233
|
+
_context25.t0 = _context25["catch"](3);
|
40167
40234
|
this._entity = null;
|
40168
40235
|
this._entityPromise = null;
|
40169
40236
|
|
40170
40237
|
if (this._services.syncClient.connectionState != "disconnected") {
|
40171
|
-
Conversation._logger.error("Failed to get conversation object",
|
40238
|
+
Conversation._logger.error("Failed to get conversation object", _context25.t0);
|
40172
40239
|
}
|
40173
40240
|
|
40174
|
-
Conversation._logger.debug("ERROR: Failed to get conversation object",
|
40241
|
+
Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
|
40175
40242
|
|
40176
|
-
throw
|
40243
|
+
throw _context25.t0;
|
40177
40244
|
|
40178
40245
|
case 20:
|
40179
40246
|
case "end":
|
40180
|
-
return
|
40247
|
+
return _context25.stop();
|
40181
40248
|
}
|
40182
40249
|
}
|
40183
|
-
},
|
40250
|
+
}, _callee25, this, [[3, 13]]);
|
40184
40251
|
}));
|
40185
40252
|
|
40186
40253
|
function _subscribe() {
|
@@ -40202,44 +40269,44 @@ this.Twilio.Conversations = (function (exports) {
|
|
40202
40269
|
}, {
|
40203
40270
|
key: "_fetchStreams",
|
40204
40271
|
value: function () {
|
40205
|
-
var _fetchStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function
|
40272
|
+
var _fetchStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee26() {
|
40206
40273
|
var _this$_entity, _this$_entity2;
|
40207
40274
|
|
40208
40275
|
var data;
|
40209
|
-
return _regeneratorRuntime$1.wrap(function
|
40276
|
+
return _regeneratorRuntime$1.wrap(function _callee26$(_context26) {
|
40210
40277
|
while (1) {
|
40211
|
-
switch (
|
40278
|
+
switch (_context26.prev = _context26.next) {
|
40212
40279
|
case 0:
|
40213
|
-
|
40280
|
+
_context26.next = 2;
|
40214
40281
|
return this._subscribe();
|
40215
40282
|
|
40216
40283
|
case 2:
|
40217
40284
|
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
40218
40285
|
|
40219
40286
|
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
40220
|
-
|
40287
|
+
_context26.next = 6;
|
40221
40288
|
return this._services.syncClient.list({
|
40222
40289
|
id: data.messages,
|
40223
40290
|
mode: "open_existing"
|
40224
40291
|
});
|
40225
40292
|
|
40226
40293
|
case 6:
|
40227
|
-
this._messagesList =
|
40228
|
-
|
40294
|
+
this._messagesList = _context26.sent;
|
40295
|
+
_context26.next = 9;
|
40229
40296
|
return this._services.syncClient.map({
|
40230
40297
|
id: data.roster,
|
40231
40298
|
mode: "open_existing"
|
40232
40299
|
});
|
40233
40300
|
|
40234
40301
|
case 9:
|
40235
|
-
this._participantsMap =
|
40302
|
+
this._participantsMap = _context26.sent;
|
40236
40303
|
|
40237
40304
|
case 10:
|
40238
40305
|
case "end":
|
40239
|
-
return
|
40306
|
+
return _context26.stop();
|
40240
40307
|
}
|
40241
40308
|
}
|
40242
|
-
},
|
40309
|
+
}, _callee26, this);
|
40243
40310
|
}));
|
40244
40311
|
|
40245
40312
|
function _fetchStreams() {
|
@@ -40259,15 +40326,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
40259
40326
|
}, {
|
40260
40327
|
key: "_subscribeStreams",
|
40261
40328
|
value: function () {
|
40262
|
-
var _subscribeStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function
|
40329
|
+
var _subscribeStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee27() {
|
40263
40330
|
var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
|
40264
40331
|
|
40265
|
-
return _regeneratorRuntime$1.wrap(function
|
40332
|
+
return _regeneratorRuntime$1.wrap(function _callee27$(_context27) {
|
40266
40333
|
while (1) {
|
40267
|
-
switch (
|
40334
|
+
switch (_context27.prev = _context27.next) {
|
40268
40335
|
case 0:
|
40269
|
-
|
40270
|
-
|
40336
|
+
_context27.prev = 0;
|
40337
|
+
_context27.next = 3;
|
40271
40338
|
return this._subscribe();
|
40272
40339
|
|
40273
40340
|
case 3:
|
@@ -40276,31 +40343,31 @@ this.Twilio.Conversations = (function (exports) {
|
|
40276
40343
|
data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
|
40277
40344
|
messagesObjectName = data.messages;
|
40278
40345
|
rosterObjectName = data.roster;
|
40279
|
-
|
40346
|
+
_context27.next = 9;
|
40280
40347
|
return Promise.all([this._messagesEntity.subscribe((_this$_messagesList = this._messagesList) !== null && _this$_messagesList !== void 0 ? _this$_messagesList : messagesObjectName), this._participantsEntity.subscribe((_this$_participantsMa = this._participantsMap) !== null && _this$_participantsMa !== void 0 ? _this$_participantsMa : rosterObjectName)]);
|
40281
40348
|
|
40282
40349
|
case 9:
|
40283
|
-
|
40350
|
+
_context27.next = 16;
|
40284
40351
|
break;
|
40285
40352
|
|
40286
40353
|
case 11:
|
40287
|
-
|
40288
|
-
|
40354
|
+
_context27.prev = 11;
|
40355
|
+
_context27.t0 = _context27["catch"](0);
|
40289
40356
|
|
40290
40357
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
40291
|
-
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid,
|
40358
|
+
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
40292
40359
|
}
|
40293
40360
|
|
40294
|
-
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid,
|
40361
|
+
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
40295
40362
|
|
40296
|
-
throw
|
40363
|
+
throw _context27.t0;
|
40297
40364
|
|
40298
40365
|
case 16:
|
40299
40366
|
case "end":
|
40300
|
-
return
|
40367
|
+
return _context27.stop();
|
40301
40368
|
}
|
40302
40369
|
}
|
40303
|
-
},
|
40370
|
+
}, _callee27, this, [[0, 11]]);
|
40304
40371
|
}));
|
40305
40372
|
|
40306
40373
|
function _subscribeStreams() {
|
@@ -40317,17 +40384,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
40317
40384
|
}, {
|
40318
40385
|
key: "_unsubscribe",
|
40319
40386
|
value: function () {
|
40320
|
-
var _unsubscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function
|
40321
|
-
return _regeneratorRuntime$1.wrap(function
|
40387
|
+
var _unsubscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee28() {
|
40388
|
+
return _regeneratorRuntime$1.wrap(function _callee28$(_context28) {
|
40322
40389
|
while (1) {
|
40323
|
-
switch (
|
40390
|
+
switch (_context28.prev = _context28.next) {
|
40324
40391
|
case 0:
|
40325
40392
|
if (!this._entity) {
|
40326
|
-
|
40393
|
+
_context28.next = 5;
|
40327
40394
|
break;
|
40328
40395
|
}
|
40329
40396
|
|
40330
|
-
|
40397
|
+
_context28.next = 3;
|
40331
40398
|
return this._entity.close();
|
40332
40399
|
|
40333
40400
|
case 3:
|
@@ -40335,14 +40402,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
40335
40402
|
this._entityPromise = null;
|
40336
40403
|
|
40337
40404
|
case 5:
|
40338
|
-
return
|
40405
|
+
return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
40339
40406
|
|
40340
40407
|
case 6:
|
40341
40408
|
case "end":
|
40342
|
-
return
|
40409
|
+
return _context28.stop();
|
40343
40410
|
}
|
40344
40411
|
}
|
40345
|
-
},
|
40412
|
+
}, _callee28, this);
|
40346
40413
|
}));
|
40347
40414
|
|
40348
40415
|
function _unsubscribe() {
|
@@ -40519,7 +40586,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40519
40586
|
}, {
|
40520
40587
|
key: "_onMessageAdded",
|
40521
40588
|
value: function _onMessageAdded(message) {
|
40522
|
-
var _iterator = _createForOfIteratorHelper$
|
40589
|
+
var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
|
40523
40590
|
_step;
|
40524
40591
|
|
40525
40592
|
try {
|
@@ -40548,27 +40615,27 @@ this.Twilio.Conversations = (function (exports) {
|
|
40548
40615
|
}, {
|
40549
40616
|
key: "_setLastReadMessageIndex",
|
40550
40617
|
value: function () {
|
40551
|
-
var _setLastReadMessageIndex2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function
|
40618
|
+
var _setLastReadMessageIndex2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee29(index) {
|
40552
40619
|
var result;
|
40553
|
-
return _regeneratorRuntime$1.wrap(function
|
40620
|
+
return _regeneratorRuntime$1.wrap(function _callee29$(_context29) {
|
40554
40621
|
while (1) {
|
40555
|
-
switch (
|
40622
|
+
switch (_context29.prev = _context29.next) {
|
40556
40623
|
case 0:
|
40557
|
-
|
40624
|
+
_context29.next = 2;
|
40558
40625
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
40559
40626
|
last_read_message_index: index
|
40560
40627
|
});
|
40561
40628
|
|
40562
40629
|
case 2:
|
40563
|
-
result =
|
40564
|
-
return
|
40630
|
+
result = _context29.sent;
|
40631
|
+
return _context29.abrupt("return", result.unread_messages_count);
|
40565
40632
|
|
40566
40633
|
case 4:
|
40567
40634
|
case "end":
|
40568
|
-
return
|
40635
|
+
return _context29.stop();
|
40569
40636
|
}
|
40570
40637
|
}
|
40571
|
-
},
|
40638
|
+
}, _callee29, this);
|
40572
40639
|
}));
|
40573
40640
|
|
40574
40641
|
function _setLastReadMessageIndex(_x19) {
|
@@ -40727,11 +40794,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
40727
40794
|
return Deferred;
|
40728
40795
|
}();
|
40729
40796
|
|
40730
|
-
function _createForOfIteratorHelper$
|
40797
|
+
function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
40731
40798
|
|
40732
|
-
function _unsupportedIterableToArray$
|
40799
|
+
function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
|
40733
40800
|
|
40734
|
-
function _arrayLikeToArray$
|
40801
|
+
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
40735
40802
|
|
40736
40803
|
function ownKeys$2(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; }
|
40737
40804
|
|
@@ -40911,7 +40978,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40911
40978
|
case 9:
|
40912
40979
|
myConversations = _context2.sent;
|
40913
40980
|
upserts = [];
|
40914
|
-
_iterator = _createForOfIteratorHelper$
|
40981
|
+
_iterator = _createForOfIteratorHelper$2(myConversations);
|
40915
40982
|
|
40916
40983
|
try {
|
40917
40984
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
@@ -42014,7 +42081,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
42014
42081
|
this.data = data.data || {};
|
42015
42082
|
});
|
42016
42083
|
|
42017
|
-
var version = "3.0.1-rc.
|
42084
|
+
var version = "3.0.1-rc.103";
|
42018
42085
|
|
42019
42086
|
function _isNativeFunction(fn) {
|
42020
42087
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
@@ -42501,11 +42568,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
42501
42568
|
return ContentClient;
|
42502
42569
|
}();
|
42503
42570
|
|
42504
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
42571
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
42505
42572
|
|
42506
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
42573
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
42507
42574
|
|
42508
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
42575
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
42509
42576
|
|
42510
42577
|
var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
42511
42578
|
function QuickLRU() {
|
@@ -42534,7 +42601,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
42534
42601
|
this._size = 0;
|
42535
42602
|
|
42536
42603
|
if (typeof this.onEviction === 'function') {
|
42537
|
-
var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
|
42604
|
+
var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
|
42538
42605
|
_step;
|
42539
42606
|
|
42540
42607
|
try {
|
@@ -42626,7 +42693,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
42626
42693
|
while (1) {
|
42627
42694
|
switch (_context.prev = _context.next) {
|
42628
42695
|
case 0:
|
42629
|
-
_iterator2 = _createForOfIteratorHelper(this);
|
42696
|
+
_iterator2 = _createForOfIteratorHelper$1(this);
|
42630
42697
|
_context.prev = 1;
|
42631
42698
|
|
42632
42699
|
_iterator2.s();
|
@@ -42678,7 +42745,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
42678
42745
|
while (1) {
|
42679
42746
|
switch (_context2.prev = _context2.next) {
|
42680
42747
|
case 0:
|
42681
|
-
_iterator3 = _createForOfIteratorHelper(this);
|
42748
|
+
_iterator3 = _createForOfIteratorHelper$1(this);
|
42682
42749
|
_context2.prev = 1;
|
42683
42750
|
|
42684
42751
|
_iterator3.s();
|
@@ -42730,7 +42797,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
42730
42797
|
while (1) {
|
42731
42798
|
switch (_context3.prev = _context3.next) {
|
42732
42799
|
case 0:
|
42733
|
-
_iterator4 = _createForOfIteratorHelper(this.cache);
|
42800
|
+
_iterator4 = _createForOfIteratorHelper$1(this.cache);
|
42734
42801
|
_context3.prev = 1;
|
42735
42802
|
|
42736
42803
|
_iterator4.s();
|
@@ -42767,7 +42834,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
42767
42834
|
return _context3.finish(14);
|
42768
42835
|
|
42769
42836
|
case 17:
|
42770
|
-
_iterator5 = _createForOfIteratorHelper(this.oldCache);
|
42837
|
+
_iterator5 = _createForOfIteratorHelper$1(this.oldCache);
|
42771
42838
|
_context3.prev = 18;
|
42772
42839
|
|
42773
42840
|
_iterator5.s();
|
@@ -42822,7 +42889,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
42822
42889
|
get: function get() {
|
42823
42890
|
var oldCacheSize = 0;
|
42824
42891
|
|
42825
|
-
var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
|
42892
|
+
var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
|
42826
42893
|
_step6;
|
42827
42894
|
|
42828
42895
|
try {
|
@@ -42959,6 +43026,206 @@ this.Twilio.Conversations = (function (exports) {
|
|
42959
43026
|
return ChannelMetadataClient;
|
42960
43027
|
}();
|
42961
43028
|
|
43029
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
43030
|
+
|
43031
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
43032
|
+
|
43033
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
43034
|
+
/**
|
43035
|
+
* Email recipient descriptor.
|
43036
|
+
*/
|
43037
|
+
|
43038
|
+
var EmailRecipientDescriptor = /*#__PURE__*/_createClass$4(
|
43039
|
+
/**
|
43040
|
+
* Type of recipient.
|
43041
|
+
*/
|
43042
|
+
|
43043
|
+
/**
|
43044
|
+
* @internal
|
43045
|
+
*/
|
43046
|
+
function EmailRecipientDescriptor(recipient) {
|
43047
|
+
_classCallCheck$4(this, EmailRecipientDescriptor);
|
43048
|
+
|
43049
|
+
_defineProperty$3(this, "type", "email");
|
43050
|
+
|
43051
|
+
this.messageSid = recipient.message_sid;
|
43052
|
+
this.level = recipient.level;
|
43053
|
+
this.name = recipient.name;
|
43054
|
+
this.address = recipient.address;
|
43055
|
+
});
|
43056
|
+
/**
|
43057
|
+
* Unknown recipient descriptor. Used to be able to handle recipient types that
|
43058
|
+
* are not supported by the current version of the SDK.
|
43059
|
+
*/
|
43060
|
+
|
43061
|
+
|
43062
|
+
var UnknownRecipientDescriptor = /*#__PURE__*/_createClass$4(
|
43063
|
+
/**
|
43064
|
+
* Type of recipient.
|
43065
|
+
*/
|
43066
|
+
|
43067
|
+
/**
|
43068
|
+
* Sid of the message that this recipient belongs to.
|
43069
|
+
*/
|
43070
|
+
|
43071
|
+
/**
|
43072
|
+
* Recipient data as a JSON string.
|
43073
|
+
*/
|
43074
|
+
|
43075
|
+
/**
|
43076
|
+
* @internal
|
43077
|
+
*/
|
43078
|
+
function UnknownRecipientDescriptor(recipient) {
|
43079
|
+
_classCallCheck$4(this, UnknownRecipientDescriptor);
|
43080
|
+
|
43081
|
+
this.type = recipient.type;
|
43082
|
+
this.messageSid = recipient.message_sid;
|
43083
|
+
this.rawData = JSON.stringify(recipient);
|
43084
|
+
});
|
43085
|
+
|
43086
|
+
var MessageRecipientsClient = /*#__PURE__*/function () {
|
43087
|
+
function MessageRecipientsClient(services, configuration) {
|
43088
|
+
_classCallCheck$4(this, MessageRecipientsClient);
|
43089
|
+
|
43090
|
+
this._services = services;
|
43091
|
+
this._configuration = configuration;
|
43092
|
+
this._cache = new quickLru({
|
43093
|
+
maxSize: configuration.messageRecipientsCacheCapacity
|
43094
|
+
});
|
43095
|
+
}
|
43096
|
+
|
43097
|
+
_createClass$4(MessageRecipientsClient, [{
|
43098
|
+
key: "getRecipientsFromMessage",
|
43099
|
+
value: function () {
|
43100
|
+
var _getRecipientsFromMessage = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(conversationSid, messageSid) {
|
43101
|
+
var _this = this;
|
43102
|
+
|
43103
|
+
var key, cachedItem, url, recipientsResponse, recipients;
|
43104
|
+
return _regeneratorRuntime$1.wrap(function _callee$(_context) {
|
43105
|
+
while (1) {
|
43106
|
+
switch (_context.prev = _context.next) {
|
43107
|
+
case 0:
|
43108
|
+
key = "".concat(conversationSid, ",").concat(messageSid);
|
43109
|
+
cachedItem = this._cache.get(key);
|
43110
|
+
|
43111
|
+
if (!cachedItem) {
|
43112
|
+
_context.next = 4;
|
43113
|
+
break;
|
43114
|
+
}
|
43115
|
+
|
43116
|
+
return _context.abrupt("return", cachedItem.item);
|
43117
|
+
|
43118
|
+
case 4:
|
43119
|
+
url = new UriBuilder$1(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("MessageSid", messageSid).build();
|
43120
|
+
_context.next = 7;
|
43121
|
+
return this._services.commandExecutor.fetchResource(url);
|
43122
|
+
|
43123
|
+
case 7:
|
43124
|
+
recipientsResponse = _context.sent;
|
43125
|
+
recipients = recipientsResponse.message_recipients.map(function (recipient) {
|
43126
|
+
return _this._wrapResponse(recipient);
|
43127
|
+
});
|
43128
|
+
|
43129
|
+
if (recipients.length > 0) {
|
43130
|
+
this._cache.set(key, {
|
43131
|
+
item: recipients
|
43132
|
+
});
|
43133
|
+
}
|
43134
|
+
|
43135
|
+
return _context.abrupt("return", recipients);
|
43136
|
+
|
43137
|
+
case 11:
|
43138
|
+
case "end":
|
43139
|
+
return _context.stop();
|
43140
|
+
}
|
43141
|
+
}
|
43142
|
+
}, _callee, this);
|
43143
|
+
}));
|
43144
|
+
|
43145
|
+
function getRecipientsFromMessage(_x, _x2) {
|
43146
|
+
return _getRecipientsFromMessage.apply(this, arguments);
|
43147
|
+
}
|
43148
|
+
|
43149
|
+
return getRecipientsFromMessage;
|
43150
|
+
}()
|
43151
|
+
}, {
|
43152
|
+
key: "getRecipientsFromConversation",
|
43153
|
+
value: function () {
|
43154
|
+
var _getRecipientsFromConversation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(conversationSid, paginatorOptions) {
|
43155
|
+
var _paginatorOptions$pag,
|
43156
|
+
_paginatorOptions$pag2,
|
43157
|
+
_this2 = this;
|
43158
|
+
|
43159
|
+
var url, recipientsResponse, allRecipients, _iterator, _step, _this$_cache$get$item, _this$_cache$get, recipient, key, existingMessageRecipients;
|
43160
|
+
|
43161
|
+
return _regeneratorRuntime$1.wrap(function _callee2$(_context2) {
|
43162
|
+
while (1) {
|
43163
|
+
switch (_context2.prev = _context2.next) {
|
43164
|
+
case 0:
|
43165
|
+
url = new UriBuilder$1(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("PageToken", (_paginatorOptions$pag = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageToken) !== null && _paginatorOptions$pag !== void 0 ? _paginatorOptions$pag : "").arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : "").build();
|
43166
|
+
_context2.next = 3;
|
43167
|
+
return this._services.commandExecutor.fetchResource(url);
|
43168
|
+
|
43169
|
+
case 3:
|
43170
|
+
recipientsResponse = _context2.sent;
|
43171
|
+
allRecipients = recipientsResponse.message_recipients.map(function (recipient) {
|
43172
|
+
return _this2._wrapResponse(recipient);
|
43173
|
+
});
|
43174
|
+
_iterator = _createForOfIteratorHelper(allRecipients);
|
43175
|
+
|
43176
|
+
try {
|
43177
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
43178
|
+
recipient = _step.value;
|
43179
|
+
key = "".concat(conversationSid, ",").concat(recipient.messageSid);
|
43180
|
+
existingMessageRecipients = (_this$_cache$get$item = (_this$_cache$get = this._cache.get(key)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get.item) !== null && _this$_cache$get$item !== void 0 ? _this$_cache$get$item : [];
|
43181
|
+
|
43182
|
+
this._cache.set(key, {
|
43183
|
+
item: [].concat(_toConsumableArray$1(existingMessageRecipients), [recipient])
|
43184
|
+
});
|
43185
|
+
}
|
43186
|
+
} catch (err) {
|
43187
|
+
_iterator.e(err);
|
43188
|
+
} finally {
|
43189
|
+
_iterator.f();
|
43190
|
+
}
|
43191
|
+
|
43192
|
+
return _context2.abrupt("return", new RestPaginator(allRecipients, function (pageToken, pageSize) {
|
43193
|
+
return _this2.getRecipientsFromConversation(conversationSid, {
|
43194
|
+
pageToken: pageToken,
|
43195
|
+
pageSize: pageSize
|
43196
|
+
});
|
43197
|
+
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
|
43198
|
+
|
43199
|
+
case 8:
|
43200
|
+
case "end":
|
43201
|
+
return _context2.stop();
|
43202
|
+
}
|
43203
|
+
}
|
43204
|
+
}, _callee2, this);
|
43205
|
+
}));
|
43206
|
+
|
43207
|
+
function getRecipientsFromConversation(_x3, _x4) {
|
43208
|
+
return _getRecipientsFromConversation.apply(this, arguments);
|
43209
|
+
}
|
43210
|
+
|
43211
|
+
return getRecipientsFromConversation;
|
43212
|
+
}()
|
43213
|
+
}, {
|
43214
|
+
key: "_wrapResponse",
|
43215
|
+
value: function _wrapResponse(recipient) {
|
43216
|
+
switch (recipient.type) {
|
43217
|
+
case "email":
|
43218
|
+
return new EmailRecipientDescriptor(recipient);
|
43219
|
+
|
43220
|
+
default:
|
43221
|
+
return new UnknownRecipientDescriptor(recipient);
|
43222
|
+
}
|
43223
|
+
}
|
43224
|
+
}]);
|
43225
|
+
|
43226
|
+
return MessageRecipientsClient;
|
43227
|
+
}();
|
43228
|
+
|
42962
43229
|
var _class;
|
42963
43230
|
|
42964
43231
|
function ownKeys(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; }
|
@@ -44180,6 +44447,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
44180
44447
|
configurationResponse = _context17.sent;
|
44181
44448
|
this._configuration = new Configuration$1(this._options, configurationResponse, Client_1._logger);
|
44182
44449
|
this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
|
44450
|
+
this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
|
44183
44451
|
|
44184
44452
|
this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
|
44185
44453
|
|
@@ -44258,10 +44526,10 @@ this.Twilio.Conversations = (function (exports) {
|
|
44258
44526
|
}).catch(function (error) {
|
44259
44527
|
throw error;
|
44260
44528
|
});
|
44261
|
-
_context17.next =
|
44529
|
+
_context17.next = 30;
|
44262
44530
|
return this._services.users.myself._ensureFetched();
|
44263
44531
|
|
44264
|
-
case
|
44532
|
+
case 30:
|
44265
44533
|
Client_1._supportedPushChannels.forEach(function (channelType) {
|
44266
44534
|
return _this3._subscribeToPushNotifications(channelType);
|
44267
44535
|
});
|
@@ -44277,7 +44545,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
44277
44545
|
this.emit("stateChanged", "initialized");
|
44278
44546
|
this.emit("initialized");
|
44279
44547
|
|
44280
|
-
case
|
44548
|
+
case 36:
|
44281
44549
|
case "end":
|
44282
44550
|
return _context17.stop();
|
44283
44551
|
}
|
@@ -44534,6 +44802,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
44534
44802
|
exports.ContentTemplateVariable = ContentTemplateVariable;
|
44535
44803
|
exports.Conversation = Conversation;
|
44536
44804
|
exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
|
44805
|
+
exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
|
44537
44806
|
exports.Media = Media;
|
44538
44807
|
exports.Message = Message;
|
44539
44808
|
exports.MessageBuilder = MessageBuilder;
|
@@ -44541,6 +44810,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
44541
44810
|
exports.Participant = Participant;
|
44542
44811
|
exports.PushNotification = PushNotification;
|
44543
44812
|
exports.RestPaginator = RestPaginator;
|
44813
|
+
exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
|
44544
44814
|
exports.UnsentMessage = UnsentMessage;
|
44545
44815
|
exports.User = User;
|
44546
44816
|
|