@twilio/conversations 2.1.0-rc.1 → 2.1.0-rc.8
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/CHANGELOG.md +60 -0
- package/NOTICE.txt +679 -0
- package/builds/browser.js +674 -587
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +319 -122
- package/builds/lib.js +674 -587
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +852 -909
- package/builds/twilio-conversations.min.js +2 -14
- package/dist/aggregated-delivery-receipt.js +6 -1
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/client.js +165 -142
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +16 -14
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +14 -10
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +212 -153
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +81 -77
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +42 -38
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +93 -75
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +24 -22
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +1 -1
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/interfaces/attributes.js +4 -4
- package/dist/interfaces/attributes.js.map +1 -1
- package/dist/interfaces/notification-types.js +5 -5
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/logger.js +36 -15
- package/dist/logger.js.map +1 -1
- package/dist/media.js +21 -9
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +10 -9
- package/dist/message-builder.js.map +1 -1
- package/dist/message.js +131 -83
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/participant.js +85 -51
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +16 -6
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js +18 -14
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +20 -17
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +85 -59
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +3 -1
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +6 -6
- package/dist/util/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/AggregatedDeliveryReceipt.html +0 -117
- package/docs/classes/Client.html +24 -147
- package/docs/classes/Conversation.html +30 -147
- package/docs/classes/DetailedDeliveryReceipt.html +1 -118
- package/docs/classes/Media.html +0 -117
- package/docs/classes/Message.html +7 -124
- package/docs/classes/MessageBuilder.html +2 -119
- package/docs/classes/Participant.html +7 -124
- package/docs/classes/PushNotification.html +0 -117
- package/docs/classes/RestPaginator.html +0 -117
- package/docs/classes/UnsentMessage.html +0 -117
- package/docs/classes/User.html +7 -124
- package/docs/index.html +60 -0
- package/docs/interfaces/ClientOptions.html +0 -117
- package/docs/interfaces/ConversationBindings.html +0 -117
- package/docs/interfaces/ConversationEmailBinding.html +0 -117
- package/docs/interfaces/ConversationLimits.html +3098 -0
- package/docs/interfaces/ConversationState.html +0 -117
- package/docs/interfaces/CreateConversationOptions.html +1 -118
- package/docs/interfaces/LastMessage.html +0 -117
- package/docs/interfaces/Paginator.html +0 -117
- package/docs/interfaces/ParticipantBindings.html +0 -117
- package/docs/interfaces/ParticipantEmailBinding.html +0 -117
- package/docs/interfaces/PushNotificationData.html +0 -117
- package/docs/interfaces/SendEmailOptions.html +0 -117
- package/docs/interfaces/SendMediaOptions.html +0 -117
- package/docs/modules.html +60 -0
- package/package.json +23 -17
@@ -1730,7 +1730,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
1730
1730
|
};
|
1731
1731
|
}
|
1732
1732
|
|
1733
|
-
function _defineProperties
|
1733
|
+
function _defineProperties(target, props) {
|
1734
1734
|
for (var i = 0; i < props.length; i++) {
|
1735
1735
|
var descriptor = props[i];
|
1736
1736
|
descriptor.enumerable = descriptor.enumerable || false;
|
@@ -1741,8 +1741,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
1741
1741
|
}
|
1742
1742
|
|
1743
1743
|
function _createClass$3(Constructor, protoProps, staticProps) {
|
1744
|
-
if (protoProps) _defineProperties
|
1745
|
-
if (staticProps) _defineProperties
|
1744
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
1745
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
1746
1746
|
return Constructor;
|
1747
1747
|
}
|
1748
1748
|
|
@@ -1754,13 +1754,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
1754
1754
|
return self;
|
1755
1755
|
}
|
1756
1756
|
|
1757
|
-
function _setPrototypeOf
|
1758
|
-
_setPrototypeOf
|
1757
|
+
function _setPrototypeOf(o, p) {
|
1758
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
1759
1759
|
o.__proto__ = p;
|
1760
1760
|
return o;
|
1761
1761
|
};
|
1762
1762
|
|
1763
|
-
return _setPrototypeOf
|
1763
|
+
return _setPrototypeOf(o, p);
|
1764
1764
|
}
|
1765
1765
|
|
1766
1766
|
function _inherits$4(subClass, superClass) {
|
@@ -1775,27 +1775,27 @@ this.Twilio.Conversations = (function (exports) {
|
|
1775
1775
|
configurable: true
|
1776
1776
|
}
|
1777
1777
|
});
|
1778
|
-
if (superClass) _setPrototypeOf
|
1778
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
1779
1779
|
}
|
1780
1780
|
|
1781
|
-
function _typeof$
|
1781
|
+
function _typeof$3(obj) {
|
1782
1782
|
"@babel/helpers - typeof";
|
1783
1783
|
|
1784
1784
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
1785
|
-
_typeof$
|
1785
|
+
_typeof$3 = function _typeof(obj) {
|
1786
1786
|
return typeof obj;
|
1787
1787
|
};
|
1788
1788
|
} else {
|
1789
|
-
_typeof$
|
1789
|
+
_typeof$3 = function _typeof(obj) {
|
1790
1790
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
1791
1791
|
};
|
1792
1792
|
}
|
1793
1793
|
|
1794
|
-
return _typeof$
|
1794
|
+
return _typeof$3(obj);
|
1795
1795
|
}
|
1796
1796
|
|
1797
1797
|
function _possibleConstructorReturn$4(self, call) {
|
1798
|
-
if (call && (_typeof$
|
1798
|
+
if (call && (_typeof$3(call) === "object" || typeof call === "function")) {
|
1799
1799
|
return call;
|
1800
1800
|
}
|
1801
1801
|
|
@@ -3144,7 +3144,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
3144
3144
|
var result = record.arg;
|
3145
3145
|
var value = result.value;
|
3146
3146
|
|
3147
|
-
if (value && _typeof$
|
3147
|
+
if (value && _typeof$3(value) === "object" && hasOwn$1.call(value, "__await")) {
|
3148
3148
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
3149
3149
|
invoke("next", value, resolve, reject);
|
3150
3150
|
}, function (err) {
|
@@ -3699,13 +3699,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
3699
3699
|
var c = arguments.length,
|
3700
3700
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
3701
3701
|
d;
|
3702
|
-
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$
|
3702
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
3703
3703
|
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
3704
3704
|
}
|
3705
3705
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
3706
3706
|
}
|
3707
3707
|
function __metadata$1(metadataKey, metadataValue) {
|
3708
|
-
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$
|
3708
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
3709
3709
|
}
|
3710
3710
|
|
3711
3711
|
var $$n = _export;
|
@@ -4088,7 +4088,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4088
4088
|
var noop = function noop() {};
|
4089
4089
|
|
4090
4090
|
var undefinedType = "undefined";
|
4091
|
-
var isIE = (typeof window === "undefined" ? "undefined" : _typeof$
|
4091
|
+
var isIE = (typeof window === "undefined" ? "undefined" : _typeof$3(window)) !== undefinedType && _typeof$3(window.navigator) !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
|
4092
4092
|
var logMethods = ["trace", "debug", "info", "warn", "error"]; // Cross-browser bind equivalent that works at least back to IE6
|
4093
4093
|
|
4094
4094
|
function bindMethod(obj, methodName) {
|
@@ -4129,7 +4129,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4129
4129
|
methodName = 'log';
|
4130
4130
|
}
|
4131
4131
|
|
4132
|
-
if ((typeof console === "undefined" ? "undefined" : _typeof$
|
4132
|
+
if ((typeof console === "undefined" ? "undefined" : _typeof$3(console)) === undefinedType) {
|
4133
4133
|
return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
|
4134
4134
|
} else if (methodName === 'trace' && isIE) {
|
4135
4135
|
return traceForIE;
|
@@ -4158,7 +4158,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4158
4158
|
|
4159
4159
|
function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
|
4160
4160
|
return function () {
|
4161
|
-
if ((typeof console === "undefined" ? "undefined" : _typeof$
|
4161
|
+
if ((typeof console === "undefined" ? "undefined" : _typeof$3(console)) !== undefinedType) {
|
4162
4162
|
replaceLoggingMethods.call(this, level, loggerName);
|
4163
4163
|
this[methodName].apply(this, arguments);
|
4164
4164
|
}
|
@@ -4179,13 +4179,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
4179
4179
|
|
4180
4180
|
if (typeof name === "string") {
|
4181
4181
|
storageKey += ":" + name;
|
4182
|
-
} else if (_typeof$
|
4182
|
+
} else if (_typeof$3(name) === "symbol") {
|
4183
4183
|
storageKey = undefined;
|
4184
4184
|
}
|
4185
4185
|
|
4186
4186
|
function persistLevelIfPossible(levelNum) {
|
4187
4187
|
var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
|
4188
|
-
if ((typeof window === "undefined" ? "undefined" : _typeof$
|
4188
|
+
if ((typeof window === "undefined" ? "undefined" : _typeof$3(window)) === undefinedType || !storageKey) return; // Use localStorage if available
|
4189
4189
|
|
4190
4190
|
try {
|
4191
4191
|
window.localStorage[storageKey] = levelName;
|
@@ -4200,14 +4200,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
4200
4200
|
|
4201
4201
|
function getPersistedLevel() {
|
4202
4202
|
var storedLevel;
|
4203
|
-
if ((typeof window === "undefined" ? "undefined" : _typeof$
|
4203
|
+
if ((typeof window === "undefined" ? "undefined" : _typeof$3(window)) === undefinedType || !storageKey) return;
|
4204
4204
|
|
4205
4205
|
try {
|
4206
4206
|
storedLevel = window.localStorage[storageKey];
|
4207
4207
|
} catch (ignore) {} // Fallback to cookies if local storage gives us nothing
|
4208
4208
|
|
4209
4209
|
|
4210
|
-
if (_typeof$
|
4210
|
+
if (_typeof$3(storedLevel) === undefinedType) {
|
4211
4211
|
try {
|
4212
4212
|
var cookie = window.document.cookie;
|
4213
4213
|
var location = cookie.indexOf(encodeURIComponent(storageKey) + "=");
|
@@ -4262,7 +4262,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4262
4262
|
|
4263
4263
|
replaceLoggingMethods.call(self, level, name);
|
4264
4264
|
|
4265
|
-
if ((typeof console === "undefined" ? "undefined" : _typeof$
|
4265
|
+
if ((typeof console === "undefined" ? "undefined" : _typeof$3(console)) === undefinedType && level < self.levels.SILENT) {
|
4266
4266
|
return "No console available for logging";
|
4267
4267
|
}
|
4268
4268
|
} else {
|
@@ -4304,7 +4304,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4304
4304
|
var _loggersByName = {};
|
4305
4305
|
|
4306
4306
|
defaultLogger.getLogger = function getLogger(name) {
|
4307
|
-
if (_typeof$
|
4307
|
+
if (_typeof$3(name) !== "symbol" && typeof name !== "string" || name === "") {
|
4308
4308
|
throw new TypeError("You must supply a name when creating a logger.");
|
4309
4309
|
}
|
4310
4310
|
|
@@ -4318,10 +4318,10 @@ this.Twilio.Conversations = (function (exports) {
|
|
4318
4318
|
}; // Grab the current global log variable in case of overwrite
|
4319
4319
|
|
4320
4320
|
|
4321
|
-
var _log = (typeof window === "undefined" ? "undefined" : _typeof$
|
4321
|
+
var _log = (typeof window === "undefined" ? "undefined" : _typeof$3(window)) !== undefinedType ? window.log : undefined;
|
4322
4322
|
|
4323
4323
|
defaultLogger.noConflict = function () {
|
4324
|
-
if ((typeof window === "undefined" ? "undefined" : _typeof$
|
4324
|
+
if ((typeof window === "undefined" ? "undefined" : _typeof$3(window)) !== undefinedType && window.log === defaultLogger) {
|
4325
4325
|
window.log = _log;
|
4326
4326
|
}
|
4327
4327
|
|
@@ -4342,15 +4342,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
4342
4342
|
return ["".concat(new Date().toISOString(), " Conversations ").concat(prefix, ":")].concat(Array.from(args));
|
4343
4343
|
}
|
4344
4344
|
|
4345
|
-
var log$b = loglevel.exports.getLogger(
|
4345
|
+
var log$b = loglevel.exports.getLogger("twilio-conversations"); // twilio-conversations is used by Flex SDK. Please DO NOT change
|
4346
4346
|
|
4347
4347
|
var Logger = /*#__PURE__*/function () {
|
4348
4348
|
function Logger(prefix) {
|
4349
4349
|
_classCallCheck$4(this, Logger);
|
4350
4350
|
|
4351
|
-
_defineProperty$3(this, "prefix",
|
4351
|
+
_defineProperty$3(this, "prefix", "");
|
4352
4352
|
|
4353
|
-
this.prefix = prefix !== null && prefix !== undefined && prefix.length > 0 ? prefix +
|
4353
|
+
this.prefix = prefix !== null && prefix !== undefined && prefix.length > 0 ? prefix + " " : "";
|
4354
4354
|
}
|
4355
4355
|
|
4356
4356
|
_createClass$3(Logger, [{
|
@@ -4365,7 +4365,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4365
4365
|
args[_key] = arguments[_key];
|
4366
4366
|
}
|
4367
4367
|
|
4368
|
-
log$b.trace.apply(null, prepareLine$1(this.prefix +
|
4368
|
+
log$b.trace.apply(null, prepareLine$1(this.prefix + "T", args));
|
4369
4369
|
}
|
4370
4370
|
}, {
|
4371
4371
|
key: "debug",
|
@@ -4374,7 +4374,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4374
4374
|
args[_key2] = arguments[_key2];
|
4375
4375
|
}
|
4376
4376
|
|
4377
|
-
log$b.debug.apply(null, prepareLine$1(this.prefix +
|
4377
|
+
log$b.debug.apply(null, prepareLine$1(this.prefix + "D", args));
|
4378
4378
|
}
|
4379
4379
|
}, {
|
4380
4380
|
key: "info",
|
@@ -4383,7 +4383,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4383
4383
|
args[_key3] = arguments[_key3];
|
4384
4384
|
}
|
4385
4385
|
|
4386
|
-
log$b.info.apply(null, prepareLine$1(this.prefix +
|
4386
|
+
log$b.info.apply(null, prepareLine$1(this.prefix + "I", args));
|
4387
4387
|
}
|
4388
4388
|
}, {
|
4389
4389
|
key: "warn",
|
@@ -4392,7 +4392,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4392
4392
|
args[_key4] = arguments[_key4];
|
4393
4393
|
}
|
4394
4394
|
|
4395
|
-
log$b.warn.apply(null, prepareLine$1(this.prefix +
|
4395
|
+
log$b.warn.apply(null, prepareLine$1(this.prefix + "W", args));
|
4396
4396
|
}
|
4397
4397
|
}, {
|
4398
4398
|
key: "error",
|
@@ -4401,7 +4401,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4401
4401
|
args[_key5] = arguments[_key5];
|
4402
4402
|
}
|
4403
4403
|
|
4404
|
-
log$b.error.apply(null, prepareLine$1(this.prefix +
|
4404
|
+
log$b.error.apply(null, prepareLine$1(this.prefix + "E", args));
|
4405
4405
|
}
|
4406
4406
|
}], [{
|
4407
4407
|
key: "scope",
|
@@ -4420,7 +4420,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4420
4420
|
args[_key6] = arguments[_key6];
|
4421
4421
|
}
|
4422
4422
|
|
4423
|
-
log$b.trace.apply(null, prepareLine$1(
|
4423
|
+
log$b.trace.apply(null, prepareLine$1("T", args));
|
4424
4424
|
}
|
4425
4425
|
}, {
|
4426
4426
|
key: "debug",
|
@@ -4429,7 +4429,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4429
4429
|
args[_key7] = arguments[_key7];
|
4430
4430
|
}
|
4431
4431
|
|
4432
|
-
log$b.debug.apply(null, prepareLine$1(
|
4432
|
+
log$b.debug.apply(null, prepareLine$1("D", args));
|
4433
4433
|
}
|
4434
4434
|
}, {
|
4435
4435
|
key: "info",
|
@@ -4438,7 +4438,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4438
4438
|
args[_key8] = arguments[_key8];
|
4439
4439
|
}
|
4440
4440
|
|
4441
|
-
log$b.info.apply(null, prepareLine$1(
|
4441
|
+
log$b.info.apply(null, prepareLine$1("I", args));
|
4442
4442
|
}
|
4443
4443
|
}, {
|
4444
4444
|
key: "warn",
|
@@ -4447,7 +4447,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4447
4447
|
args[_key9] = arguments[_key9];
|
4448
4448
|
}
|
4449
4449
|
|
4450
|
-
log$b.warn.apply(null, prepareLine$1(
|
4450
|
+
log$b.warn.apply(null, prepareLine$1("W", args));
|
4451
4451
|
}
|
4452
4452
|
}, {
|
4453
4453
|
key: "error",
|
@@ -4456,7 +4456,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
4456
4456
|
args[_key10] = arguments[_key10];
|
4457
4457
|
}
|
4458
4458
|
|
4459
|
-
log$b.error.apply(null, prepareLine$1(
|
4459
|
+
log$b.error.apply(null, prepareLine$1("E", args));
|
4460
4460
|
}
|
4461
4461
|
}]);
|
4462
4462
|
|
@@ -4556,8 +4556,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
4556
4556
|
|
4557
4557
|
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
4558
4558
|
var TYPING_TIMEOUT = 5;
|
4559
|
-
var HTTP_CACHE_LIFETIME =
|
4560
|
-
var CONSUMPTION_HORIZON_SENDING_INTERVAL =
|
4559
|
+
var HTTP_CACHE_LIFETIME = "PT5S";
|
4560
|
+
var CONSUMPTION_HORIZON_SENDING_INTERVAL = "PT5S";
|
4561
4561
|
var USER_INFOS_TO_SUBSCRIBE = 100;
|
4562
4562
|
var MINIMUM_RETRY_DELAY$1 = 1000;
|
4563
4563
|
var MAXIMUM_RETRY_DELAY$1 = 4000;
|
@@ -5235,7 +5235,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
5235
5235
|
}
|
5236
5236
|
|
5237
5237
|
function parseToNumber(value) {
|
5238
|
-
if (typeof value !==
|
5238
|
+
if (typeof value !== "undefined" && !isNaN(Number(value))) {
|
5239
5239
|
return Number(value);
|
5240
5240
|
}
|
5241
5241
|
|
@@ -5274,7 +5274,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
5274
5274
|
function UriBuilder(base) {
|
5275
5275
|
_classCallCheck$4(this, UriBuilder);
|
5276
5276
|
|
5277
|
-
this.base = base.replace(/\/$/,
|
5277
|
+
this.base = base.replace(/\/$/, "");
|
5278
5278
|
this.args = [];
|
5279
5279
|
this.paths = [];
|
5280
5280
|
}
|
@@ -5282,8 +5282,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
5282
5282
|
_createClass$3(UriBuilder, [{
|
5283
5283
|
key: "arg",
|
5284
5284
|
value: function arg(name, value) {
|
5285
|
-
if (typeof value !==
|
5286
|
-
this.args.push(encodeURIComponent(name) +
|
5285
|
+
if (typeof value !== "undefined") {
|
5286
|
+
this.args.push(encodeURIComponent(name) + "=" + encodeURIComponent(value));
|
5287
5287
|
}
|
5288
5288
|
|
5289
5289
|
return this;
|
@@ -5300,11 +5300,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
5300
5300
|
var result = this.base;
|
5301
5301
|
|
5302
5302
|
if (this.paths.length) {
|
5303
|
-
result +=
|
5303
|
+
result += "/" + this.paths.join("/");
|
5304
5304
|
}
|
5305
5305
|
|
5306
5306
|
if (this.args.length) {
|
5307
|
-
result +=
|
5307
|
+
result += "?" + this.args.join("&");
|
5308
5308
|
}
|
5309
5309
|
|
5310
5310
|
return result;
|
@@ -5417,7 +5417,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
5417
5417
|
// https://tc39.es/ecma262/#sec-symbol.iterator
|
5418
5418
|
defineWellKnownSymbol('iterator');
|
5419
5419
|
|
5420
|
-
var _typeof$
|
5420
|
+
var _typeof$2 = {exports: {}};
|
5421
5421
|
|
5422
5422
|
(function (module) {
|
5423
5423
|
function _typeof(obj) {
|
@@ -5442,7 +5442,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
5442
5442
|
|
5443
5443
|
module.exports = _typeof;
|
5444
5444
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
5445
|
-
}(_typeof$
|
5445
|
+
}(_typeof$2));
|
5446
5446
|
|
5447
5447
|
var DESCRIPTORS$7 = descriptors;
|
5448
5448
|
var defineProperty$6 = objectDefineProperty.f;
|
@@ -5769,7 +5769,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
5769
5769
|
}(assertThisInitialized));
|
5770
5770
|
|
5771
5771
|
(function (module) {
|
5772
|
-
var _typeof = _typeof$
|
5772
|
+
var _typeof = _typeof$2.exports["default"];
|
5773
5773
|
|
5774
5774
|
var assertThisInitialized$1 = assertThisInitialized.exports;
|
5775
5775
|
|
@@ -5818,7 +5818,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
5818
5818
|
Object.defineProperty(browser$6, '__esModule', {
|
5819
5819
|
value: true
|
5820
5820
|
});
|
5821
|
-
var _typeof$
|
5821
|
+
var _typeof$1 = _typeof$2.exports;
|
5822
5822
|
var _slicedToArray$2 = slicedToArray.exports;
|
5823
5823
|
var _toConsumableArray$2 = toConsumableArray.exports;
|
5824
5824
|
var _classCallCheck$3 = classCallCheck.exports;
|
@@ -5826,25 +5826,25 @@ this.Twilio.Conversations = (function (exports) {
|
|
5826
5826
|
var _possibleConstructorReturn$3 = possibleConstructorReturn.exports;
|
5827
5827
|
var _getPrototypeOf$3 = getPrototypeOf$2.exports;
|
5828
5828
|
|
5829
|
-
function _interopDefaultLegacy$
|
5830
|
-
return e && _typeof$
|
5829
|
+
function _interopDefaultLegacy$4(e) {
|
5830
|
+
return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
|
5831
5831
|
'default': e
|
5832
5832
|
};
|
5833
5833
|
}
|
5834
5834
|
|
5835
|
-
var _typeof__default$1 = /*#__PURE__*/_interopDefaultLegacy$
|
5835
|
+
var _typeof__default$1 = /*#__PURE__*/_interopDefaultLegacy$4(_typeof$1);
|
5836
5836
|
|
5837
|
-
var _slicedToArray__default$1 = /*#__PURE__*/_interopDefaultLegacy$
|
5837
|
+
var _slicedToArray__default$1 = /*#__PURE__*/_interopDefaultLegacy$4(_slicedToArray$2);
|
5838
5838
|
|
5839
|
-
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy$
|
5839
|
+
var _toConsumableArray__default$1 = /*#__PURE__*/_interopDefaultLegacy$4(_toConsumableArray$2);
|
5840
5840
|
|
5841
|
-
var _classCallCheck__default$
|
5841
|
+
var _classCallCheck__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_classCallCheck$3);
|
5842
5842
|
|
5843
|
-
var _inherits__default$
|
5843
|
+
var _inherits__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_inherits$3);
|
5844
5844
|
|
5845
|
-
var _possibleConstructorReturn__default$
|
5845
|
+
var _possibleConstructorReturn__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_possibleConstructorReturn$3);
|
5846
5846
|
|
5847
|
-
var _getPrototypeOf__default$
|
5847
|
+
var _getPrototypeOf__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_getPrototypeOf$3);
|
5848
5848
|
|
5849
5849
|
var custom = function custom() {
|
5850
5850
|
for (var _len = arguments.length, checks = new Array(_len), _key = 0; _key < _len; _key++) {
|
@@ -6085,18 +6085,18 @@ this.Twilio.Conversations = (function (exports) {
|
|
6085
6085
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$e();
|
6086
6086
|
|
6087
6087
|
return function _createSuperInternal() {
|
6088
|
-
var Super = _getPrototypeOf__default$
|
6088
|
+
var Super = _getPrototypeOf__default$3['default'](Derived),
|
6089
6089
|
result;
|
6090
6090
|
|
6091
6091
|
if (hasNativeReflectConstruct) {
|
6092
|
-
var NewTarget = _getPrototypeOf__default$
|
6092
|
+
var NewTarget = _getPrototypeOf__default$3['default'](this).constructor;
|
6093
6093
|
|
6094
6094
|
result = Reflect.construct(Super, arguments, NewTarget);
|
6095
6095
|
} else {
|
6096
6096
|
result = Super.apply(this, arguments);
|
6097
6097
|
}
|
6098
6098
|
|
6099
|
-
return _possibleConstructorReturn__default$
|
6099
|
+
return _possibleConstructorReturn__default$3['default'](this, result);
|
6100
6100
|
};
|
6101
6101
|
}
|
6102
6102
|
|
@@ -6261,12 +6261,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
6261
6261
|
var finalRuleSet = convertRuleArguments(args);
|
6262
6262
|
return function (ctor) {
|
6263
6263
|
return /*#__PURE__*/function (_ctor) {
|
6264
|
-
_inherits__default$
|
6264
|
+
_inherits__default$3['default'](_class, _ctor);
|
6265
6265
|
|
6266
6266
|
var _super = _createSuper$d(_class);
|
6267
6267
|
|
6268
6268
|
function _class() {
|
6269
|
-
_classCallCheck__default$
|
6269
|
+
_classCallCheck__default$3['default'](this, _class);
|
6270
6270
|
|
6271
6271
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
6272
6272
|
args[_key2] = arguments[_key2];
|
@@ -6415,7 +6415,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
6415
6415
|
}
|
6416
6416
|
|
6417
6417
|
if (typeDescription) {
|
6418
|
-
expectedTypes = typeof typeDescription === "string" ? [].concat(_toConsumableArray__default['default'](expectedTypes), [typeDescription]) : [].concat(_toConsumableArray__default['default'](expectedTypes), _toConsumableArray__default['default'](typeDescription));
|
6418
|
+
expectedTypes = typeof typeDescription === "string" ? [].concat(_toConsumableArray__default$1['default'](expectedTypes), [typeDescription]) : [].concat(_toConsumableArray__default$1['default'](expectedTypes), _toConsumableArray__default$1['default'](typeDescription));
|
6419
6419
|
}
|
6420
6420
|
}
|
6421
6421
|
} catch (err) {
|
@@ -6470,7 +6470,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
6470
6470
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
6471
6471
|
|
6472
6472
|
if (!it) {
|
6473
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$
|
6473
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") {
|
6474
6474
|
if (it) o = it;
|
6475
6475
|
var i = 0;
|
6476
6476
|
|
@@ -6523,16 +6523,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
6523
6523
|
};
|
6524
6524
|
}
|
6525
6525
|
|
6526
|
-
function _unsupportedIterableToArray$
|
6526
|
+
function _unsupportedIterableToArray$7(o, minLen) {
|
6527
6527
|
if (!o) return;
|
6528
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
6528
|
+
if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
|
6529
6529
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
6530
6530
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
6531
6531
|
if (n === "Map" || n === "Set") return Array.from(o);
|
6532
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
6532
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
|
6533
6533
|
}
|
6534
6534
|
|
6535
|
-
function _arrayLikeToArray$
|
6535
|
+
function _arrayLikeToArray$7(arr, len) {
|
6536
6536
|
if (len == null || len > arr.length) len = arr.length;
|
6537
6537
|
|
6538
6538
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
@@ -6592,71 +6592,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
6592
6592
|
var validateTypesAsync_1 = browser$6.validateTypesAsync = validateTypesAsync;
|
6593
6593
|
|
6594
6594
|
var attributesValidator = custom_1(function (value) {
|
6595
|
-
return [[
|
6595
|
+
return [["string", "number", "boolean", "object"].includes(_typeof$3(value)), "a JSON type"];
|
6596
6596
|
});
|
6597
6597
|
var optionalAttributesValidator = custom_1(function (value) {
|
6598
|
-
return [[
|
6598
|
+
return [["undefined", "string", "number", "boolean", "object"].includes(_typeof$3(value)), "an optional JSON type"];
|
6599
6599
|
});
|
6600
6600
|
|
6601
6601
|
var browser$5 = {};
|
6602
6602
|
|
6603
|
-
|
6604
|
-
@license
|
6605
|
-
Copyright (c) 2021 Twilio Inc.
|
6606
|
-
|
6607
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6608
|
-
|
6609
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6610
|
-
|
6611
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
6612
|
-
|
6613
|
-
*/
|
6614
|
-
|
6615
|
-
Object.defineProperty(browser$5, '__esModule', {
|
6616
|
-
value: true
|
6617
|
-
});
|
6618
|
-
|
6619
|
-
function _arrayLikeToArray$7(arr, len) {
|
6620
|
-
if (len == null || len > arr.length) len = arr.length;
|
6621
|
-
|
6622
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
6623
|
-
arr2[i] = arr[i];
|
6624
|
-
}
|
6625
|
-
|
6626
|
-
return arr2;
|
6627
|
-
}
|
6628
|
-
|
6629
|
-
function _arrayWithoutHoles$1(arr) {
|
6630
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
|
6631
|
-
}
|
6632
|
-
|
6633
|
-
function _iterableToArray$1(iter) {
|
6634
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
6635
|
-
}
|
6636
|
-
|
6637
|
-
function _unsupportedIterableToArray$7(o, minLen) {
|
6638
|
-
if (!o) return;
|
6639
|
-
if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
|
6640
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
6641
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
6642
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
6643
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
|
6644
|
-
}
|
6645
|
-
|
6646
|
-
function _nonIterableSpread$1() {
|
6647
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
6648
|
-
}
|
6649
|
-
|
6650
|
-
function _toConsumableArray$1(arr) {
|
6651
|
-
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread$1();
|
6652
|
-
}
|
6653
|
-
|
6654
|
-
function _classCallCheck$2(instance, Constructor) {
|
6655
|
-
if (!(instance instanceof Constructor)) {
|
6656
|
-
throw new TypeError("Cannot call a class as a function");
|
6657
|
-
}
|
6658
|
-
}
|
6603
|
+
var createClass = {exports: {}};
|
6659
6604
|
|
6605
|
+
(function (module) {
|
6660
6606
|
function _defineProperties(target, props) {
|
6661
6607
|
for (var i = 0; i < props.length; i++) {
|
6662
6608
|
var descriptor = props[i];
|
@@ -6667,43 +6613,46 @@ this.Twilio.Conversations = (function (exports) {
|
|
6667
6613
|
}
|
6668
6614
|
}
|
6669
6615
|
|
6670
|
-
function _createClass
|
6616
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
6671
6617
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
6672
6618
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
6673
6619
|
return Constructor;
|
6674
6620
|
}
|
6675
6621
|
|
6676
|
-
|
6677
|
-
|
6678
|
-
|
6679
|
-
}
|
6622
|
+
module.exports = _createClass;
|
6623
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
6624
|
+
}(createClass));
|
6680
6625
|
|
6681
|
-
|
6682
|
-
}
|
6626
|
+
var get$1 = {exports: {}};
|
6683
6627
|
|
6684
|
-
|
6685
|
-
|
6686
|
-
|
6687
|
-
|
6688
|
-
return _getPrototypeOf$2(o);
|
6689
|
-
}
|
6628
|
+
var superPropBase = {exports: {}};
|
6629
|
+
|
6630
|
+
(function (module) {
|
6631
|
+
var getPrototypeOf = getPrototypeOf$2.exports;
|
6690
6632
|
|
6691
6633
|
function _superPropBase(object, property) {
|
6692
6634
|
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
6693
|
-
object =
|
6635
|
+
object = getPrototypeOf(object);
|
6694
6636
|
if (object === null) break;
|
6695
6637
|
}
|
6696
6638
|
|
6697
6639
|
return object;
|
6698
6640
|
}
|
6699
6641
|
|
6700
|
-
|
6642
|
+
module.exports = _superPropBase;
|
6643
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
6644
|
+
}(superPropBase));
|
6645
|
+
|
6646
|
+
(function (module) {
|
6647
|
+
var superPropBase$1 = superPropBase.exports;
|
6648
|
+
|
6649
|
+
function _get(target, property, receiver) {
|
6701
6650
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
6702
|
-
_get
|
6651
|
+
module.exports = _get = Reflect.get;
|
6652
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
6703
6653
|
} else {
|
6704
|
-
_get
|
6705
|
-
var base =
|
6706
|
-
|
6654
|
+
module.exports = _get = function _get(target, property, receiver) {
|
6655
|
+
var base = superPropBase$1(target, property);
|
6707
6656
|
if (!base) return;
|
6708
6657
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
6709
6658
|
|
@@ -6713,60 +6662,21 @@ this.Twilio.Conversations = (function (exports) {
|
|
6713
6662
|
|
6714
6663
|
return desc.value;
|
6715
6664
|
};
|
6716
|
-
}
|
6717
6665
|
|
6718
|
-
|
6719
|
-
}
|
6720
|
-
|
6721
|
-
function _setPrototypeOf(o, p) {
|
6722
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
6723
|
-
o.__proto__ = p;
|
6724
|
-
return o;
|
6725
|
-
};
|
6726
|
-
|
6727
|
-
return _setPrototypeOf(o, p);
|
6728
|
-
}
|
6729
|
-
|
6730
|
-
function _inherits$2(subClass, superClass) {
|
6731
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
6732
|
-
throw new TypeError("Super expression must either be null or a function");
|
6666
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
6733
6667
|
}
|
6734
6668
|
|
6735
|
-
|
6736
|
-
constructor: {
|
6737
|
-
value: subClass,
|
6738
|
-
writable: true,
|
6739
|
-
configurable: true
|
6740
|
-
}
|
6741
|
-
});
|
6742
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
6669
|
+
return _get(target, property, receiver || target);
|
6743
6670
|
}
|
6744
6671
|
|
6745
|
-
|
6746
|
-
|
6747
|
-
|
6748
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
6749
|
-
_typeof$1 = function _typeof(obj) {
|
6750
|
-
return typeof obj;
|
6751
|
-
};
|
6752
|
-
} else {
|
6753
|
-
_typeof$1 = function _typeof(obj) {
|
6754
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
6755
|
-
};
|
6756
|
-
}
|
6757
|
-
|
6758
|
-
return _typeof$1(obj);
|
6759
|
-
}
|
6672
|
+
module.exports = _get;
|
6673
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
6674
|
+
}(get$1));
|
6760
6675
|
|
6761
|
-
|
6762
|
-
if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
|
6763
|
-
return call;
|
6764
|
-
}
|
6676
|
+
var defineProperty$5 = {exports: {}};
|
6765
6677
|
|
6766
|
-
|
6767
|
-
|
6768
|
-
|
6769
|
-
function _defineProperty$2(obj, key, value) {
|
6678
|
+
(function (module) {
|
6679
|
+
function _defineProperty(obj, key, value) {
|
6770
6680
|
if (key in obj) {
|
6771
6681
|
Object.defineProperty(obj, key, {
|
6772
6682
|
value: value,
|
@@ -6781,6 +6691,47 @@ this.Twilio.Conversations = (function (exports) {
|
|
6781
6691
|
return obj;
|
6782
6692
|
}
|
6783
6693
|
|
6694
|
+
module.exports = _defineProperty;
|
6695
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
6696
|
+
}(defineProperty$5));
|
6697
|
+
|
6698
|
+
Object.defineProperty(browser$5, '__esModule', {
|
6699
|
+
value: true
|
6700
|
+
});
|
6701
|
+
var _toConsumableArray$1 = toConsumableArray.exports;
|
6702
|
+
var _classCallCheck$2 = classCallCheck.exports;
|
6703
|
+
var _createClass$2 = createClass.exports;
|
6704
|
+
var _assertThisInitialized$2 = assertThisInitialized.exports;
|
6705
|
+
var _get$1 = get$1.exports;
|
6706
|
+
var _inherits$2 = inherits.exports;
|
6707
|
+
var _possibleConstructorReturn$2 = possibleConstructorReturn.exports;
|
6708
|
+
var _getPrototypeOf$2 = getPrototypeOf$2.exports;
|
6709
|
+
var _defineProperty$2 = defineProperty$5.exports;
|
6710
|
+
|
6711
|
+
function _interopDefaultLegacy$3(e) {
|
6712
|
+
return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
|
6713
|
+
'default': e
|
6714
|
+
};
|
6715
|
+
}
|
6716
|
+
|
6717
|
+
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy$3(_toConsumableArray$1);
|
6718
|
+
|
6719
|
+
var _classCallCheck__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_classCallCheck$2);
|
6720
|
+
|
6721
|
+
var _createClass__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_createClass$2);
|
6722
|
+
|
6723
|
+
var _assertThisInitialized__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_assertThisInitialized$2);
|
6724
|
+
|
6725
|
+
var _get__default$1 = /*#__PURE__*/_interopDefaultLegacy$3(_get$1);
|
6726
|
+
|
6727
|
+
var _inherits__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_inherits$2);
|
6728
|
+
|
6729
|
+
var _possibleConstructorReturn__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_possibleConstructorReturn$2);
|
6730
|
+
|
6731
|
+
var _getPrototypeOf__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_getPrototypeOf$2);
|
6732
|
+
|
6733
|
+
var _defineProperty__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_defineProperty$2);
|
6734
|
+
|
6784
6735
|
var domain$2; // This constructor is used to store event handlers. Instantiating this is
|
6785
6736
|
// faster than explicitly calling `Object.create(null)` to get a "clean" empty
|
6786
6737
|
// object (tested with v8 v4.9).
|
@@ -7235,18 +7186,18 @@ this.Twilio.Conversations = (function (exports) {
|
|
7235
7186
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$d();
|
7236
7187
|
|
7237
7188
|
return function _createSuperInternal() {
|
7238
|
-
var Super =
|
7189
|
+
var Super = _getPrototypeOf__default$2['default'](Derived),
|
7239
7190
|
result;
|
7240
7191
|
|
7241
7192
|
if (hasNativeReflectConstruct) {
|
7242
|
-
var NewTarget =
|
7193
|
+
var NewTarget = _getPrototypeOf__default$2['default'](this).constructor;
|
7243
7194
|
|
7244
7195
|
result = Reflect.construct(Super, arguments, NewTarget);
|
7245
7196
|
} else {
|
7246
7197
|
result = Super.apply(this, arguments);
|
7247
7198
|
}
|
7248
7199
|
|
7249
|
-
return
|
7200
|
+
return _possibleConstructorReturn__default$2['default'](this, result);
|
7250
7201
|
};
|
7251
7202
|
}
|
7252
7203
|
|
@@ -7264,36 +7215,36 @@ this.Twilio.Conversations = (function (exports) {
|
|
7264
7215
|
}
|
7265
7216
|
|
7266
7217
|
var ReplayEventEmitter = /*#__PURE__*/function (_EventEmitter) {
|
7267
|
-
|
7218
|
+
_inherits__default$2['default'](ReplayEventEmitter, _EventEmitter);
|
7268
7219
|
|
7269
7220
|
var _super = _createSuper$c(ReplayEventEmitter);
|
7270
7221
|
|
7271
7222
|
function ReplayEventEmitter() {
|
7272
7223
|
var _this;
|
7273
7224
|
|
7274
|
-
|
7225
|
+
_classCallCheck__default$2['default'](this, ReplayEventEmitter);
|
7275
7226
|
|
7276
7227
|
_this = _super.call(this);
|
7277
7228
|
|
7278
|
-
|
7229
|
+
_defineProperty__default$2['default'](_assertThisInitialized__default$2['default'](_this), "eventHistory", new Map());
|
7279
7230
|
|
7280
7231
|
return _this;
|
7281
7232
|
}
|
7282
7233
|
|
7283
|
-
|
7234
|
+
_createClass__default$2['default'](ReplayEventEmitter, [{
|
7284
7235
|
key: "on",
|
7285
7236
|
value: function on(event, listener) {
|
7286
|
-
return
|
7237
|
+
return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "on", this).call(this, event, listener);
|
7287
7238
|
}
|
7288
7239
|
}, {
|
7289
7240
|
key: "once",
|
7290
7241
|
value: function once(event, listener) {
|
7291
|
-
return
|
7242
|
+
return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "once", this).call(this, event, listener);
|
7292
7243
|
}
|
7293
7244
|
}, {
|
7294
7245
|
key: "off",
|
7295
7246
|
value: function off(event, listener) {
|
7296
|
-
return
|
7247
|
+
return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "off", this).call(this, event, listener);
|
7297
7248
|
}
|
7298
7249
|
}, {
|
7299
7250
|
key: "emit",
|
@@ -7305,17 +7256,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
7305
7256
|
}
|
7306
7257
|
|
7307
7258
|
this.eventHistory.set(event, args);
|
7308
|
-
return (_get2 =
|
7259
|
+
return (_get2 = _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "emit", this)).call.apply(_get2, [this, event].concat(args));
|
7309
7260
|
}
|
7310
7261
|
}, {
|
7311
7262
|
key: "addListener",
|
7312
7263
|
value: function addListener(event, listener) {
|
7313
|
-
return
|
7264
|
+
return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "addListener", this).call(this, event, listener);
|
7314
7265
|
}
|
7315
7266
|
}, {
|
7316
7267
|
key: "removeListener",
|
7317
7268
|
value: function removeListener(event, listener) {
|
7318
|
-
return
|
7269
|
+
return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "removeListener", this).call(this, event, listener);
|
7319
7270
|
}
|
7320
7271
|
}, {
|
7321
7272
|
key: "addListenerWithReplay",
|
@@ -7323,7 +7274,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
7323
7274
|
var historyEntry = this.eventHistory.get(event);
|
7324
7275
|
|
7325
7276
|
if (historyEntry !== undefined) {
|
7326
|
-
listener.apply(void 0,
|
7277
|
+
listener.apply(void 0, _toConsumableArray__default['default'](historyEntry));
|
7327
7278
|
}
|
7328
7279
|
|
7329
7280
|
return this.addListener(event, listener);
|
@@ -7407,10 +7358,10 @@ this.Twilio.Conversations = (function (exports) {
|
|
7407
7358
|
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
7408
7359
|
/** Detect free variable `global` from Node.js. */
|
7409
7360
|
|
7410
|
-
var freeGlobal = _typeof$
|
7361
|
+
var freeGlobal = _typeof$3(commonjsGlobal) == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
7411
7362
|
/** Detect free variable `self`. */
|
7412
7363
|
|
7413
|
-
var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof$
|
7364
|
+
var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof$3(self)) == 'object' && self && self.Object === Object && self;
|
7414
7365
|
/** Used as a reference to the global object. */
|
7415
7366
|
|
7416
7367
|
var root = freeGlobal || freeSelf || Function('return this')();
|
@@ -8808,7 +8759,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
8808
8759
|
|
8809
8760
|
|
8810
8761
|
function isKeyable(value) {
|
8811
|
-
var type = _typeof$
|
8762
|
+
var type = _typeof$3(value);
|
8812
8763
|
|
8813
8764
|
return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
|
8814
8765
|
}
|
@@ -9128,7 +9079,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9128
9079
|
|
9129
9080
|
|
9130
9081
|
function isObject(value) {
|
9131
|
-
var type = _typeof$
|
9082
|
+
var type = _typeof$3(value);
|
9132
9083
|
|
9133
9084
|
return value != null && (type == 'object' || type == 'function');
|
9134
9085
|
}
|
@@ -9159,7 +9110,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9159
9110
|
|
9160
9111
|
|
9161
9112
|
function isObjectLike(value) {
|
9162
|
-
return value != null && _typeof$
|
9113
|
+
return value != null && _typeof$3(value) == 'object';
|
9163
9114
|
}
|
9164
9115
|
/**
|
9165
9116
|
* Checks if `value` is classified as a typed array.
|
@@ -9263,7 +9214,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9263
9214
|
function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$c(); 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); }; }
|
9264
9215
|
|
9265
9216
|
function _isNativeReflectConstruct$c() { 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; } }
|
9266
|
-
var log$a = Logger.scope(
|
9217
|
+
var log$a = Logger.scope("User");
|
9267
9218
|
/**
|
9268
9219
|
* Extended user information.
|
9269
9220
|
* Note that `isOnline` and `isNotifiable` properties are eligible
|
@@ -9288,14 +9239,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
9288
9239
|
|
9289
9240
|
_defineProperty$3(_assertThisInitialized$3(_this), "promiseToFetch", null);
|
9290
9241
|
|
9291
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "updated",
|
9242
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "updated", "updated");
|
9292
9243
|
|
9293
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "userSubscribed",
|
9244
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "userSubscribed", "userSubscribed");
|
9294
9245
|
|
9295
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "userUnsubscribed",
|
9246
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "userUnsubscribed", "userUnsubscribed");
|
9296
9247
|
|
9297
9248
|
_this.services = services;
|
9298
|
-
_this.subscribed =
|
9249
|
+
_this.subscribed = "initializing";
|
9299
9250
|
|
9300
9251
|
_this.setMaxListeners(0);
|
9301
9252
|
|
@@ -9388,7 +9339,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9388
9339
|
}, {
|
9389
9340
|
key: "isSubscribed",
|
9390
9341
|
get: function get() {
|
9391
|
-
return this.subscribed ==
|
9342
|
+
return this.subscribed == "subscribed";
|
9392
9343
|
} // Handles service updates
|
9393
9344
|
|
9394
9345
|
}, {
|
@@ -9405,14 +9356,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
9405
9356
|
|
9406
9357
|
case 2:
|
9407
9358
|
updateReasons = [];
|
9408
|
-
log$a.debug(
|
9359
|
+
log$a.debug("User for", this.state.identity, "updated:", key, value);
|
9409
9360
|
_context.t0 = key;
|
9410
|
-
_context.next = _context.t0 ===
|
9361
|
+
_context.next = _context.t0 === "friendlyName" ? 7 : _context.t0 === "attributes" ? 9 : _context.t0 === "reachability" ? 12 : 15;
|
9411
9362
|
break;
|
9412
9363
|
|
9413
9364
|
case 7:
|
9414
9365
|
if (this.state.friendlyName !== value.value) {
|
9415
|
-
updateReasons.push(
|
9366
|
+
updateReasons.push("friendlyName");
|
9416
9367
|
this.state.friendlyName = value.value;
|
9417
9368
|
}
|
9418
9369
|
|
@@ -9423,7 +9374,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9423
9374
|
|
9424
9375
|
if (!isEqual(this.state.attributes, updateAttributes)) {
|
9425
9376
|
this.state.attributes = updateAttributes;
|
9426
|
-
updateReasons.push(
|
9377
|
+
updateReasons.push("attributes");
|
9427
9378
|
}
|
9428
9379
|
|
9429
9380
|
return _context.abrupt("break", 16);
|
@@ -9431,12 +9382,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
9431
9382
|
case 12:
|
9432
9383
|
if (this.state.online !== value.online) {
|
9433
9384
|
this.state.online = value.online;
|
9434
|
-
updateReasons.push(
|
9385
|
+
updateReasons.push("reachabilityOnline");
|
9435
9386
|
}
|
9436
9387
|
|
9437
9388
|
if (this.state.notifiable !== value.notifiable) {
|
9438
9389
|
this.state.notifiable = value.notifiable;
|
9439
|
-
updateReasons.push(
|
9390
|
+
updateReasons.push("reachabilityNotifiable");
|
9440
9391
|
}
|
9441
9392
|
|
9442
9393
|
return _context.abrupt("break", 16);
|
@@ -9446,7 +9397,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9446
9397
|
|
9447
9398
|
case 16:
|
9448
9399
|
if (updateReasons.length > 0) {
|
9449
|
-
this.emit(
|
9400
|
+
this.emit("updated", {
|
9450
9401
|
user: this,
|
9451
9402
|
updateReasons: updateReasons
|
9452
9403
|
});
|
@@ -9489,8 +9440,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
9489
9440
|
return _context2.abrupt("return", Promise.resolve());
|
9490
9441
|
|
9491
9442
|
case 4:
|
9492
|
-
return _context2.abrupt("return", map.get(
|
9493
|
-
log$a.warn(
|
9443
|
+
return _context2.abrupt("return", map.get("reachability").then(update).catch(function (err) {
|
9444
|
+
log$a.warn("Failed to get reachability info for ", _this2.state.identity, err);
|
9494
9445
|
}));
|
9495
9446
|
|
9496
9447
|
case 5:
|
@@ -9532,26 +9483,26 @@ this.Twilio.Conversations = (function (exports) {
|
|
9532
9483
|
case 4:
|
9533
9484
|
this.promiseToFetch = this.services.syncClient.map({
|
9534
9485
|
id: this.state.entityName,
|
9535
|
-
mode:
|
9486
|
+
mode: "open_existing",
|
9536
9487
|
includeItems: true
|
9537
9488
|
}).then(function (map) {
|
9538
9489
|
_this3.entity = map;
|
9539
|
-
map.on(
|
9540
|
-
log$a.debug(_this3.state.entityName +
|
9490
|
+
map.on("itemUpdated", function (args) {
|
9491
|
+
log$a.debug(_this3.state.entityName + " (" + _this3.state.identity + ") itemUpdated: " + args.item.key);
|
9541
9492
|
return _this3._update(args.item.key, args.item.data);
|
9542
9493
|
});
|
9543
|
-
return Promise.all([map.get(
|
9494
|
+
return Promise.all([map.get("friendlyName").then(function (item) {
|
9544
9495
|
return _this3._update(item.key, item.data);
|
9545
|
-
}), map.get(
|
9496
|
+
}), map.get("attributes").then(function (item) {
|
9546
9497
|
return _this3._update(item.key, item.data);
|
9547
9498
|
}), _this3._updateReachabilityInfo(map, function (item) {
|
9548
9499
|
return _this3._update(item.key, item.data);
|
9549
9500
|
})]);
|
9550
9501
|
}).then(function () {
|
9551
|
-
log$a.debug(
|
9552
|
-
_this3.subscribed =
|
9502
|
+
log$a.debug("Fetched for", _this3.identity);
|
9503
|
+
_this3.subscribed = "subscribed";
|
9553
9504
|
|
9554
|
-
_this3.emit(
|
9505
|
+
_this3.emit("userSubscribed", _this3);
|
9555
9506
|
|
9556
9507
|
return _this3;
|
9557
9508
|
}).catch(function (err) {
|
@@ -9619,16 +9570,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
9619
9570
|
return this._initializationPromise;
|
9620
9571
|
|
9621
9572
|
case 2:
|
9622
|
-
if (!(this.subscribed ==
|
9573
|
+
if (!(this.subscribed == "unsubscribed")) {
|
9623
9574
|
_context5.next = 4;
|
9624
9575
|
break;
|
9625
9576
|
}
|
9626
9577
|
|
9627
|
-
throw new Error(
|
9578
|
+
throw new Error("Can't modify unsubscribed object");
|
9628
9579
|
|
9629
9580
|
case 4:
|
9630
9581
|
_context5.next = 6;
|
9631
|
-
return this.services.commandExecutor.mutateResource(
|
9582
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
9632
9583
|
attributes: JSON.stringify(attributes)
|
9633
9584
|
});
|
9634
9585
|
|
@@ -9666,16 +9617,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
9666
9617
|
return this._initializationPromise;
|
9667
9618
|
|
9668
9619
|
case 2:
|
9669
|
-
if (!(this.subscribed ==
|
9620
|
+
if (!(this.subscribed == "unsubscribed")) {
|
9670
9621
|
_context6.next = 4;
|
9671
9622
|
break;
|
9672
9623
|
}
|
9673
9624
|
|
9674
|
-
throw new Error(
|
9625
|
+
throw new Error("Can't modify unsubscribed object");
|
9675
9626
|
|
9676
9627
|
case 4:
|
9677
9628
|
_context6.next = 6;
|
9678
|
-
return this.services.commandExecutor.mutateResource(
|
9629
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
9679
9630
|
friendly_name: friendlyName
|
9680
9631
|
});
|
9681
9632
|
|
@@ -9724,8 +9675,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
9724
9675
|
case 5:
|
9725
9676
|
this.entity.close();
|
9726
9677
|
this.promiseToFetch = null;
|
9727
|
-
this.subscribed =
|
9728
|
-
this.emit(
|
9678
|
+
this.subscribed = "unsubscribed";
|
9679
|
+
this.emit("userUnsubscribed", this);
|
9729
9680
|
|
9730
9681
|
case 9:
|
9731
9682
|
case "end":
|
@@ -9754,9 +9705,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
9754
9705
|
this._resolveInitializationPromise();
|
9755
9706
|
|
9756
9707
|
if (emitUpdated) {
|
9757
|
-
this.emit(
|
9708
|
+
this.emit("updated", {
|
9758
9709
|
user: this,
|
9759
|
-
updateReasons: [
|
9710
|
+
updateReasons: ["friendlyName", "attributes", "reachabilityOnline", "reachabilityNotifiable"]
|
9760
9711
|
});
|
9761
9712
|
}
|
9762
9713
|
}
|
@@ -9767,7 +9718,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9767
9718
|
|
9768
9719
|
__decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], User.prototype, "updateAttributes", null);
|
9769
9720
|
|
9770
|
-
__decorate$1([validateTypesAsync_1([
|
9721
|
+
__decorate$1([validateTypesAsync_1(["string"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
|
9771
9722
|
|
9772
9723
|
function _arrayWithHoles(arr) {
|
9773
9724
|
if (Array.isArray(arr)) return arr;
|
@@ -9843,7 +9794,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9843
9794
|
var hiddenKeys = hiddenKeys$6;
|
9844
9795
|
var isObject$5 = isObject$n;
|
9845
9796
|
var has$3 = has$g;
|
9846
|
-
var defineProperty$
|
9797
|
+
var defineProperty$4 = objectDefineProperty.f;
|
9847
9798
|
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
9848
9799
|
var getOwnPropertyNamesExternalModule = objectGetOwnPropertyNamesExternal;
|
9849
9800
|
var uid$1 = uid$5;
|
@@ -9859,7 +9810,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
9859
9810
|
};
|
9860
9811
|
|
9861
9812
|
var setMetadata = function (it) {
|
9862
|
-
defineProperty$
|
9813
|
+
defineProperty$4(it, METADATA, { value: {
|
9863
9814
|
objectID: 'O' + id++, // object ID
|
9864
9815
|
weakData: {} // weak collections IDs
|
9865
9816
|
} });
|
@@ -10035,7 +9986,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
10035
9986
|
return Constructor;
|
10036
9987
|
};
|
10037
9988
|
|
10038
|
-
var defineProperty$
|
9989
|
+
var defineProperty$3 = objectDefineProperty.f;
|
10039
9990
|
var create$2 = objectCreate;
|
10040
9991
|
var redefineAll$2 = redefineAll$4;
|
10041
9992
|
var bind$2 = functionBindContext;
|
@@ -10184,7 +10135,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
10184
10135
|
return define(this, value = value === 0 ? 0 : value, value);
|
10185
10136
|
}
|
10186
10137
|
});
|
10187
|
-
if (DESCRIPTORS$5) defineProperty$
|
10138
|
+
if (DESCRIPTORS$5) defineProperty$3(C.prototype, 'size', {
|
10188
10139
|
get: function () {
|
10189
10140
|
return getInternalState(this).size;
|
10190
10141
|
}
|
@@ -10248,51 +10199,6 @@ this.Twilio.Conversations = (function (exports) {
|
|
10248
10199
|
|
10249
10200
|
var browser$4 = {};
|
10250
10201
|
|
10251
|
-
var createClass = {exports: {}};
|
10252
|
-
|
10253
|
-
(function (module) {
|
10254
|
-
function _defineProperties(target, props) {
|
10255
|
-
for (var i = 0; i < props.length; i++) {
|
10256
|
-
var descriptor = props[i];
|
10257
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
10258
|
-
descriptor.configurable = true;
|
10259
|
-
if ("value" in descriptor) descriptor.writable = true;
|
10260
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
10261
|
-
}
|
10262
|
-
}
|
10263
|
-
|
10264
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
10265
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
10266
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
10267
|
-
return Constructor;
|
10268
|
-
}
|
10269
|
-
|
10270
|
-
module.exports = _createClass;
|
10271
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
10272
|
-
}(createClass));
|
10273
|
-
|
10274
|
-
var defineProperty$3 = {exports: {}};
|
10275
|
-
|
10276
|
-
(function (module) {
|
10277
|
-
function _defineProperty(obj, key, value) {
|
10278
|
-
if (key in obj) {
|
10279
|
-
Object.defineProperty(obj, key, {
|
10280
|
-
value: value,
|
10281
|
-
enumerable: true,
|
10282
|
-
configurable: true,
|
10283
|
-
writable: true
|
10284
|
-
});
|
10285
|
-
} else {
|
10286
|
-
obj[key] = value;
|
10287
|
-
}
|
10288
|
-
|
10289
|
-
return obj;
|
10290
|
-
}
|
10291
|
-
|
10292
|
-
module.exports = _defineProperty;
|
10293
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
10294
|
-
}(defineProperty$3));
|
10295
|
-
|
10296
10202
|
Object.defineProperty(browser$4, '__esModule', {
|
10297
10203
|
value: true
|
10298
10204
|
});
|
@@ -10302,10 +10208,10 @@ this.Twilio.Conversations = (function (exports) {
|
|
10302
10208
|
var _inherits$1 = inherits.exports;
|
10303
10209
|
var _possibleConstructorReturn$1 = possibleConstructorReturn.exports;
|
10304
10210
|
var _getPrototypeOf$1 = getPrototypeOf$2.exports;
|
10305
|
-
var _defineProperty$1 = defineProperty$
|
10211
|
+
var _defineProperty$1 = defineProperty$5.exports;
|
10306
10212
|
|
10307
10213
|
function _interopDefaultLegacy$2(e) {
|
10308
|
-
return e && _typeof$
|
10214
|
+
return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
|
10309
10215
|
'default': e
|
10310
10216
|
};
|
10311
10217
|
}
|
@@ -11274,13 +11180,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
11274
11180
|
}
|
11275
11181
|
|
11276
11182
|
var retrier = new Retrier_1(_this2.configuration.backoffConfiguration);
|
11277
|
-
retrier.on(
|
11183
|
+
retrier.on("attempt", function () {
|
11278
11184
|
request().then(function (result) {
|
11279
11185
|
return retrier.succeeded(result);
|
11280
11186
|
}).catch(function (err) {
|
11281
11187
|
if (codesToRetryOn.indexOf(err.status) > -1) {
|
11282
11188
|
retrier.failed(err);
|
11283
|
-
} else if (err.message ===
|
11189
|
+
} else if (err.message === "Twilsock disconnected") {
|
11284
11190
|
// Ugly hack. We must make a proper exceptions for twilsock
|
11285
11191
|
retrier.failed(err);
|
11286
11192
|
} else {
|
@@ -11291,13 +11197,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
11291
11197
|
}
|
11292
11198
|
});
|
11293
11199
|
});
|
11294
|
-
retrier.on(
|
11200
|
+
retrier.on("succeeded", function (result) {
|
11295
11201
|
resolve(result);
|
11296
11202
|
});
|
11297
|
-
retrier.on(
|
11203
|
+
retrier.on("cancelled", function (err) {
|
11298
11204
|
return reject(err);
|
11299
11205
|
});
|
11300
|
-
retrier.on(
|
11206
|
+
retrier.on("failed", function (err) {
|
11301
11207
|
return reject(err);
|
11302
11208
|
});
|
11303
11209
|
retrier.start();
|
@@ -11362,15 +11268,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
11362
11268
|
_classCallCheck$4(this, NotificationTypes);
|
11363
11269
|
};
|
11364
11270
|
|
11365
|
-
_defineProperty$3(NotificationTypes, "TYPING_INDICATOR",
|
11271
|
+
_defineProperty$3(NotificationTypes, "TYPING_INDICATOR", "twilio.ipmsg.typing_indicator");
|
11366
11272
|
|
11367
|
-
_defineProperty$3(NotificationTypes, "NEW_MESSAGE",
|
11273
|
+
_defineProperty$3(NotificationTypes, "NEW_MESSAGE", "twilio.conversations.new_message");
|
11368
11274
|
|
11369
|
-
_defineProperty$3(NotificationTypes, "ADDED_TO_CONVERSATION",
|
11275
|
+
_defineProperty$3(NotificationTypes, "ADDED_TO_CONVERSATION", "twilio.conversations.added_to_conversation");
|
11370
11276
|
|
11371
|
-
_defineProperty$3(NotificationTypes, "REMOVED_FROM_CONVERSATION",
|
11277
|
+
_defineProperty$3(NotificationTypes, "REMOVED_FROM_CONVERSATION", "twilio.conversations.removed_from_conversation");
|
11372
11278
|
|
11373
|
-
_defineProperty$3(NotificationTypes, "CONSUMPTION_UPDATE",
|
11279
|
+
_defineProperty$3(NotificationTypes, "CONSUMPTION_UPDATE", "twilio.channel.consumption_update");
|
11374
11280
|
|
11375
11281
|
var browser$3 = {};
|
11376
11282
|
|
@@ -11417,56 +11323,6 @@ this.Twilio.Conversations = (function (exports) {
|
|
11417
11323
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11418
11324
|
}(asyncToGenerator));
|
11419
11325
|
|
11420
|
-
var get$1 = {exports: {}};
|
11421
|
-
|
11422
|
-
var superPropBase = {exports: {}};
|
11423
|
-
|
11424
|
-
(function (module) {
|
11425
|
-
var getPrototypeOf = getPrototypeOf$2.exports;
|
11426
|
-
|
11427
|
-
function _superPropBase(object, property) {
|
11428
|
-
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
11429
|
-
object = getPrototypeOf(object);
|
11430
|
-
if (object === null) break;
|
11431
|
-
}
|
11432
|
-
|
11433
|
-
return object;
|
11434
|
-
}
|
11435
|
-
|
11436
|
-
module.exports = _superPropBase;
|
11437
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11438
|
-
}(superPropBase));
|
11439
|
-
|
11440
|
-
(function (module) {
|
11441
|
-
var superPropBase$1 = superPropBase.exports;
|
11442
|
-
|
11443
|
-
function _get(target, property, receiver) {
|
11444
|
-
if (typeof Reflect !== "undefined" && Reflect.get) {
|
11445
|
-
module.exports = _get = Reflect.get;
|
11446
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11447
|
-
} else {
|
11448
|
-
module.exports = _get = function _get(target, property, receiver) {
|
11449
|
-
var base = superPropBase$1(target, property);
|
11450
|
-
if (!base) return;
|
11451
|
-
var desc = Object.getOwnPropertyDescriptor(base, property);
|
11452
|
-
|
11453
|
-
if (desc.get) {
|
11454
|
-
return desc.get.call(receiver);
|
11455
|
-
}
|
11456
|
-
|
11457
|
-
return desc.value;
|
11458
|
-
};
|
11459
|
-
|
11460
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11461
|
-
}
|
11462
|
-
|
11463
|
-
return _get(target, property, receiver || target);
|
11464
|
-
}
|
11465
|
-
|
11466
|
-
module.exports = _get;
|
11467
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11468
|
-
}(get$1));
|
11469
|
-
|
11470
11326
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(regenerator);
|
11471
11327
|
|
11472
11328
|
var redefine$3 = redefine$d.exports;
|
@@ -11881,7 +11737,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
11881
11737
|
to: init,
|
11882
11738
|
active: true
|
11883
11739
|
}));
|
11884
|
-
} else if (_typeof$
|
11740
|
+
} else if (_typeof$3(init) === 'object') {
|
11885
11741
|
return this.mapTransition(mixin({}, this.defaults.init, init, {
|
11886
11742
|
active: true
|
11887
11743
|
}));
|
@@ -11891,7 +11747,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
11891
11747
|
}
|
11892
11748
|
},
|
11893
11749
|
configureData: function configureData(data) {
|
11894
|
-
if (typeof data === 'function') return data;else if (_typeof$
|
11750
|
+
if (typeof data === 'function') return data;else if (_typeof$3(data) === 'object') return function () {
|
11895
11751
|
return data;
|
11896
11752
|
};else return function () {
|
11897
11753
|
return {};
|
@@ -12191,7 +12047,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
12191
12047
|
}
|
12192
12048
|
|
12193
12049
|
function build(target, config) {
|
12194
|
-
if (_typeof$
|
12050
|
+
if (_typeof$3(target) !== 'object' || Array.isArray(target)) throw Error('StateMachine can only be applied to objects');
|
12195
12051
|
plugin.build(target, config);
|
12196
12052
|
Object.defineProperties(target, PublicProperties);
|
12197
12053
|
mixin(target, PublicMethods);
|
@@ -14201,7 +14057,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
14201
14057
|
};
|
14202
14058
|
/** Used as a reference to the global object. */
|
14203
14059
|
|
14204
|
-
var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof$
|
14060
|
+
var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof$3(window)] && window || this;
|
14205
14061
|
/** Detect free variable `exports`. */
|
14206
14062
|
|
14207
14063
|
var freeExports = exports;
|
@@ -14210,7 +14066,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
14210
14066
|
var freeModule = module && !module.nodeType && module;
|
14211
14067
|
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
|
14212
14068
|
|
14213
|
-
var freeGlobal = freeExports && freeModule && _typeof$
|
14069
|
+
var freeGlobal = freeExports && freeModule && _typeof$3(commonjsGlobal) == 'object' && commonjsGlobal;
|
14214
14070
|
|
14215
14071
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
14216
14072
|
root = freeGlobal;
|
@@ -14367,7 +14223,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
14367
14223
|
|
14368
14224
|
|
14369
14225
|
function isHostType(object, property) {
|
14370
|
-
var type = object != null ? _typeof$
|
14226
|
+
var type = object != null ? _typeof$3(object[property]) : 'number';
|
14371
14227
|
return !/^(?:boolean|number|string|undefined)$/.test(type) && (type == 'object' ? !!object[property] : true);
|
14372
14228
|
}
|
14373
14229
|
/**
|
@@ -14428,7 +14284,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
14428
14284
|
var context = root;
|
14429
14285
|
/** Used to flag when a custom context is provided. */
|
14430
14286
|
|
14431
|
-
var isCustomContext = ua && _typeof$
|
14287
|
+
var isCustomContext = ua && _typeof$3(ua) == 'object' && getClassOf(ua) != 'String'; // Juggle arguments.
|
14432
14288
|
|
14433
14289
|
if (isCustomContext) {
|
14434
14290
|
context = ua;
|
@@ -14933,8 +14789,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
14933
14789
|
if (!name) {
|
14934
14790
|
name = 'Rhino';
|
14935
14791
|
}
|
14936
|
-
} else if (_typeof$
|
14937
|
-
if (_typeof$
|
14792
|
+
} else if (_typeof$3(context.process) == 'object' && !context.process.browser && (data = context.process)) {
|
14793
|
+
if (_typeof$3(data.versions) == 'object') {
|
14938
14794
|
if (typeof data.versions.electron == 'string') {
|
14939
14795
|
description.push('Node ' + data.versions.node);
|
14940
14796
|
name = 'Electron';
|
@@ -15546,9 +15402,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
15546
15402
|
var _possibleConstructorReturn = possibleConstructorReturn.exports;
|
15547
15403
|
var _getPrototypeOf = getPrototypeOf$2.exports;
|
15548
15404
|
var _classCallCheck = classCallCheck.exports;
|
15549
|
-
var _defineProperty = defineProperty$
|
15405
|
+
var _defineProperty = defineProperty$5.exports;
|
15550
15406
|
var _regeneratorRuntime = require$$2;
|
15551
|
-
var _typeof = _typeof$
|
15407
|
+
var _typeof = _typeof$2.exports;
|
15552
15408
|
var declarativeTypeValidator = browser$6;
|
15553
15409
|
var loglevelLog = loglevel.exports;
|
15554
15410
|
var StateMachine = stateMachine.exports;
|
@@ -15558,7 +15414,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
15558
15414
|
var platform = platform$1.exports;
|
15559
15415
|
|
15560
15416
|
function _interopDefaultLegacy(e) {
|
15561
|
-
return e && _typeof$
|
15417
|
+
return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
|
15562
15418
|
'default': e
|
15563
15419
|
};
|
15564
15420
|
}
|
@@ -16200,7 +16056,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
16200
16056
|
}();
|
16201
16057
|
|
16202
16058
|
var logInstance = new Logger("");
|
16203
|
-
var version = "0.12.
|
16059
|
+
var version = "0.12.2-rc.0";
|
16204
16060
|
/**
|
16205
16061
|
* Settings container for the Twilsock client library
|
16206
16062
|
*/
|
@@ -20045,10 +19901,10 @@ this.Twilio.Conversations = (function (exports) {
|
|
20045
19901
|
var _possibleConstructorReturn = possibleConstructorReturn.exports;
|
20046
19902
|
var _getPrototypeOf = getPrototypeOf$2.exports;
|
20047
19903
|
var _regeneratorRuntime = require$$2;
|
20048
|
-
var _typeof = _typeof$
|
19904
|
+
var _typeof = _typeof$2.exports;
|
20049
19905
|
var twilsock = browser$3;
|
20050
19906
|
var _assertThisInitialized = assertThisInitialized.exports;
|
20051
|
-
var _defineProperty = defineProperty$
|
19907
|
+
var _defineProperty = defineProperty$5.exports;
|
20052
19908
|
var operationRetrier = browser$4;
|
20053
19909
|
var _slicedToArray = slicedToArray.exports;
|
20054
19910
|
var _toConsumableArray = toConsumableArray.exports;
|
@@ -20057,7 +19913,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
20057
19913
|
var declarativeTypeValidator = browser$6;
|
20058
19914
|
|
20059
19915
|
function _interopDefaultLegacy(e) {
|
20060
|
-
return e && _typeof$
|
19916
|
+
return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
|
20061
19917
|
'default': e
|
20062
19918
|
};
|
20063
19919
|
}
|
@@ -21753,9 +21609,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
21753
21609
|
var _inherits = inherits.exports;
|
21754
21610
|
var _possibleConstructorReturn = possibleConstructorReturn.exports;
|
21755
21611
|
var _getPrototypeOf = getPrototypeOf$2.exports;
|
21756
|
-
var _defineProperty = defineProperty$
|
21612
|
+
var _defineProperty = defineProperty$5.exports;
|
21757
21613
|
var _regeneratorRuntime = require$$2;
|
21758
|
-
var _typeof = _typeof$
|
21614
|
+
var _typeof = _typeof$2.exports;
|
21759
21615
|
var declarativeTypeValidator = browser$6;
|
21760
21616
|
var twilsock = browser$3;
|
21761
21617
|
var _wrapNativeSuper$1 = wrapNativeSuper.exports;
|
@@ -21767,7 +21623,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
21767
21623
|
var platform = platform$1.exports;
|
21768
21624
|
|
21769
21625
|
function _interopDefaultLegacy$1(e) {
|
21770
|
-
return e && _typeof$
|
21626
|
+
return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
|
21771
21627
|
'default': e
|
21772
21628
|
};
|
21773
21629
|
}
|
@@ -30559,7 +30415,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
30559
30415
|
|
30560
30416
|
__decorate([declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0)], InstantQuery.prototype, "updateIndexName", null);
|
30561
30417
|
|
30562
|
-
var version$1 = "3.0.
|
30418
|
+
var version$1 = "3.0.7-rc.0";
|
30563
30419
|
|
30564
30420
|
function _createSuper$9(Derived) {
|
30565
30421
|
var hasNativeReflectConstruct = _isNativeReflectConstruct$a();
|
@@ -32023,7 +31879,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
32023
31879
|
a.push.apply(a, args);
|
32024
31880
|
var Constructor = Function.bind.apply(Parent, a);
|
32025
31881
|
var instance = new Constructor();
|
32026
|
-
if (Class) _setPrototypeOf
|
31882
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
32027
31883
|
return instance;
|
32028
31884
|
};
|
32029
31885
|
}
|
@@ -32059,7 +31915,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
32059
31915
|
configurable: true
|
32060
31916
|
}
|
32061
31917
|
});
|
32062
|
-
return _setPrototypeOf
|
31918
|
+
return _setPrototypeOf(Wrapper, Class);
|
32063
31919
|
};
|
32064
31920
|
|
32065
31921
|
return _wrapNativeSuper(Class);
|
@@ -33730,14 +33586,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
33730
33586
|
value: true
|
33731
33587
|
});
|
33732
33588
|
var _asyncToGenerator = asyncToGenerator.exports;
|
33733
|
-
var _defineProperty = defineProperty$
|
33589
|
+
var _defineProperty = defineProperty$5.exports;
|
33734
33590
|
var _regeneratorRuntime = require$$2;
|
33735
33591
|
var log$2 = loglevel.exports;
|
33736
33592
|
var operationRetrier = browser$4;
|
33737
33593
|
var declarativeTypeValidator = browser$6;
|
33738
33594
|
|
33739
33595
|
function _interopDefaultLegacy(e) {
|
33740
|
-
return e && _typeof$
|
33596
|
+
return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
|
33741
33597
|
'default': e
|
33742
33598
|
};
|
33743
33599
|
}
|
@@ -33791,14 +33647,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
33791
33647
|
var c = arguments.length,
|
33792
33648
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
33793
33649
|
d;
|
33794
|
-
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$
|
33650
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
33795
33651
|
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
33796
33652
|
}
|
33797
33653
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
33798
33654
|
}
|
33799
33655
|
|
33800
33656
|
function __metadata(metadataKey, metadataValue) {
|
33801
|
-
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$
|
33657
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
33802
33658
|
}
|
33803
33659
|
|
33804
33660
|
function prepareLine(prefix, args) {
|
@@ -34547,7 +34403,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
34547
34403
|
return Network;
|
34548
34404
|
}();
|
34549
34405
|
|
34550
|
-
var version = "0.5.
|
34406
|
+
var version = "0.5.3-rc.0";
|
34551
34407
|
|
34552
34408
|
var _class, _temp;
|
34553
34409
|
|
@@ -34728,11 +34584,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
34728
34584
|
})
|
34729
34585
|
};
|
34730
34586
|
_context4.next = 3;
|
34731
|
-
return _this4.network.post("".concat(_this4.config.mediaSetUrl), null,
|
34587
|
+
return _this4.network.post("".concat(_this4.config.mediaSetUrl), null, query, "application/json");
|
34732
34588
|
|
34733
34589
|
case 3:
|
34734
34590
|
response = _context4.sent;
|
34735
|
-
return _context4.abrupt("return", response.map(function (item) {
|
34591
|
+
return _context4.abrupt("return", response.body.map(function (item) {
|
34736
34592
|
if (item.code !== 200) {
|
34737
34593
|
throw new Error("Failed to obtain detailed information about Media items (failed SID ".concat(item.media_record.sid, ")"));
|
34738
34594
|
}
|
@@ -34757,7 +34613,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
34757
34613
|
|
34758
34614
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], exports['default'].prototype, "get", null);
|
34759
34615
|
|
34760
|
-
exports['default'] = __decorate([declarativeTypeValidator.validateConstructorTypes(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, [declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.literal(null)], [declarativeTypeValidator.pureObject,
|
34616
|
+
exports['default'] = __decorate([declarativeTypeValidator.validateConstructorTypes(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, [declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.literal(null)], [declarativeTypeValidator.pureObject, "undefined"]), __metadata("design:paramtypes", [String, String, Object, Object])], exports['default']); // Proper renames should happen in index.ts,
|
34761
34617
|
|
34762
34618
|
exports.Client = exports['default'];
|
34763
34619
|
exports.McsClient = exports['default'];
|
@@ -34802,7 +34658,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
34802
34658
|
function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); 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); }; }
|
34803
34659
|
|
34804
34660
|
function _isNativeReflectConstruct$7() { 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; } }
|
34805
|
-
var log$7 = Logger.scope(
|
34661
|
+
var log$7 = Logger.scope("Participant");
|
34806
34662
|
/**
|
34807
34663
|
* A participant represents a remote client in a conversation.
|
34808
34664
|
*/
|
@@ -34816,7 +34672,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
34816
34672
|
* @internal
|
34817
34673
|
*/
|
34818
34674
|
function Participant(data, sid, conversation, links, services) {
|
34819
|
-
var _data$bindings;
|
34675
|
+
var _data$roleSid, _data$bindings;
|
34820
34676
|
|
34821
34677
|
var _this;
|
34822
34678
|
|
@@ -34827,23 +34683,23 @@ this.Twilio.Conversations = (function (exports) {
|
|
34827
34683
|
_this.links = links;
|
34828
34684
|
_this.services = services;
|
34829
34685
|
_this.state = {
|
34830
|
-
attributes: parseAttributes(data.attributes,
|
34686
|
+
attributes: parseAttributes(data.attributes, "Retrieved malformed attributes from the server for participant: " + sid, log$7),
|
34831
34687
|
dateCreated: data.dateCreated ? parseTime$1(data.dateCreated) : null,
|
34832
34688
|
dateUpdated: data.dateCreated ? parseTime$1(data.dateUpdated) : null,
|
34833
34689
|
sid: sid,
|
34834
34690
|
typingTimeout: null,
|
34835
34691
|
isTyping: false,
|
34836
|
-
identity: data.identity
|
34837
|
-
roleSid: data.roleSid
|
34692
|
+
identity: data.identity,
|
34693
|
+
roleSid: (_data$roleSid = data.roleSid) !== null && _data$roleSid !== void 0 ? _data$roleSid : "",
|
34838
34694
|
lastReadMessageIndex: Number.isInteger(data.lastConsumedMessageIndex) ? data.lastConsumedMessageIndex : null,
|
34839
34695
|
lastReadTimestamp: data.lastConsumptionTimestamp ? parseTime$1(data.lastConsumptionTimestamp) : null,
|
34840
|
-
type: data.type ||
|
34696
|
+
type: data.type || "chat",
|
34841
34697
|
userInfo: data.userInfo,
|
34842
34698
|
bindings: (_data$bindings = data.bindings) !== null && _data$bindings !== void 0 ? _data$bindings : {}
|
34843
34699
|
};
|
34844
34700
|
|
34845
34701
|
if (!data.identity && !data.type) {
|
34846
|
-
throw new Error(
|
34702
|
+
throw new Error("Received invalid Participant object from server: Missing identity or type of Participant.");
|
34847
34703
|
}
|
34848
34704
|
|
34849
34705
|
return _this;
|
@@ -34963,7 +34819,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
34963
34819
|
}, {
|
34964
34820
|
key: "bindings",
|
34965
34821
|
get: function get() {
|
34966
|
-
|
34822
|
+
var _this$state$bindings;
|
34823
|
+
|
34824
|
+
return (_this$state$bindings = this.state.bindings) !== null && _this$state$bindings !== void 0 ? _this$state$bindings : {};
|
34967
34825
|
}
|
34968
34826
|
}, {
|
34969
34827
|
key: "_startTyping",
|
@@ -34975,13 +34833,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
34975
34833
|
function _startTyping(timeout) {
|
34976
34834
|
var _this2 = this;
|
34977
34835
|
|
34978
|
-
|
34836
|
+
if (this.state.typingTimeout) {
|
34837
|
+
clearTimeout(this.state.typingTimeout);
|
34838
|
+
}
|
34839
|
+
|
34979
34840
|
this.state.isTyping = true;
|
34980
|
-
this.emit(
|
34981
|
-
this.conversation.emit(
|
34982
|
-
this.state.typingTimeout = setTimeout(function () {
|
34841
|
+
this.emit("typingStarted", this);
|
34842
|
+
this.conversation.emit("typingStarted", this);
|
34843
|
+
this.state.typingTimeout = Number(setTimeout(function () {
|
34983
34844
|
return _this2._endTyping();
|
34984
|
-
}, timeout);
|
34845
|
+
}, timeout));
|
34985
34846
|
return this;
|
34986
34847
|
}
|
34987
34848
|
/**
|
@@ -34997,8 +34858,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
34997
34858
|
}
|
34998
34859
|
|
34999
34860
|
this.state.isTyping = false;
|
35000
|
-
this.emit(
|
35001
|
-
this.conversation.emit(
|
34861
|
+
this.emit("typingEnded", this);
|
34862
|
+
this.conversation.emit("typingEnded", this);
|
35002
34863
|
clearInterval(this.state.typingTimeout);
|
35003
34864
|
this.state.typingTimeout = null;
|
35004
34865
|
}
|
@@ -35011,35 +34872,35 @@ this.Twilio.Conversations = (function (exports) {
|
|
35011
34872
|
key: "_update",
|
35012
34873
|
value: function _update(data) {
|
35013
34874
|
var updateReasons = [];
|
35014
|
-
var updateAttributes = parseAttributes(data.attributes,
|
34875
|
+
var updateAttributes = parseAttributes(data.attributes, "Retrieved malformed attributes from the server for participant: " + this.state.sid, log$7);
|
35015
34876
|
|
35016
34877
|
if (data.attributes && !isEqual(this.state.attributes, updateAttributes)) {
|
35017
34878
|
this.state.attributes = updateAttributes;
|
35018
|
-
updateReasons.push(
|
34879
|
+
updateReasons.push("attributes");
|
35019
34880
|
}
|
35020
34881
|
|
35021
34882
|
var updatedDateUpdated = parseTime$1(data.dateUpdated);
|
35022
34883
|
|
35023
|
-
if (data.dateUpdated && updatedDateUpdated.getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
|
34884
|
+
if (data.dateUpdated && (updatedDateUpdated === null || updatedDateUpdated === void 0 ? void 0 : updatedDateUpdated.getTime()) !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
|
35024
34885
|
this.state.dateUpdated = updatedDateUpdated;
|
35025
|
-
updateReasons.push(
|
34886
|
+
updateReasons.push("dateUpdated");
|
35026
34887
|
}
|
35027
34888
|
|
35028
34889
|
var updatedDateCreated = parseTime$1(data.dateCreated);
|
35029
34890
|
|
35030
|
-
if (data.dateCreated && updatedDateCreated.getTime() !== (this.state.dateCreated && this.state.dateCreated.getTime())) {
|
34891
|
+
if (data.dateCreated && (updatedDateCreated === null || updatedDateCreated === void 0 ? void 0 : updatedDateCreated.getTime()) !== (this.state.dateCreated && this.state.dateCreated.getTime())) {
|
35031
34892
|
this.state.dateCreated = updatedDateCreated;
|
35032
|
-
updateReasons.push(
|
34893
|
+
updateReasons.push("dateCreated");
|
35033
34894
|
}
|
35034
34895
|
|
35035
34896
|
if (data.roleSid && this.state.roleSid !== data.roleSid) {
|
35036
34897
|
this.state.roleSid = data.roleSid;
|
35037
|
-
updateReasons.push(
|
34898
|
+
updateReasons.push("roleSid");
|
35038
34899
|
}
|
35039
34900
|
|
35040
34901
|
if ((Number.isInteger(data.lastConsumedMessageIndex) || data.lastConsumedMessageIndex === null) && this.state.lastReadMessageIndex !== data.lastConsumedMessageIndex) {
|
35041
34902
|
this.state.lastReadMessageIndex = data.lastConsumedMessageIndex;
|
35042
|
-
updateReasons.push(
|
34903
|
+
updateReasons.push("lastReadMessageIndex");
|
35043
34904
|
}
|
35044
34905
|
|
35045
34906
|
if (data.lastConsumptionTimestamp) {
|
@@ -35047,17 +34908,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
35047
34908
|
|
35048
34909
|
if (!this.state.lastReadTimestamp || this.state.lastReadTimestamp.getTime() !== lastReadTimestamp.getTime()) {
|
35049
34910
|
this.state.lastReadTimestamp = lastReadTimestamp;
|
35050
|
-
updateReasons.push(
|
34911
|
+
updateReasons.push("lastReadTimestamp");
|
35051
34912
|
}
|
35052
34913
|
}
|
35053
34914
|
|
35054
34915
|
if (data.bindings && !isEqual(this.state.bindings, data.bindings)) {
|
35055
34916
|
this.state.bindings = data.bindings;
|
35056
|
-
updateReasons.push(
|
34917
|
+
updateReasons.push("bindings");
|
35057
34918
|
}
|
35058
34919
|
|
35059
34920
|
if (updateReasons.length > 0) {
|
35060
|
-
this.emit(
|
34921
|
+
this.emit("updated", {
|
35061
34922
|
participant: this,
|
35062
34923
|
updateReasons: updateReasons
|
35063
34924
|
});
|
@@ -35077,12 +34938,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
35077
34938
|
while (1) {
|
35078
34939
|
switch (_context.prev = _context.next) {
|
35079
34940
|
case 0:
|
35080
|
-
if (!(this.type !=
|
34941
|
+
if (!(this.type != "chat")) {
|
35081
34942
|
_context.next = 2;
|
35082
34943
|
break;
|
35083
34944
|
}
|
35084
34945
|
|
35085
|
-
throw new Error(
|
34946
|
+
throw new Error("Getting User is not supported for this Participant type: " + this.type);
|
35086
34947
|
|
35087
34948
|
case 2:
|
35088
34949
|
return _context.abrupt("return", this.services.users.getUser(this.state.identity, this.state.userInfo));
|
@@ -35143,7 +35004,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35143
35004
|
switch (_context3.prev = _context3.next) {
|
35144
35005
|
case 0:
|
35145
35006
|
_context3.next = 2;
|
35146
|
-
return this.services.commandExecutor.mutateResource(
|
35007
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
35147
35008
|
attributes: JSON.stringify(attributes)
|
35148
35009
|
});
|
35149
35010
|
|
@@ -35169,18 +35030,18 @@ this.Twilio.Conversations = (function (exports) {
|
|
35169
35030
|
return Participant;
|
35170
35031
|
}(ReplayEventEmitter_1);
|
35171
35032
|
|
35172
|
-
_defineProperty$3(Participant, "typingStarted",
|
35033
|
+
_defineProperty$3(Participant, "typingStarted", "typingStarted");
|
35173
35034
|
|
35174
|
-
_defineProperty$3(Participant, "typingEnded",
|
35035
|
+
_defineProperty$3(Participant, "typingEnded", "typingEnded");
|
35175
35036
|
|
35176
|
-
_defineProperty$3(Participant, "updated",
|
35037
|
+
_defineProperty$3(Participant, "updated", "updated");
|
35177
35038
|
|
35178
35039
|
__decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
|
35179
35040
|
|
35180
35041
|
function _createSuper$6(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); }; }
|
35181
35042
|
|
35182
35043
|
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; } }
|
35183
|
-
var log$6 = Logger.scope(
|
35044
|
+
var log$6 = Logger.scope("Participants");
|
35184
35045
|
/**
|
35185
35046
|
* @classdesc Represents the collection of participants for the conversation
|
35186
35047
|
* @fires Participants#participantJoined
|
@@ -35199,6 +35060,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
35199
35060
|
_classCallCheck$4(this, Participants);
|
35200
35061
|
|
35201
35062
|
_this = _super.call(this);
|
35063
|
+
|
35064
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "rosterEntityPromise", null);
|
35065
|
+
|
35202
35066
|
_this.conversation = conversation;
|
35203
35067
|
_this.participants = participants;
|
35204
35068
|
_this.links = links;
|
@@ -35250,17 +35114,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
35250
35114
|
|
35251
35115
|
return this.rosterEntityPromise = this.rosterEntityPromise || this.services.syncClient.map({
|
35252
35116
|
id: rosterObjectName,
|
35253
|
-
mode:
|
35117
|
+
mode: "open_existing"
|
35254
35118
|
}).then(function (rosterMap) {
|
35255
|
-
rosterMap.on(
|
35256
|
-
log$6.debug(_this2.conversation.sid +
|
35119
|
+
rosterMap.on("itemAdded", function (args) {
|
35120
|
+
log$6.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
|
35257
35121
|
|
35258
35122
|
_this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
|
35259
|
-
_this2.emit(
|
35123
|
+
_this2.emit("participantJoined", participant);
|
35260
35124
|
});
|
35261
35125
|
});
|
35262
|
-
rosterMap.on(
|
35263
|
-
log$6.debug(_this2.conversation.sid +
|
35126
|
+
rosterMap.on("itemRemoved", function (args) {
|
35127
|
+
log$6.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
|
35264
35128
|
var participantSid = args.key;
|
35265
35129
|
|
35266
35130
|
if (!_this2.participants.has(participantSid)) {
|
@@ -35271,19 +35135,22 @@ this.Twilio.Conversations = (function (exports) {
|
|
35271
35135
|
|
35272
35136
|
_this2.participants.delete(participantSid);
|
35273
35137
|
|
35274
|
-
|
35138
|
+
if (!leftParticipant) {
|
35139
|
+
return;
|
35140
|
+
}
|
35141
|
+
|
35142
|
+
_this2.emit("participantLeft", leftParticipant);
|
35275
35143
|
});
|
35276
|
-
rosterMap.on(
|
35277
|
-
log$6.debug(_this2.conversation.sid +
|
35144
|
+
rosterMap.on("itemUpdated", function (args) {
|
35145
|
+
log$6.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
|
35278
35146
|
|
35279
35147
|
_this2.upsertParticipant(args.item.key, args.item.data);
|
35280
35148
|
});
|
35281
35149
|
var participantsPromises = [];
|
35282
|
-
var that = _this2;
|
35283
35150
|
|
35284
35151
|
var rosterMapHandler = function rosterMapHandler(paginator) {
|
35285
35152
|
paginator.items.forEach(function (item) {
|
35286
|
-
participantsPromises.push(
|
35153
|
+
participantsPromises.push(_this2.upsertParticipant(item.key, item.data));
|
35287
35154
|
});
|
35288
35155
|
return paginator.hasNextPage ? paginator.nextPage().then(rosterMapHandler) : null;
|
35289
35156
|
};
|
@@ -35296,11 +35163,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
35296
35163
|
}).catch(function (err) {
|
35297
35164
|
_this2.rosterEntityPromise = null;
|
35298
35165
|
|
35299
|
-
if (_this2.services.syncClient.connectionState !=
|
35300
|
-
log$6.error(
|
35166
|
+
if (_this2.services.syncClient.connectionState != "disconnected") {
|
35167
|
+
log$6.error("Failed to get roster object for conversation", _this2.conversation.sid, err);
|
35301
35168
|
}
|
35302
35169
|
|
35303
|
-
log$6.debug(
|
35170
|
+
log$6.debug("ERROR: Failed to get roster object for conversation", _this2.conversation.sid, err);
|
35304
35171
|
throw err;
|
35305
35172
|
});
|
35306
35173
|
}
|
@@ -35330,8 +35197,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
35330
35197
|
};
|
35331
35198
|
participant = new Participant(data, participantSid, this.conversation, links, this.services);
|
35332
35199
|
this.participants.set(participantSid, participant);
|
35333
|
-
participant.on(
|
35334
|
-
return _this3.emit(
|
35200
|
+
participant.on("updated", function (args) {
|
35201
|
+
return _this3.emit("participantUpdated", args);
|
35335
35202
|
});
|
35336
35203
|
return _context2.abrupt("return", participant);
|
35337
35204
|
|
@@ -35363,7 +35230,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35363
35230
|
while (1) {
|
35364
35231
|
switch (_context3.prev = _context3.next) {
|
35365
35232
|
case 0:
|
35366
|
-
return _context3.abrupt("return", this.rosterEntityPromise.then(function () {
|
35233
|
+
return _context3.abrupt("return", this.rosterEntityPromise ? this.rosterEntityPromise.then(function () {
|
35367
35234
|
var participants = [];
|
35368
35235
|
|
35369
35236
|
_this4.participants.forEach(function (participant) {
|
@@ -35371,7 +35238,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35371
35238
|
});
|
35372
35239
|
|
35373
35240
|
return participants;
|
35374
|
-
}));
|
35241
|
+
}) : []);
|
35375
35242
|
|
35376
35243
|
case 1:
|
35377
35244
|
case "end":
|
@@ -35402,15 +35269,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
35402
35269
|
while (1) {
|
35403
35270
|
switch (_context4.prev = _context4.next) {
|
35404
35271
|
case 0:
|
35405
|
-
return _context4.abrupt("return", this.rosterEntityPromise.then(function () {
|
35272
|
+
return _context4.abrupt("return", this.rosterEntityPromise ? this.rosterEntityPromise.then(function () {
|
35406
35273
|
var participant = _this5.participants.get(participantSid);
|
35407
35274
|
|
35408
35275
|
if (!participant) {
|
35409
|
-
throw new Error(
|
35276
|
+
throw new Error("Participant with SID " + participantSid + " was not found");
|
35410
35277
|
}
|
35411
35278
|
|
35412
35279
|
return participant;
|
35413
|
-
}));
|
35280
|
+
}) : null);
|
35414
35281
|
|
35415
35282
|
case 1:
|
35416
35283
|
case "end":
|
@@ -35443,7 +35310,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35443
35310
|
switch (_context5.prev = _context5.next) {
|
35444
35311
|
case 0:
|
35445
35312
|
foundParticipant = null;
|
35446
|
-
return _context5.abrupt("return", this.rosterEntityPromise.then(function () {
|
35313
|
+
return _context5.abrupt("return", this.rosterEntityPromise ? this.rosterEntityPromise.then(function () {
|
35447
35314
|
_this6.participants.forEach(function (participant) {
|
35448
35315
|
if (participant.identity === identity) {
|
35449
35316
|
foundParticipant = participant;
|
@@ -35451,11 +35318,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
35451
35318
|
});
|
35452
35319
|
|
35453
35320
|
if (!foundParticipant) {
|
35454
|
-
throw new Error(
|
35321
|
+
throw new Error("Participant with identity " + identity + " was not found");
|
35455
35322
|
}
|
35456
35323
|
|
35457
35324
|
return foundParticipant;
|
35458
|
-
}));
|
35325
|
+
}) : null);
|
35459
35326
|
|
35460
35327
|
case 2:
|
35461
35328
|
case "end":
|
@@ -35473,7 +35340,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35473
35340
|
}()
|
35474
35341
|
/**
|
35475
35342
|
* Add a chat participant to the conversation
|
35476
|
-
* @returns {Promise<
|
35343
|
+
* @returns {Promise<ParticipantResponse>}
|
35477
35344
|
*/
|
35478
35345
|
|
35479
35346
|
}, {
|
@@ -35485,9 +35352,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
35485
35352
|
switch (_context6.prev = _context6.next) {
|
35486
35353
|
case 0:
|
35487
35354
|
_context6.next = 2;
|
35488
|
-
return this.services.commandExecutor.mutateResource(
|
35355
|
+
return this.services.commandExecutor.mutateResource("post", this.links.participants, {
|
35489
35356
|
identity: identity,
|
35490
|
-
attributes: typeof attributes !==
|
35357
|
+
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
|
35491
35358
|
});
|
35492
35359
|
|
35493
35360
|
case 2:
|
@@ -35524,8 +35391,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
35524
35391
|
|
35525
35392
|
var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
35526
35393
|
var bindingOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
35527
|
-
return this.services.commandExecutor.mutateResource(
|
35528
|
-
attributes: typeof attributes !==
|
35394
|
+
return this.services.commandExecutor.mutateResource("post", this.links.participants, {
|
35395
|
+
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined,
|
35529
35396
|
messaging_binding: {
|
35530
35397
|
address: address,
|
35531
35398
|
proxy_address: proxyAddress,
|
@@ -35541,7 +35408,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35541
35408
|
}, {
|
35542
35409
|
key: "remove",
|
35543
35410
|
value: function remove(identity) {
|
35544
|
-
return this.services.commandExecutor.mutateResource(
|
35411
|
+
return this.services.commandExecutor.mutateResource("delete", "".concat(this.links.participants, "/").concat(identity));
|
35545
35412
|
}
|
35546
35413
|
}]);
|
35547
35414
|
|
@@ -35769,6 +35636,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
35769
35636
|
key: "getContentTemporaryUrl",
|
35770
35637
|
value: function () {
|
35771
35638
|
var _getContentTemporaryUrl = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
35639
|
+
var _this$mcsMedia$getCon, _this$mcsMedia;
|
35640
|
+
|
35772
35641
|
return _regeneratorRuntime$1.wrap(function _callee$(_context) {
|
35773
35642
|
while (1) {
|
35774
35643
|
switch (_context.prev = _context.next) {
|
@@ -35777,7 +35646,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35777
35646
|
return this._fetchMcsMedia();
|
35778
35647
|
|
35779
35648
|
case 2:
|
35780
|
-
return _context.abrupt("return", this.mcsMedia.getContentUrl());
|
35649
|
+
return _context.abrupt("return", (_this$mcsMedia$getCon = (_this$mcsMedia = this.mcsMedia) === null || _this$mcsMedia === void 0 ? void 0 : _this$mcsMedia.getContentUrl()) !== null && _this$mcsMedia$getCon !== void 0 ? _this$mcsMedia$getCon : null);
|
35781
35650
|
|
35782
35651
|
case 3:
|
35783
35652
|
case "end":
|
@@ -35807,6 +35676,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
35807
35676
|
key: "getCachedTemporaryUrl",
|
35808
35677
|
value: function () {
|
35809
35678
|
var _getCachedTemporaryUrl = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2() {
|
35679
|
+
var _this$mcsMedia$getCac, _this$mcsMedia2;
|
35680
|
+
|
35810
35681
|
return _regeneratorRuntime$1.wrap(function _callee2$(_context2) {
|
35811
35682
|
while (1) {
|
35812
35683
|
switch (_context2.prev = _context2.next) {
|
@@ -35815,7 +35686,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35815
35686
|
return this._fetchMcsMedia();
|
35816
35687
|
|
35817
35688
|
case 2:
|
35818
|
-
return _context2.abrupt("return", this.mcsMedia.getCachedContentUrl());
|
35689
|
+
return _context2.abrupt("return", (_this$mcsMedia$getCac = (_this$mcsMedia2 = this.mcsMedia) === null || _this$mcsMedia2 === void 0 ? void 0 : _this$mcsMedia2.getCachedContentUrl()) !== null && _this$mcsMedia$getCac !== void 0 ? _this$mcsMedia$getCac : null);
|
35819
35690
|
|
35820
35691
|
case 3:
|
35821
35692
|
case "end":
|
@@ -35858,7 +35729,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
35858
35729
|
break;
|
35859
35730
|
|
35860
35731
|
case 7:
|
35861
|
-
throw new Error(
|
35732
|
+
throw new Error("Media Content Service is unavailable");
|
35862
35733
|
|
35863
35734
|
case 8:
|
35864
35735
|
case "end":
|
@@ -36052,7 +35923,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36052
35923
|
}, {
|
36053
35924
|
key: "nextPage",
|
36054
35925
|
value: function nextPage() {
|
36055
|
-
return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error(
|
35926
|
+
return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error("No next page"));
|
36056
35927
|
}
|
36057
35928
|
/**
|
36058
35929
|
* Request the previous page. Does not modify the existing object.
|
@@ -36061,7 +35932,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36061
35932
|
}, {
|
36062
35933
|
key: "prevPage",
|
36063
35934
|
value: function prevPage() {
|
36064
|
-
return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error(
|
35935
|
+
return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error("No previous page"));
|
36065
35936
|
}
|
36066
35937
|
}]);
|
36067
35938
|
|
@@ -36120,7 +35991,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36120
35991
|
this.conversationSid = descriptor.conversation_sid;
|
36121
35992
|
this.channelMessageSid = descriptor.channel_message_sid;
|
36122
35993
|
this.participantSid = descriptor.participant_sid;
|
36123
|
-
this.status = descriptor.status ||
|
35994
|
+
this.status = descriptor.status || "queued";
|
36124
35995
|
this.errorCode = descriptor.error_code || 0;
|
36125
35996
|
this.dateCreated = descriptor.date_created;
|
36126
35997
|
this.dateUpdated = descriptor.date_updated;
|
@@ -36129,7 +36000,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36129
36000
|
function _createSuper$5(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); }; }
|
36130
36001
|
|
36131
36002
|
function _isNativeReflectConstruct$5() { 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; } }
|
36132
|
-
var log$5 = Logger.scope(
|
36003
|
+
var log$5 = Logger.scope("Message");
|
36133
36004
|
/**
|
36134
36005
|
* A message in a conversation.
|
36135
36006
|
*/
|
@@ -36147,7 +36018,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36147
36018
|
* @internal
|
36148
36019
|
*/
|
36149
36020
|
function Message(index, data, conversation, links, configuration, services) {
|
36150
|
-
var _data$
|
36021
|
+
var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid;
|
36151
36022
|
|
36152
36023
|
var _this;
|
36153
36024
|
|
@@ -36161,16 +36032,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
36161
36032
|
_this.state = {
|
36162
36033
|
sid: data.sid,
|
36163
36034
|
index: index,
|
36164
|
-
author:
|
36165
|
-
subject:
|
36166
|
-
body: data.text,
|
36035
|
+
author: data.author,
|
36036
|
+
subject: data.subject,
|
36037
|
+
body: (_data$text = data.text) !== null && _data$text !== void 0 ? _data$text : null,
|
36167
36038
|
timestamp: data.timestamp ? new Date(data.timestamp) : null,
|
36168
36039
|
dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,
|
36169
36040
|
lastUpdatedBy: (_data$lastUpdatedBy = data.lastUpdatedBy) !== null && _data$lastUpdatedBy !== void 0 ? _data$lastUpdatedBy : null,
|
36170
36041
|
attributes: parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(data.sid), log$5),
|
36171
|
-
type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type :
|
36172
|
-
media: data.type && data.type ===
|
36173
|
-
medias: data.type && data.type ===
|
36042
|
+
type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type : "text",
|
36043
|
+
media: data.type && data.type === "media" && data.media ? new Media(data.media, _this.services) : null,
|
36044
|
+
medias: data.type && data.type === "media" && data.medias ? data.medias.map(function (m) {
|
36174
36045
|
return new Media(m, _this.services);
|
36175
36046
|
}) : null,
|
36176
36047
|
participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
|
@@ -36303,7 +36174,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36303
36174
|
}, {
|
36304
36175
|
key: "attachedMedia",
|
36305
36176
|
get: function get() {
|
36306
|
-
return this.getMediaByCategory([
|
36177
|
+
return this.getMediaByCategory(["media"]);
|
36307
36178
|
}
|
36308
36179
|
/**
|
36309
36180
|
* The server-assigned unique identifier of the authoring participant.
|
@@ -36335,7 +36206,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36335
36206
|
value: function getMediaByCategory(categories) {
|
36336
36207
|
var _this$state$medias;
|
36337
36208
|
|
36338
|
-
return (_this$state$medias = this.state.medias)
|
36209
|
+
return ((_this$state$medias = this.state.medias) !== null && _this$state$medias !== void 0 ? _this$state$medias : []).filter(function (m) {
|
36339
36210
|
return categories.includes(m.category);
|
36340
36211
|
});
|
36341
36212
|
}
|
@@ -36350,8 +36221,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
36350
36221
|
value: function getEmailBody() {
|
36351
36222
|
var _this$getMediaByCateg, _this$getMediaByCateg2;
|
36352
36223
|
|
36353
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
36354
|
-
return (_this$getMediaByCateg = (_this$getMediaByCateg2 = this.getMediaByCategory([
|
36224
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "text/plain";
|
36225
|
+
return (_this$getMediaByCateg = (_this$getMediaByCateg2 = this.getMediaByCategory(["body"])) === null || _this$getMediaByCateg2 === void 0 ? void 0 : _this$getMediaByCateg2.filter(function (m) {
|
36355
36226
|
return m.contentType == type;
|
36356
36227
|
}).shift()) !== null && _this$getMediaByCateg !== void 0 ? _this$getMediaByCateg : null;
|
36357
36228
|
}
|
@@ -36366,8 +36237,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
36366
36237
|
value: function getEmailHistory() {
|
36367
36238
|
var _this$getMediaByCateg3, _this$getMediaByCateg4;
|
36368
36239
|
|
36369
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
36370
|
-
return (_this$getMediaByCateg3 = (_this$getMediaByCateg4 = this.getMediaByCategory([
|
36240
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "text/plain";
|
36241
|
+
return (_this$getMediaByCateg3 = (_this$getMediaByCateg4 = this.getMediaByCategory(["history"])) === null || _this$getMediaByCateg4 === void 0 ? void 0 : _this$getMediaByCateg4.filter(function (m) {
|
36371
36242
|
return m.contentType == type;
|
36372
36243
|
}).shift()) !== null && _this$getMediaByCateg3 !== void 0 ? _this$getMediaByCateg3 : null;
|
36373
36244
|
}
|
@@ -36376,41 +36247,41 @@ this.Twilio.Conversations = (function (exports) {
|
|
36376
36247
|
value: function _update(data) {
|
36377
36248
|
var updateReasons = [];
|
36378
36249
|
|
36379
|
-
if ((data.text || typeof data.text ===
|
36250
|
+
if ((data.text || typeof data.text === "string") && data.text !== this.state.body) {
|
36380
36251
|
this.state.body = data.text;
|
36381
|
-
updateReasons.push(
|
36252
|
+
updateReasons.push("body");
|
36382
36253
|
}
|
36383
36254
|
|
36384
36255
|
if (data.subject && data.subject !== this.state.subject) {
|
36385
36256
|
this.state.subject = data.subject;
|
36386
|
-
updateReasons.push(
|
36257
|
+
updateReasons.push("subject");
|
36387
36258
|
}
|
36388
36259
|
|
36389
36260
|
if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {
|
36390
36261
|
this.state.lastUpdatedBy = data.lastUpdatedBy;
|
36391
|
-
updateReasons.push(
|
36262
|
+
updateReasons.push("lastUpdatedBy");
|
36392
36263
|
}
|
36393
36264
|
|
36394
36265
|
if (data.author && data.author !== this.state.author) {
|
36395
36266
|
this.state.author = data.author;
|
36396
|
-
updateReasons.push(
|
36267
|
+
updateReasons.push("author");
|
36397
36268
|
}
|
36398
36269
|
|
36399
36270
|
if (data.dateUpdated && new Date(data.dateUpdated).getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
|
36400
36271
|
this.state.dateUpdated = new Date(data.dateUpdated);
|
36401
|
-
updateReasons.push(
|
36272
|
+
updateReasons.push("dateUpdated");
|
36402
36273
|
}
|
36403
36274
|
|
36404
36275
|
if (data.timestamp && new Date(data.timestamp).getTime() !== (this.state.timestamp && this.state.timestamp.getTime())) {
|
36405
36276
|
this.state.timestamp = new Date(data.timestamp);
|
36406
|
-
updateReasons.push(
|
36277
|
+
updateReasons.push("dateCreated");
|
36407
36278
|
}
|
36408
36279
|
|
36409
36280
|
var updatedAttributes = parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(this.sid), log$5);
|
36410
36281
|
|
36411
36282
|
if (!isEqual(this.state.attributes, updatedAttributes)) {
|
36412
36283
|
this.state.attributes = updatedAttributes;
|
36413
|
-
updateReasons.push(
|
36284
|
+
updateReasons.push("attributes");
|
36414
36285
|
}
|
36415
36286
|
|
36416
36287
|
var updatedAggregatedDelivery = data.delivery;
|
@@ -36420,16 +36291,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
36420
36291
|
if (isUpdatedAggregateDeliveryValid) {
|
36421
36292
|
if (!currentAggregatedDelivery) {
|
36422
36293
|
this.state.aggregatedDeliveryReceipt = new AggregatedDeliveryReceipt(updatedAggregatedDelivery);
|
36423
|
-
updateReasons.push(
|
36294
|
+
updateReasons.push("deliveryReceipt");
|
36424
36295
|
} else if (!currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)) {
|
36425
36296
|
currentAggregatedDelivery._update(updatedAggregatedDelivery);
|
36426
36297
|
|
36427
|
-
updateReasons.push(
|
36298
|
+
updateReasons.push("deliveryReceipt");
|
36428
36299
|
}
|
36429
36300
|
}
|
36430
36301
|
|
36431
36302
|
if (updateReasons.length > 0) {
|
36432
|
-
this.emit(
|
36303
|
+
this.emit("updated", {
|
36433
36304
|
message: this,
|
36434
36305
|
updateReasons: updateReasons
|
36435
36306
|
});
|
@@ -36458,7 +36329,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36458
36329
|
}
|
36459
36330
|
|
36460
36331
|
_context.next = 4;
|
36461
|
-
return this.conversation.getParticipantBySid(this.participantSid).catch(function () {
|
36332
|
+
return this.conversation.getParticipantBySid(this.state.participantSid).catch(function () {
|
36462
36333
|
log$5.debug("Participant with sid \"".concat(_this2.participantSid, "\" not found for message ").concat(_this2.sid));
|
36463
36334
|
return null;
|
36464
36335
|
});
|
@@ -36490,25 +36361,25 @@ this.Twilio.Conversations = (function (exports) {
|
|
36490
36361
|
return _context.abrupt("return", participant);
|
36491
36362
|
|
36492
36363
|
case 11:
|
36493
|
-
errorMesage =
|
36364
|
+
errorMesage = "Participant with ";
|
36494
36365
|
|
36495
36366
|
if (this.state.participantSid) {
|
36496
|
-
errorMesage +=
|
36367
|
+
errorMesage += "SID '" + this.state.participantSid + "' ";
|
36497
36368
|
}
|
36498
36369
|
|
36499
36370
|
if (this.state.author) {
|
36500
36371
|
if (this.state.participantSid) {
|
36501
|
-
errorMesage +=
|
36372
|
+
errorMesage += "or ";
|
36502
36373
|
}
|
36503
36374
|
|
36504
|
-
errorMesage +=
|
36375
|
+
errorMesage += "identity '" + this.state.author + "' ";
|
36505
36376
|
}
|
36506
36377
|
|
36507
|
-
if (errorMesage ===
|
36508
|
-
errorMesage =
|
36378
|
+
if (errorMesage === "Participant with ") {
|
36379
|
+
errorMesage = "Participant ";
|
36509
36380
|
}
|
36510
36381
|
|
36511
|
-
errorMesage +=
|
36382
|
+
errorMesage += "was not found";
|
36512
36383
|
throw new Error(errorMesage);
|
36513
36384
|
|
36514
36385
|
case 17:
|
@@ -36595,7 +36466,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36595
36466
|
switch (_context3.prev = _context3.next) {
|
36596
36467
|
case 0:
|
36597
36468
|
_context3.next = 2;
|
36598
|
-
return this.services.commandExecutor.mutateResource(
|
36469
|
+
return this.services.commandExecutor.mutateResource("delete", this.links.self);
|
36599
36470
|
|
36600
36471
|
case 2:
|
36601
36472
|
return _context3.abrupt("return", this);
|
@@ -36628,7 +36499,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36628
36499
|
switch (_context4.prev = _context4.next) {
|
36629
36500
|
case 0:
|
36630
36501
|
_context4.next = 2;
|
36631
|
-
return this.services.commandExecutor.mutateResource(
|
36502
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
36632
36503
|
body: body
|
36633
36504
|
});
|
36634
36505
|
|
@@ -36663,8 +36534,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
36663
36534
|
switch (_context5.prev = _context5.next) {
|
36664
36535
|
case 0:
|
36665
36536
|
_context5.next = 2;
|
36666
|
-
return this.services.commandExecutor.mutateResource(
|
36667
|
-
attributes: typeof attributes !==
|
36537
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
36538
|
+
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
|
36668
36539
|
});
|
36669
36540
|
|
36670
36541
|
case 2:
|
@@ -36702,11 +36573,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
36702
36573
|
case 0:
|
36703
36574
|
// We ignore existing mcsMedia members of each of the media entries.
|
36704
36575
|
// Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.
|
36705
|
-
sids = contentSet.map(function (m) {
|
36576
|
+
sids = contentSet === null || contentSet === void 0 ? void 0 : contentSet.map(function (m) {
|
36706
36577
|
return m.sid;
|
36707
36578
|
});
|
36708
36579
|
|
36709
|
-
if (!this.services.mcsClient) {
|
36580
|
+
if (!(this.services.mcsClient && sids)) {
|
36710
36581
|
_context6.next = 7;
|
36711
36582
|
break;
|
36712
36583
|
}
|
@@ -36720,7 +36591,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36720
36591
|
}));
|
36721
36592
|
|
36722
36593
|
case 7:
|
36723
|
-
throw new Error(
|
36594
|
+
throw new Error("Media Content Service is unavailable");
|
36724
36595
|
|
36725
36596
|
case 8:
|
36726
36597
|
case "end":
|
@@ -36747,8 +36618,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
36747
36618
|
while (1) {
|
36748
36619
|
switch (_context7.prev = _context7.next) {
|
36749
36620
|
case 0:
|
36750
|
-
messagesReceiptsUrl = this.configuration.links.messagesReceipts.replace(
|
36751
|
-
url = new UriBuilder$1(messagesReceiptsUrl).arg(
|
36621
|
+
messagesReceiptsUrl = this.configuration.links.messagesReceipts.replace("%s", this.conversation.sid).replace("%s", this.sid);
|
36622
|
+
url = new UriBuilder$1(messagesReceiptsUrl).arg("PageToken", options === null || options === void 0 ? void 0 : options.pageToken).arg("PageSize", options === null || options === void 0 ? void 0 : options.pageSize).build();
|
36752
36623
|
_context7.next = 4;
|
36753
36624
|
return this.services.network.get(url);
|
36754
36625
|
|
@@ -36782,20 +36653,20 @@ this.Twilio.Conversations = (function (exports) {
|
|
36782
36653
|
return Message;
|
36783
36654
|
}(ReplayEventEmitter_1);
|
36784
36655
|
|
36785
|
-
_defineProperty$3(Message, "updated",
|
36656
|
+
_defineProperty$3(Message, "updated", "updated");
|
36786
36657
|
|
36787
|
-
__decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [
|
36658
|
+
__decorate$1([validateTypes_1([nonEmptyString_1, "undefined"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailBody", null);
|
36788
36659
|
|
36789
|
-
__decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [
|
36660
|
+
__decorate$1([validateTypes_1([nonEmptyString_1, "undefined"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailHistory", null);
|
36790
36661
|
|
36791
|
-
__decorate$1([validateTypesAsync_1(
|
36662
|
+
__decorate$1([validateTypesAsync_1("string"), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateBody", null);
|
36792
36663
|
|
36793
36664
|
__decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateAttributes", null);
|
36794
36665
|
|
36795
36666
|
__decorate$1([validateTypesAsync_1(custom_1(function (value) {
|
36796
36667
|
return [value instanceof Array && value.length > 0 && value.reduce(function (a, c) {
|
36797
36668
|
return a && c instanceof Media;
|
36798
|
-
}, true),
|
36669
|
+
}, true), "a non-empty array of Media"];
|
36799
36670
|
})), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Array]), __metadata$1("design:returntype", Promise)], Message.prototype, "attachTemporaryUrlsFor", null);
|
36800
36671
|
|
36801
36672
|
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; } } }; }
|
@@ -36807,7 +36678,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36807
36678
|
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); 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); }; }
|
36808
36679
|
|
36809
36680
|
function _isNativeReflectConstruct$4() { 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; } }
|
36810
|
-
var log$4 = Logger.scope(
|
36681
|
+
var log$4 = Logger.scope("Messages");
|
36811
36682
|
/**
|
36812
36683
|
* Represents the collection of messages in a conversation
|
36813
36684
|
*/
|
@@ -36857,7 +36728,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36857
36728
|
case 2:
|
36858
36729
|
this.messagesListPromise = this.services.syncClient.list({
|
36859
36730
|
id: name,
|
36860
|
-
mode:
|
36731
|
+
mode: "open_existing"
|
36861
36732
|
});
|
36862
36733
|
_context.prev = 3;
|
36863
36734
|
_context.next = 6;
|
@@ -36865,7 +36736,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
36865
36736
|
|
36866
36737
|
case 6:
|
36867
36738
|
list = _context.sent;
|
36868
|
-
list.on(
|
36739
|
+
list.on("itemAdded", function (args) {
|
36869
36740
|
log$4.debug("".concat(_this2.conversation.sid, " itemAdded: ").concat(args.item.index));
|
36870
36741
|
var links = {
|
36871
36742
|
self: "".concat(_this2.conversation.links.messages, "/").concat(args.item.data.sid),
|
@@ -36875,33 +36746,37 @@ this.Twilio.Conversations = (function (exports) {
|
|
36875
36746
|
var message = new Message(args.item.index, args.item.data, _this2.conversation, links, _this2.configuration, _this2.services);
|
36876
36747
|
|
36877
36748
|
if (_this2.messagesByIndex.has(message.index)) {
|
36878
|
-
log$4.debug(
|
36749
|
+
log$4.debug("Message arrived, but is already known and ignored", _this2.conversation.sid, message.index);
|
36879
36750
|
return;
|
36880
36751
|
}
|
36881
36752
|
|
36882
36753
|
_this2.messagesByIndex.set(message.index, message);
|
36883
36754
|
|
36884
|
-
message.on(
|
36885
|
-
return _this2.emit(
|
36755
|
+
message.on("updated", function (args) {
|
36756
|
+
return _this2.emit("messageUpdated", args);
|
36886
36757
|
});
|
36887
36758
|
|
36888
|
-
_this2.emit(
|
36759
|
+
_this2.emit("messageAdded", message);
|
36889
36760
|
});
|
36890
|
-
list.on(
|
36761
|
+
list.on("itemRemoved", function (args) {
|
36891
36762
|
log$4.debug("#{this.conversation.sid} itemRemoved: ".concat(args.index));
|
36892
36763
|
var index = args.index;
|
36893
36764
|
|
36894
36765
|
if (_this2.messagesByIndex.has(index)) {
|
36895
36766
|
var message = _this2.messagesByIndex.get(index);
|
36896
36767
|
|
36768
|
+
if (!message) {
|
36769
|
+
return;
|
36770
|
+
}
|
36771
|
+
|
36897
36772
|
_this2.messagesByIndex.delete(message.index);
|
36898
36773
|
|
36899
|
-
message.removeAllListeners(
|
36774
|
+
message.removeAllListeners("updated");
|
36900
36775
|
|
36901
|
-
_this2.emit(
|
36776
|
+
_this2.emit("messageRemoved", message);
|
36902
36777
|
}
|
36903
36778
|
});
|
36904
|
-
list.on(
|
36779
|
+
list.on("itemUpdated", function (args) {
|
36905
36780
|
log$4.debug("".concat(_this2.conversation.sid, " itemUpdated: ").concat(args.item.index));
|
36906
36781
|
|
36907
36782
|
var message = _this2.messagesByIndex.get(args.item.index);
|
@@ -36917,11 +36792,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
36917
36792
|
_context.t0 = _context["catch"](3);
|
36918
36793
|
this.messagesListPromise = null;
|
36919
36794
|
|
36920
|
-
if (this.services.syncClient.connectionState !==
|
36921
|
-
log$4.error(
|
36795
|
+
if (this.services.syncClient.connectionState !== "disconnected") {
|
36796
|
+
log$4.error("Failed to get messages object for conversation", this.conversation.sid, _context.t0);
|
36922
36797
|
}
|
36923
36798
|
|
36924
|
-
log$4.debug(
|
36799
|
+
log$4.debug("ERROR: Failed to get messages object for conversation", this.conversation.sid, _context.t0);
|
36925
36800
|
throw _context.t0;
|
36926
36801
|
|
36927
36802
|
case 19:
|
@@ -36989,13 +36864,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
36989
36864
|
var _sendV = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(message) {
|
36990
36865
|
var _message$emailOptions;
|
36991
36866
|
|
36992
|
-
var media, _iterator, _step, _step$value, category, mediaContent;
|
36867
|
+
var media, _iterator, _step, _mediaContent$content, _mediaContent$media, _step$value, category, mediaContent;
|
36993
36868
|
|
36994
36869
|
return _regeneratorRuntime$1.wrap(function _callee3$(_context3) {
|
36995
36870
|
while (1) {
|
36996
36871
|
switch (_context3.prev = _context3.next) {
|
36997
36872
|
case 0:
|
36998
|
-
log$4.debug(
|
36873
|
+
log$4.debug("Sending message V2", message.mediaContent, message.attributes, message.emailOptions);
|
36999
36874
|
media = [];
|
37000
36875
|
_iterator = _createForOfIteratorHelper$2(message.mediaContent);
|
37001
36876
|
_context3.prev = 3;
|
@@ -37009,7 +36884,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
37009
36884
|
}
|
37010
36885
|
|
37011
36886
|
_step$value = _slicedToArray$1(_step.value, 2), category = _step$value[0], mediaContent = _step$value[1];
|
37012
|
-
log$4.debug("Adding media to a message as ".concat(mediaContent instanceof FormData ?
|
36887
|
+
log$4.debug("Adding media to a message as ".concat(mediaContent instanceof FormData ? "FormData" : "SendMediaOptions"), mediaContent);
|
37013
36888
|
_context3.t0 = media;
|
37014
36889
|
|
37015
36890
|
if (!(mediaContent instanceof FormData)) {
|
@@ -37027,7 +36902,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
37027
36902
|
|
37028
36903
|
case 15:
|
37029
36904
|
_context3.next = 17;
|
37030
|
-
return this.services.mcsClient.post(mediaContent.contentType, mediaContent.media, category, mediaContent.filename);
|
36905
|
+
return this.services.mcsClient.post((_mediaContent$content = mediaContent.contentType) !== null && _mediaContent$content !== void 0 ? _mediaContent$content : "", (_mediaContent$media = mediaContent.media) !== null && _mediaContent$media !== void 0 ? _mediaContent$media : "", category, mediaContent.filename);
|
37031
36906
|
|
37032
36907
|
case 17:
|
37033
36908
|
_context3.t1 = _context3.sent;
|
@@ -37060,13 +36935,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
37060
36935
|
|
37061
36936
|
case 30:
|
37062
36937
|
_context3.next = 32;
|
37063
|
-
return this.services.commandExecutor.mutateResource(
|
36938
|
+
return this.services.commandExecutor.mutateResource("post", this.conversation.links.messages, {
|
37064
36939
|
body: message.text,
|
37065
36940
|
subject: (_message$emailOptions = message.emailOptions) === null || _message$emailOptions === void 0 ? void 0 : _message$emailOptions.subject,
|
37066
36941
|
media_sids: media.map(function (m) {
|
37067
36942
|
return m.sid;
|
37068
36943
|
}),
|
37069
|
-
attributes: typeof message.attributes !==
|
36944
|
+
attributes: typeof message.attributes !== "undefined" ? JSON.stringify(message.attributes) : undefined
|
37070
36945
|
});
|
37071
36946
|
|
37072
36947
|
case 32:
|
@@ -37107,11 +36982,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
37107
36982
|
case 0:
|
37108
36983
|
attributes = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
37109
36984
|
emailOptions = _args4.length > 2 ? _args4[2] : undefined;
|
37110
|
-
log$4.debug(
|
36985
|
+
log$4.debug("Sending text message", message, attributes, emailOptions);
|
37111
36986
|
_context4.next = 5;
|
37112
|
-
return this.services.commandExecutor.mutateResource(
|
37113
|
-
body: message !== null && message !== void 0 ? message :
|
37114
|
-
attributes: typeof attributes !==
|
36987
|
+
return this.services.commandExecutor.mutateResource("post", this.conversation.links.messages, {
|
36988
|
+
body: message !== null && message !== void 0 ? message : "",
|
36989
|
+
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined,
|
37115
36990
|
subject: emailOptions === null || emailOptions === void 0 ? void 0 : emailOptions.subject
|
37116
36991
|
});
|
37117
36992
|
|
@@ -37144,6 +37019,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
37144
37019
|
key: "sendMedia",
|
37145
37020
|
value: function () {
|
37146
37021
|
var _sendMedia = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(mediaContent) {
|
37022
|
+
var _mediaContent$content2, _mediaContent$media2;
|
37023
|
+
|
37147
37024
|
var attributes,
|
37148
37025
|
emailOptions,
|
37149
37026
|
media,
|
@@ -37154,8 +37031,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
37154
37031
|
case 0:
|
37155
37032
|
attributes = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
37156
37033
|
emailOptions = _args5.length > 2 ? _args5[2] : undefined;
|
37157
|
-
log$4.debug(
|
37158
|
-
log$4.debug("Sending media message as ".concat(mediaContent instanceof FormData ?
|
37034
|
+
log$4.debug("Sending media message", mediaContent, attributes, emailOptions);
|
37035
|
+
log$4.debug("Sending media message as ".concat(mediaContent instanceof FormData ? "FormData" : "SendMediaOptions"), mediaContent, attributes);
|
37159
37036
|
|
37160
37037
|
if (!(mediaContent instanceof FormData)) {
|
37161
37038
|
_context5.next = 10;
|
@@ -37172,7 +37049,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
37172
37049
|
|
37173
37050
|
case 10:
|
37174
37051
|
_context5.next = 12;
|
37175
|
-
return this.services.mcsClient.post(mediaContent.contentType, mediaContent.media,
|
37052
|
+
return this.services.mcsClient.post((_mediaContent$content2 = mediaContent.contentType) !== null && _mediaContent$content2 !== void 0 ? _mediaContent$content2 : "", (_mediaContent$media2 = mediaContent.media) !== null && _mediaContent$media2 !== void 0 ? _mediaContent$media2 : "", "media", mediaContent.filename);
|
37176
37053
|
|
37177
37054
|
case 12:
|
37178
37055
|
_context5.t0 = _context5.sent;
|
@@ -37180,9 +37057,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
37180
37057
|
case 13:
|
37181
37058
|
media = _context5.t0;
|
37182
37059
|
_context5.next = 16;
|
37183
|
-
return this.services.commandExecutor.mutateResource(
|
37060
|
+
return this.services.commandExecutor.mutateResource("post", this.conversation.links.messages, {
|
37184
37061
|
media_sids: [media.sid],
|
37185
|
-
attributes: typeof attributes !==
|
37062
|
+
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
|
37186
37063
|
});
|
37187
37064
|
|
37188
37065
|
case 16:
|
@@ -37220,7 +37097,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
37220
37097
|
while (1) {
|
37221
37098
|
switch (_context6.prev = _context6.next) {
|
37222
37099
|
case 0:
|
37223
|
-
direction = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] :
|
37100
|
+
direction = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : "backwards";
|
37224
37101
|
return _context6.abrupt("return", this._getMessages(pageSize, anchor, direction));
|
37225
37102
|
|
37226
37103
|
case 2:
|
@@ -37244,7 +37121,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
37244
37121
|
|
37245
37122
|
// Due to an inconsistency between Sync and Chat conventions, next and
|
37246
37123
|
// previous pages should be swapped.
|
37247
|
-
var shouldReverse = order ===
|
37124
|
+
var shouldReverse = order === "desc";
|
37248
37125
|
|
37249
37126
|
var nextPage = function nextPage() {
|
37250
37127
|
return page.nextPage().then(function (page) {
|
@@ -37288,8 +37165,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
37288
37165
|
};
|
37289
37166
|
var message = new Message(index, value, this.conversation, links, this.configuration, this.services);
|
37290
37167
|
this.messagesByIndex.set(message.index, message);
|
37291
|
-
message.on(
|
37292
|
-
return _this4.emit(
|
37168
|
+
message.on("updated", function (args) {
|
37169
|
+
return _this4.emit("messageUpdated", args);
|
37293
37170
|
});
|
37294
37171
|
return message;
|
37295
37172
|
}
|
@@ -37320,17 +37197,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
37320
37197
|
switch (_context7.prev = _context7.next) {
|
37321
37198
|
case 0:
|
37322
37199
|
pageSize = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : 30;
|
37323
|
-
anchor = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] :
|
37324
|
-
direction = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] :
|
37325
|
-
order = direction ===
|
37200
|
+
anchor = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : "end";
|
37201
|
+
direction = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : "forward";
|
37202
|
+
order = direction === "backwards" ? "desc" : "asc";
|
37326
37203
|
_context7.next = 6;
|
37327
37204
|
return this.messagesListPromise;
|
37328
37205
|
|
37329
37206
|
case 6:
|
37330
37207
|
list = _context7.sent;
|
37331
37208
|
_context7.next = 9;
|
37332
|
-
return list.getItems({
|
37333
|
-
from: anchor !==
|
37209
|
+
return list === null || list === void 0 ? void 0 : list.getItems({
|
37210
|
+
from: anchor !== "end" ? anchor : void 0,
|
37334
37211
|
pageSize: pageSize,
|
37335
37212
|
order: order,
|
37336
37213
|
limit: pageSize // @todo Limit equals pageSize by default in Sync. This is probably not ideal.
|
@@ -37522,19 +37399,19 @@ this.Twilio.Conversations = (function (exports) {
|
|
37522
37399
|
}, {
|
37523
37400
|
key: "addMedia",
|
37524
37401
|
value: function addMedia(payload) {
|
37525
|
-
if (typeof FormData ===
|
37526
|
-
throw new Error(
|
37402
|
+
if (typeof FormData === "undefined" && payload instanceof FormData) {
|
37403
|
+
throw new Error("Could not add FormData content whilst not in a browser");
|
37527
37404
|
}
|
37528
37405
|
|
37529
37406
|
if (!(payload instanceof FormData)) {
|
37530
37407
|
var mediaOptions = payload;
|
37531
37408
|
|
37532
37409
|
if (!mediaOptions.contentType || !mediaOptions.media) {
|
37533
|
-
throw new Error(
|
37410
|
+
throw new Error("Media content in SendMediaOptions must contain non-empty contentType and media");
|
37534
37411
|
}
|
37535
37412
|
}
|
37536
37413
|
|
37537
|
-
this.message.mediaContent.push([
|
37414
|
+
this.message.mediaContent.push(["media", payload]);
|
37538
37415
|
return this;
|
37539
37416
|
}
|
37540
37417
|
/**
|
@@ -37572,18 +37449,18 @@ this.Twilio.Conversations = (function (exports) {
|
|
37572
37449
|
|
37573
37450
|
|
37574
37451
|
this.emailBodies.forEach(function (body) {
|
37575
|
-
_this.message.mediaContent.push([
|
37452
|
+
_this.message.mediaContent.push(["body", body]);
|
37576
37453
|
});
|
37577
37454
|
this.emailHistories.forEach(function (history) {
|
37578
|
-
_this.message.mediaContent.push([
|
37455
|
+
_this.message.mediaContent.push(["history", history]);
|
37579
37456
|
});
|
37580
37457
|
return this.message;
|
37581
37458
|
}
|
37582
37459
|
}, {
|
37583
37460
|
key: "getPayloadContentType",
|
37584
37461
|
value: function getPayloadContentType(payload) {
|
37585
|
-
if (typeof FormData !==
|
37586
|
-
return payload.get(
|
37462
|
+
if (typeof FormData !== "undefined" && payload instanceof FormData) {
|
37463
|
+
return payload.get("Content-Type");
|
37587
37464
|
}
|
37588
37465
|
|
37589
37466
|
return payload.contentType;
|
@@ -37602,21 +37479,21 @@ this.Twilio.Conversations = (function (exports) {
|
|
37602
37479
|
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); 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); }; }
|
37603
37480
|
|
37604
37481
|
function _isNativeReflectConstruct$3() { 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; } }
|
37605
|
-
var log$3 = Logger.scope(
|
37482
|
+
var log$3 = Logger.scope("Conversation");
|
37606
37483
|
var fieldMappings = {
|
37607
|
-
lastMessage:
|
37608
|
-
attributes:
|
37609
|
-
createdBy:
|
37610
|
-
dateCreated:
|
37611
|
-
dateUpdated:
|
37612
|
-
friendlyName:
|
37613
|
-
lastConsumedMessageIndex:
|
37614
|
-
notificationLevel:
|
37615
|
-
sid:
|
37616
|
-
status:
|
37617
|
-
uniqueName:
|
37618
|
-
state:
|
37619
|
-
bindings:
|
37484
|
+
lastMessage: "lastMessage",
|
37485
|
+
attributes: "attributes",
|
37486
|
+
createdBy: "createdBy",
|
37487
|
+
dateCreated: "dateCreated",
|
37488
|
+
dateUpdated: "dateUpdated",
|
37489
|
+
friendlyName: "friendlyName",
|
37490
|
+
lastConsumedMessageIndex: "lastConsumedMessageIndex",
|
37491
|
+
notificationLevel: "notificationLevel",
|
37492
|
+
sid: "sid",
|
37493
|
+
status: "status",
|
37494
|
+
uniqueName: "uniqueName",
|
37495
|
+
state: "state",
|
37496
|
+
bindings: "bindings"
|
37620
37497
|
};
|
37621
37498
|
|
37622
37499
|
function parseTime(timeString) {
|
@@ -37666,13 +37543,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
37666
37543
|
try {
|
37667
37544
|
JSON.stringify(attributes);
|
37668
37545
|
} catch (e) {
|
37669
|
-
throw new Error(
|
37546
|
+
throw new Error("Attributes must be a valid JSON object.");
|
37670
37547
|
}
|
37671
37548
|
|
37672
37549
|
_this.entityName = descriptor.channel;
|
37673
37550
|
_this.channelState = {
|
37674
37551
|
uniqueName: uniqueName,
|
37675
|
-
status:
|
37552
|
+
status: "notParticipating",
|
37676
37553
|
attributes: attributes,
|
37677
37554
|
createdBy: createdBy,
|
37678
37555
|
dateCreated: dateCreated,
|
@@ -37692,25 +37569,31 @@ this.Twilio.Conversations = (function (exports) {
|
|
37692
37569
|
_this.participants = new Map();
|
37693
37570
|
_this.participantsEntity = new Participants(_assertThisInitialized$3(_this), _this.participants, participantsLinks, _this.configuration, _this.services);
|
37694
37571
|
|
37695
|
-
_this.participantsEntity.on(
|
37572
|
+
_this.participantsEntity.on("participantJoined", function (participant) {
|
37573
|
+
return _this.emit("participantJoined", participant);
|
37574
|
+
});
|
37696
37575
|
|
37697
|
-
_this.participantsEntity.on(
|
37576
|
+
_this.participantsEntity.on("participantLeft", function (participant) {
|
37577
|
+
return _this.emit("participantLeft", participant);
|
37578
|
+
});
|
37698
37579
|
|
37699
|
-
_this.participantsEntity.on(
|
37700
|
-
return _this.emit(
|
37580
|
+
_this.participantsEntity.on("participantUpdated", function (args) {
|
37581
|
+
return _this.emit("participantUpdated", args);
|
37701
37582
|
});
|
37702
37583
|
|
37703
37584
|
_this.messagesEntity = new Messages(_assertThisInitialized$3(_this), configuration, services);
|
37704
37585
|
|
37705
|
-
_this.messagesEntity.on(
|
37586
|
+
_this.messagesEntity.on("messageAdded", function (message) {
|
37706
37587
|
return _this._onMessageAdded(message);
|
37707
37588
|
});
|
37708
37589
|
|
37709
|
-
_this.messagesEntity.on(
|
37710
|
-
return _this.emit(
|
37590
|
+
_this.messagesEntity.on("messageUpdated", function (args) {
|
37591
|
+
return _this.emit("messageUpdated", args);
|
37711
37592
|
});
|
37712
37593
|
|
37713
|
-
_this.messagesEntity.on(
|
37594
|
+
_this.messagesEntity.on("messageRemoved", function (message) {
|
37595
|
+
return _this.emit("messageRemoved", message);
|
37596
|
+
});
|
37714
37597
|
|
37715
37598
|
return _this;
|
37716
37599
|
}
|
@@ -37775,7 +37658,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
37775
37658
|
}, {
|
37776
37659
|
key: "createdBy",
|
37777
37660
|
get: function get() {
|
37778
|
-
|
37661
|
+
var _this$channelState$cr;
|
37662
|
+
|
37663
|
+
return (_this$channelState$cr = this.channelState.createdBy) !== null && _this$channelState$cr !== void 0 ? _this$channelState$cr : "";
|
37779
37664
|
}
|
37780
37665
|
/**
|
37781
37666
|
* Custom attributes of the conversation.
|
@@ -37802,7 +37687,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
37802
37687
|
}, {
|
37803
37688
|
key: "lastMessage",
|
37804
37689
|
get: function get() {
|
37805
|
-
|
37690
|
+
var _this$channelState$la;
|
37691
|
+
|
37692
|
+
return (_this$channelState$la = this.channelState.lastMessage) !== null && _this$channelState$la !== void 0 ? _this$channelState$la : undefined;
|
37806
37693
|
}
|
37807
37694
|
/**
|
37808
37695
|
* User notification level for this conversation.
|
@@ -37811,7 +37698,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
37811
37698
|
}, {
|
37812
37699
|
key: "notificationLevel",
|
37813
37700
|
get: function get() {
|
37814
|
-
|
37701
|
+
var _this$channelState$no;
|
37702
|
+
|
37703
|
+
return (_this$channelState$no = this.channelState.notificationLevel) !== null && _this$channelState$no !== void 0 ? _this$channelState$no : "default";
|
37815
37704
|
}
|
37816
37705
|
}, {
|
37817
37706
|
key: "bindings",
|
@@ -37846,16 +37735,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
37846
37735
|
|
37847
37736
|
return this.entityPromise = (_this$entityPromise = this.entityPromise) !== null && _this$entityPromise !== void 0 ? _this$entityPromise : this.services.syncClient.document({
|
37848
37737
|
id: this.entityName,
|
37849
|
-
mode:
|
37738
|
+
mode: "open_existing"
|
37850
37739
|
}).then(function (entity) {
|
37851
37740
|
_this2.entity = entity;
|
37852
37741
|
|
37853
|
-
_this2.entity.on(
|
37742
|
+
_this2.entity.on("updated", function (args) {
|
37854
37743
|
_this2._update(args.data);
|
37855
37744
|
});
|
37856
37745
|
|
37857
|
-
_this2.entity.on(
|
37858
|
-
return _this2.emit(
|
37746
|
+
_this2.entity.on("removed", function () {
|
37747
|
+
return _this2.emit("removed", _this2);
|
37859
37748
|
});
|
37860
37749
|
|
37861
37750
|
_this2._update(_this2.entity.data);
|
@@ -37865,11 +37754,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
37865
37754
|
_this2.entity = null;
|
37866
37755
|
_this2.entityPromise = null;
|
37867
37756
|
|
37868
|
-
if (_this2.services.syncClient.connectionState !=
|
37869
|
-
log$3.error(
|
37757
|
+
if (_this2.services.syncClient.connectionState != "disconnected") {
|
37758
|
+
log$3.error("Failed to get conversation object", err);
|
37870
37759
|
}
|
37871
37760
|
|
37872
|
-
log$3.debug(
|
37761
|
+
log$3.debug("ERROR: Failed to get conversation object", err);
|
37873
37762
|
throw err;
|
37874
37763
|
});
|
37875
37764
|
}
|
@@ -37884,7 +37773,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
37884
37773
|
key: "_subscribeStreams",
|
37885
37774
|
value: function () {
|
37886
37775
|
var _subscribeStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
37887
|
-
var messagesObjectName, rosterObjectName;
|
37776
|
+
var _this$entity, _this$entity2, _this$entity3, messagesObjectName, rosterObjectName;
|
37777
|
+
|
37888
37778
|
return _regeneratorRuntime$1.wrap(function _callee$(_context) {
|
37889
37779
|
while (1) {
|
37890
37780
|
switch (_context.prev = _context.next) {
|
@@ -37894,9 +37784,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
37894
37784
|
return this._subscribe();
|
37895
37785
|
|
37896
37786
|
case 3:
|
37897
|
-
log$3.trace(
|
37898
|
-
messagesObjectName = this.entity.data.messages;
|
37899
|
-
rosterObjectName = this.entity.data.roster;
|
37787
|
+
log$3.trace("_subscribeStreams, this.entity.data=", (_this$entity = this.entity) === null || _this$entity === void 0 ? void 0 : _this$entity.data);
|
37788
|
+
messagesObjectName = (_this$entity2 = this.entity) === null || _this$entity2 === void 0 ? void 0 : _this$entity2.data.messages;
|
37789
|
+
rosterObjectName = (_this$entity3 = this.entity) === null || _this$entity3 === void 0 ? void 0 : _this$entity3.data.roster;
|
37900
37790
|
_context.next = 8;
|
37901
37791
|
return Promise.all([this.messagesEntity.subscribe(messagesObjectName), this.participantsEntity.subscribe(rosterObjectName)]);
|
37902
37792
|
|
@@ -37908,11 +37798,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
37908
37798
|
_context.prev = 10;
|
37909
37799
|
_context.t0 = _context["catch"](0);
|
37910
37800
|
|
37911
|
-
if (this.services.syncClient.connectionState !==
|
37912
|
-
log$3.error(
|
37801
|
+
if (this.services.syncClient.connectionState !== "disconnected") {
|
37802
|
+
log$3.error("Failed to subscribe on conversation objects", this.sid, _context.t0);
|
37913
37803
|
}
|
37914
37804
|
|
37915
|
-
log$3.debug(
|
37805
|
+
log$3.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context.t0);
|
37916
37806
|
throw _context.t0;
|
37917
37807
|
|
37918
37808
|
case 15:
|
@@ -37989,19 +37879,19 @@ this.Twilio.Conversations = (function (exports) {
|
|
37989
37879
|
|
37990
37880
|
this.channelState.status = status;
|
37991
37881
|
|
37992
|
-
if (status ===
|
37882
|
+
if (status === "joined") {
|
37993
37883
|
this._subscribeStreams().catch(function (err) {
|
37994
|
-
log$3.debug(
|
37884
|
+
log$3.debug("ERROR while setting conversation status " + status, err);
|
37995
37885
|
|
37996
|
-
if (_this3.services.syncClient.connectionState !==
|
37886
|
+
if (_this3.services.syncClient.connectionState !== "disconnected") {
|
37997
37887
|
throw err;
|
37998
37888
|
}
|
37999
37889
|
});
|
38000
37890
|
} else if (this.entityPromise) {
|
38001
37891
|
this._unsubscribe().catch(function (err) {
|
38002
|
-
log$3.debug(
|
37892
|
+
log$3.debug("ERROR while setting conversation status " + status, err);
|
38003
37893
|
|
38004
|
-
if (_this3.services.syncClient.connectionState !==
|
37894
|
+
if (_this3.services.syncClient.connectionState !== "disconnected") {
|
38005
37895
|
throw err;
|
38006
37896
|
}
|
38007
37897
|
});
|
@@ -38025,9 +37915,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
38025
37915
|
* @internal
|
38026
37916
|
*/
|
38027
37917
|
function _update(update) {
|
38028
|
-
var _update$lastMessage, _update$lastMessage2, _this$channelState$
|
37918
|
+
var _update$lastMessage, _update$lastMessage2, _this$channelState$la2, _this$channelState$la3, _this$channelState$lo;
|
38029
37919
|
|
38030
|
-
log$3.trace(
|
37920
|
+
log$3.trace("_update", update);
|
38031
37921
|
Conversation.preprocessUpdate(update, this.sid);
|
38032
37922
|
var updateReasons = new Set();
|
38033
37923
|
|
@@ -38041,7 +37931,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38041
37931
|
|
38042
37932
|
switch (localKey) {
|
38043
37933
|
case fieldMappings.status:
|
38044
|
-
if (!update.status || update.status ===
|
37934
|
+
if (!update.status || update.status === "unknown" || this.channelState.status === update.status) {
|
38045
37935
|
break;
|
38046
37936
|
}
|
38047
37937
|
|
@@ -38064,7 +37954,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38064
37954
|
}
|
38065
37955
|
|
38066
37956
|
this.channelState.lastReadMessageIndex = update.lastConsumedMessageIndex;
|
38067
|
-
updateReasons.add(
|
37957
|
+
updateReasons.add("lastReadMessageIndex");
|
38068
37958
|
break;
|
38069
37959
|
|
38070
37960
|
case fieldMappings.lastMessage:
|
@@ -38081,7 +37971,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38081
37971
|
updateReasons.add(localKey);
|
38082
37972
|
}
|
38083
37973
|
|
38084
|
-
if (((_update$lastMessage2 = update.lastMessage) === null || _update$lastMessage2 === void 0 ? void 0 : _update$lastMessage2.timestamp) !== undefined && ((_this$channelState$
|
37974
|
+
if (((_update$lastMessage2 = update.lastMessage) === null || _update$lastMessage2 === void 0 ? void 0 : _update$lastMessage2.timestamp) !== undefined && ((_this$channelState$la2 = this.channelState.lastMessage) === null || _this$channelState$la2 === void 0 ? void 0 : (_this$channelState$la3 = _this$channelState$la2.dateCreated) === null || _this$channelState$la3 === void 0 ? void 0 : _this$channelState$la3.getTime()) !== update.lastMessage.timestamp.getTime()) {
|
38085
37975
|
this.channelState.lastMessage.dateCreated = update.lastMessage.timestamp;
|
38086
37976
|
updateReasons.add(localKey);
|
38087
37977
|
}
|
@@ -38131,7 +38021,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38131
38021
|
}
|
38132
38022
|
|
38133
38023
|
if (updateReasons.size > 0) {
|
38134
|
-
this.emit(
|
38024
|
+
this.emit("updated", {
|
38135
38025
|
conversation: this,
|
38136
38026
|
updateReasons: _toConsumableArray(updateReasons)
|
38137
38027
|
});
|
@@ -38163,7 +38053,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38163
38053
|
_iterator.f();
|
38164
38054
|
}
|
38165
38055
|
|
38166
|
-
this.emit(
|
38056
|
+
this.emit("messageAdded", message);
|
38167
38057
|
}
|
38168
38058
|
}, {
|
38169
38059
|
key: "_setLastReadMessageIndex",
|
@@ -38175,7 +38065,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38175
38065
|
switch (_context3.prev = _context3.next) {
|
38176
38066
|
case 0:
|
38177
38067
|
_context3.next = 2;
|
38178
|
-
return this.services.commandExecutor.mutateResource(
|
38068
|
+
return this.services.commandExecutor.mutateResource("post", "".concat(this.configuration.links.myConversations, "/").concat(this.sid), {
|
38179
38069
|
last_read_message_index: index
|
38180
38070
|
});
|
38181
38071
|
|
@@ -38284,7 +38174,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38284
38174
|
return this._subscribeStreams();
|
38285
38175
|
|
38286
38176
|
case 2:
|
38287
|
-
if (!(index < this.lastReadMessageIndex)) {
|
38177
|
+
if (!(index < (this.lastReadMessageIndex || 0))) {
|
38288
38178
|
_context6.next = 6;
|
38289
38179
|
break;
|
38290
38180
|
}
|
@@ -38329,7 +38219,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38329
38219
|
switch (_context7.prev = _context7.next) {
|
38330
38220
|
case 0:
|
38331
38221
|
_context7.next = 2;
|
38332
|
-
return this.services.commandExecutor.mutateResource(
|
38222
|
+
return this.services.commandExecutor.mutateResource("delete", this.links.self);
|
38333
38223
|
|
38334
38224
|
case 2:
|
38335
38225
|
return _context7.abrupt("return", this);
|
@@ -38464,6 +38354,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
38464
38354
|
key: "getParticipantsCount",
|
38465
38355
|
value: function () {
|
38466
38356
|
var _getParticipantsCount = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11() {
|
38357
|
+
var _response$body$partic;
|
38358
|
+
|
38467
38359
|
var url, response;
|
38468
38360
|
return _regeneratorRuntime$1.wrap(function _callee11$(_context11) {
|
38469
38361
|
while (1) {
|
@@ -38475,7 +38367,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38475
38367
|
|
38476
38368
|
case 3:
|
38477
38369
|
response = _context11.sent;
|
38478
|
-
return _context11.abrupt("return", response.body.participants_count);
|
38370
|
+
return _context11.abrupt("return", (_response$body$partic = response.body.participants_count) !== null && _response$body$partic !== void 0 ? _response$body$partic : 0);
|
38479
38371
|
|
38480
38372
|
case 5:
|
38481
38373
|
case "end":
|
@@ -38528,14 +38420,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
38528
38420
|
}, {
|
38529
38421
|
key: "getParticipantByIdentity",
|
38530
38422
|
value: function () {
|
38531
|
-
var _getParticipantByIdentity = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee13(
|
38423
|
+
var _getParticipantByIdentity = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee13() {
|
38424
|
+
var identity,
|
38425
|
+
_args13 = arguments;
|
38532
38426
|
return _regeneratorRuntime$1.wrap(function _callee13$(_context13) {
|
38533
38427
|
while (1) {
|
38534
38428
|
switch (_context13.prev = _context13.next) {
|
38535
38429
|
case 0:
|
38536
|
-
|
38430
|
+
identity = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : "";
|
38431
|
+
return _context13.abrupt("return", this.participantsEntity.getParticipantByIdentity(identity !== null && identity !== void 0 ? identity : ""));
|
38537
38432
|
|
38538
|
-
case
|
38433
|
+
case 2:
|
38539
38434
|
case "end":
|
38540
38435
|
return _context13.stop();
|
38541
38436
|
}
|
@@ -38543,7 +38438,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38543
38438
|
}, _callee13, this);
|
38544
38439
|
}));
|
38545
38440
|
|
38546
|
-
function getParticipantByIdentity(
|
38441
|
+
function getParticipantByIdentity() {
|
38547
38442
|
return _getParticipantByIdentity.apply(this, arguments);
|
38548
38443
|
}
|
38549
38444
|
|
@@ -38564,6 +38459,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
38564
38459
|
key: "getMessagesCount",
|
38565
38460
|
value: function () {
|
38566
38461
|
var _getMessagesCount = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee14() {
|
38462
|
+
var _response$body$messag;
|
38463
|
+
|
38567
38464
|
var url, response;
|
38568
38465
|
return _regeneratorRuntime$1.wrap(function _callee14$(_context14) {
|
38569
38466
|
while (1) {
|
@@ -38575,7 +38472,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38575
38472
|
|
38576
38473
|
case 3:
|
38577
38474
|
response = _context14.sent;
|
38578
|
-
return _context14.abrupt("return", response.body.messages_count);
|
38475
|
+
return _context14.abrupt("return", (_response$body$messag = response.body.messages_count) !== null && _response$body$messag !== void 0 ? _response$body$messag : 0);
|
38579
38476
|
|
38580
38477
|
case 5:
|
38581
38478
|
case "end":
|
@@ -38628,12 +38525,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
38628
38525
|
break;
|
38629
38526
|
}
|
38630
38527
|
|
38631
|
-
throw new Error(
|
38528
|
+
throw new Error("Conversation was not found in the user conversations list");
|
38632
38529
|
|
38633
38530
|
case 6:
|
38634
38531
|
unreadMessageCount = response.body.unread_messages_count;
|
38635
38532
|
|
38636
|
-
if (!(typeof unreadMessageCount ===
|
38533
|
+
if (!(typeof unreadMessageCount === "number")) {
|
38637
38534
|
_context15.next = 9;
|
38638
38535
|
break;
|
38639
38536
|
}
|
@@ -38670,7 +38567,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38670
38567
|
switch (_context16.prev = _context16.next) {
|
38671
38568
|
case 0:
|
38672
38569
|
_context16.next = 2;
|
38673
|
-
return this.services.commandExecutor.mutateResource(
|
38570
|
+
return this.services.commandExecutor.mutateResource("post", this.links.participants, {
|
38674
38571
|
identity: this.configuration.userIdentity
|
38675
38572
|
});
|
38676
38573
|
|
@@ -38703,13 +38600,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
38703
38600
|
while (1) {
|
38704
38601
|
switch (_context17.prev = _context17.next) {
|
38705
38602
|
case 0:
|
38706
|
-
if (!(this.channelState.status ===
|
38603
|
+
if (!(this.channelState.status === "joined")) {
|
38707
38604
|
_context17.next = 3;
|
38708
38605
|
break;
|
38709
38606
|
}
|
38710
38607
|
|
38711
38608
|
_context17.next = 3;
|
38712
|
-
return this.services.commandExecutor.mutateResource(
|
38609
|
+
return this.services.commandExecutor.mutateResource("delete", "".concat(this.links.participants, "/").concat(this.configuration.userIdentity));
|
38713
38610
|
|
38714
38611
|
case 3:
|
38715
38612
|
return _context17.abrupt("return", this);
|
@@ -38734,6 +38631,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
38734
38631
|
* @param participant Identity, SID or the participant object to remove.
|
38735
38632
|
*/
|
38736
38633
|
|
38634
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
38635
|
+
// @ts-ignore TODO: fix validateTypesAsync typing
|
38636
|
+
|
38737
38637
|
}, {
|
38738
38638
|
key: "removeParticipant",
|
38739
38639
|
value: function () {
|
@@ -38743,7 +38643,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38743
38643
|
switch (_context18.prev = _context18.next) {
|
38744
38644
|
case 0:
|
38745
38645
|
_context18.next = 2;
|
38746
|
-
return this.participantsEntity.remove(typeof participant ===
|
38646
|
+
return this.participantsEntity.remove(typeof participant === "string" ? participant : participant.sid);
|
38747
38647
|
|
38748
38648
|
case 2:
|
38749
38649
|
case "end":
|
@@ -38753,7 +38653,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38753
38653
|
}, _callee18, this);
|
38754
38654
|
}));
|
38755
38655
|
|
38756
|
-
function removeParticipant(
|
38656
|
+
function removeParticipant(_x11) {
|
38757
38657
|
return _removeParticipant.apply(this, arguments);
|
38758
38658
|
}
|
38759
38659
|
|
@@ -38772,13 +38672,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
38772
38672
|
key: "sendMessage",
|
38773
38673
|
value: function () {
|
38774
38674
|
var _sendMessage = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee19(message, messageAttributes, emailOptions) {
|
38775
|
-
var
|
38675
|
+
var _parseToNumber2;
|
38676
|
+
|
38677
|
+
var _parseToNumber, _response, response;
|
38776
38678
|
|
38777
38679
|
return _regeneratorRuntime$1.wrap(function _callee19$(_context19) {
|
38778
38680
|
while (1) {
|
38779
38681
|
switch (_context19.prev = _context19.next) {
|
38780
38682
|
case 0:
|
38781
|
-
if (!(typeof message ===
|
38683
|
+
if (!(typeof message === "string" || message === null)) {
|
38782
38684
|
_context19.next = 5;
|
38783
38685
|
break;
|
38784
38686
|
}
|
@@ -38788,7 +38690,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38788
38690
|
|
38789
38691
|
case 3:
|
38790
38692
|
_response = _context19.sent;
|
38791
|
-
return _context19.abrupt("return", parseToNumber(_response.index));
|
38693
|
+
return _context19.abrupt("return", (_parseToNumber = parseToNumber(_response.index)) !== null && _parseToNumber !== void 0 ? _parseToNumber : 0);
|
38792
38694
|
|
38793
38695
|
case 5:
|
38794
38696
|
_context19.next = 7;
|
@@ -38796,7 +38698,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38796
38698
|
|
38797
38699
|
case 7:
|
38798
38700
|
response = _context19.sent;
|
38799
|
-
return _context19.abrupt("return", parseToNumber(response.index));
|
38701
|
+
return _context19.abrupt("return", (_parseToNumber2 = parseToNumber(response.index)) !== null && _parseToNumber2 !== void 0 ? _parseToNumber2 : 0);
|
38800
38702
|
|
38801
38703
|
case 9:
|
38802
38704
|
case "end":
|
@@ -38806,7 +38708,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38806
38708
|
}, _callee19, this);
|
38807
38709
|
}));
|
38808
38710
|
|
38809
|
-
function sendMessage(_x13, _x14
|
38711
|
+
function sendMessage(_x12, _x13, _x14) {
|
38810
38712
|
return _sendMessage.apply(this, arguments);
|
38811
38713
|
}
|
38812
38714
|
|
@@ -38922,7 +38824,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38922
38824
|
switch (_context22.prev = _context22.next) {
|
38923
38825
|
case 0:
|
38924
38826
|
_context22.next = 2;
|
38925
|
-
return this.services.commandExecutor.mutateResource(
|
38827
|
+
return this.services.commandExecutor.mutateResource("post", "".concat(this.configuration.links.myConversations, "/").concat(this.sid), {
|
38926
38828
|
notification_level: notificationLevel
|
38927
38829
|
});
|
38928
38830
|
|
@@ -38934,7 +38836,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38934
38836
|
}, _callee22, this);
|
38935
38837
|
}));
|
38936
38838
|
|
38937
|
-
function setUserNotificationLevel(
|
38839
|
+
function setUserNotificationLevel(_x15) {
|
38938
38840
|
return _setUserNotificationLevel.apply(this, arguments);
|
38939
38841
|
}
|
38940
38842
|
|
@@ -38964,7 +38866,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38964
38866
|
switch (_context23.prev = _context23.next) {
|
38965
38867
|
case 0:
|
38966
38868
|
_context23.next = 2;
|
38967
|
-
return this.services.commandExecutor.mutateResource(
|
38869
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
38968
38870
|
attributes: attributes !== undefined ? JSON.stringify(attributes) : undefined
|
38969
38871
|
});
|
38970
38872
|
|
@@ -38979,7 +38881,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
38979
38881
|
}, _callee23, this);
|
38980
38882
|
}));
|
38981
38883
|
|
38982
|
-
function updateAttributes(
|
38884
|
+
function updateAttributes(_x16) {
|
38983
38885
|
return _updateAttributes.apply(this, arguments);
|
38984
38886
|
}
|
38985
38887
|
|
@@ -39004,7 +38906,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39004
38906
|
}
|
39005
38907
|
|
39006
38908
|
_context24.next = 3;
|
39007
|
-
return this.services.commandExecutor.mutateResource(
|
38909
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
39008
38910
|
friendly_name: friendlyName
|
39009
38911
|
});
|
39010
38912
|
|
@@ -39019,7 +38921,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39019
38921
|
}, _callee24, this);
|
39020
38922
|
}));
|
39021
38923
|
|
39022
|
-
function updateFriendlyName(
|
38924
|
+
function updateFriendlyName(_x17) {
|
39023
38925
|
return _updateFriendlyName.apply(this, arguments);
|
39024
38926
|
}
|
39025
38927
|
|
@@ -39054,7 +38956,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39054
38956
|
}, _callee25, this);
|
39055
38957
|
}));
|
39056
38958
|
|
39057
|
-
function updateLastReadMessageIndex(
|
38959
|
+
function updateLastReadMessageIndex(_x18) {
|
39058
38960
|
return _updateLastReadMessageIndex.apply(this, arguments);
|
39059
38961
|
}
|
39060
38962
|
|
@@ -39079,11 +38981,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
39079
38981
|
}
|
39080
38982
|
|
39081
38983
|
if (!uniqueName) {
|
39082
|
-
uniqueName =
|
38984
|
+
uniqueName = "";
|
39083
38985
|
}
|
39084
38986
|
|
39085
38987
|
_context26.next = 4;
|
39086
|
-
return this.services.commandExecutor.mutateResource(
|
38988
|
+
return this.services.commandExecutor.mutateResource("post", this.links.self, {
|
39087
38989
|
unique_name: uniqueName
|
39088
38990
|
});
|
39089
38991
|
|
@@ -39098,7 +39000,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39098
39000
|
}, _callee26, this);
|
39099
39001
|
}));
|
39100
39002
|
|
39101
|
-
function updateUniqueName(
|
39003
|
+
function updateUniqueName(_x19) {
|
39102
39004
|
return _updateUniqueName.apply(this, arguments);
|
39103
39005
|
}
|
39104
39006
|
|
@@ -39108,13 +39010,13 @@ this.Twilio.Conversations = (function (exports) {
|
|
39108
39010
|
key: "preprocessUpdate",
|
39109
39011
|
value: function preprocessUpdate(update, conversationSid) {
|
39110
39012
|
try {
|
39111
|
-
if (typeof update.attributes ===
|
39013
|
+
if (typeof update.attributes === "string") {
|
39112
39014
|
update.attributes = JSON.parse(update.attributes);
|
39113
39015
|
} else if (update.attributes) {
|
39114
39016
|
JSON.stringify(update.attributes);
|
39115
39017
|
}
|
39116
39018
|
} catch (e) {
|
39117
|
-
log$3.warn(
|
39019
|
+
log$3.warn("Retrieved malformed attributes from the server for conversation: " + conversationSid);
|
39118
39020
|
update.attributes = {};
|
39119
39021
|
}
|
39120
39022
|
|
@@ -39123,7 +39025,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39123
39025
|
update.dateCreated = new Date(update.dateCreated);
|
39124
39026
|
}
|
39125
39027
|
} catch (e) {
|
39126
|
-
log$3.warn(
|
39028
|
+
log$3.warn("Retrieved malformed dateCreated from the server for conversation: " + conversationSid);
|
39127
39029
|
delete update.dateCreated;
|
39128
39030
|
}
|
39129
39031
|
|
@@ -39132,7 +39034,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39132
39034
|
update.dateUpdated = new Date(update.dateUpdated);
|
39133
39035
|
}
|
39134
39036
|
} catch (e) {
|
39135
|
-
log$3.warn(
|
39037
|
+
log$3.warn("Retrieved malformed dateUpdated from the server for conversation: " + conversationSid);
|
39136
39038
|
delete update.dateUpdated;
|
39137
39039
|
}
|
39138
39040
|
|
@@ -39141,7 +39043,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39141
39043
|
update.lastMessage.timestamp = new Date(update.lastMessage.timestamp);
|
39142
39044
|
}
|
39143
39045
|
} catch (e) {
|
39144
|
-
log$3.warn(
|
39046
|
+
log$3.warn("Retrieved malformed lastMessage.timestamp from the server for conversation: " + conversationSid);
|
39145
39047
|
delete update.lastMessage.timestamp;
|
39146
39048
|
}
|
39147
39049
|
}
|
@@ -39150,25 +39052,25 @@ this.Twilio.Conversations = (function (exports) {
|
|
39150
39052
|
return Conversation;
|
39151
39053
|
}(ReplayEventEmitter_1);
|
39152
39054
|
|
39153
|
-
_defineProperty$3(Conversation, "participantJoined",
|
39055
|
+
_defineProperty$3(Conversation, "participantJoined", "participantJoined");
|
39154
39056
|
|
39155
|
-
_defineProperty$3(Conversation, "participantLeft",
|
39057
|
+
_defineProperty$3(Conversation, "participantLeft", "participantLeft");
|
39156
39058
|
|
39157
|
-
_defineProperty$3(Conversation, "participantUpdated",
|
39059
|
+
_defineProperty$3(Conversation, "participantUpdated", "participantUpdated");
|
39158
39060
|
|
39159
|
-
_defineProperty$3(Conversation, "messageAdded",
|
39061
|
+
_defineProperty$3(Conversation, "messageAdded", "messageAdded");
|
39160
39062
|
|
39161
|
-
_defineProperty$3(Conversation, "messageRemoved",
|
39063
|
+
_defineProperty$3(Conversation, "messageRemoved", "messageRemoved");
|
39162
39064
|
|
39163
|
-
_defineProperty$3(Conversation, "messageUpdated",
|
39065
|
+
_defineProperty$3(Conversation, "messageUpdated", "messageUpdated");
|
39164
39066
|
|
39165
|
-
_defineProperty$3(Conversation, "typingEnded",
|
39067
|
+
_defineProperty$3(Conversation, "typingEnded", "typingEnded");
|
39166
39068
|
|
39167
|
-
_defineProperty$3(Conversation, "typingStarted",
|
39069
|
+
_defineProperty$3(Conversation, "typingStarted", "typingStarted");
|
39168
39070
|
|
39169
|
-
_defineProperty$3(Conversation, "updated",
|
39071
|
+
_defineProperty$3(Conversation, "updated", "updated");
|
39170
39072
|
|
39171
|
-
_defineProperty$3(Conversation, "removed",
|
39073
|
+
_defineProperty$3(Conversation, "removed", "removed");
|
39172
39074
|
|
39173
39075
|
__decorate$1([validateTypesAsync_1(nonEmptyString_1, optionalAttributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "add", null);
|
39174
39076
|
|
@@ -39176,7 +39078,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39176
39078
|
|
39177
39079
|
__decorate$1([validateTypesAsync_1(nonNegativeInteger_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Number]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
|
39178
39080
|
|
39179
|
-
__decorate$1([validateTypesAsync_1([
|
39081
|
+
__decorate$1([validateTypesAsync_1(["undefined", nonNegativeInteger_1], ["undefined", nonNegativeInteger_1], ["undefined", literal_1("backwards", "forward")]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Number, Number, String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "getMessages", null);
|
39180
39082
|
|
39181
39083
|
__decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "getParticipantBySid", null);
|
39182
39084
|
|
@@ -39184,33 +39086,33 @@ this.Twilio.Conversations = (function (exports) {
|
|
39184
39086
|
|
39185
39087
|
__decorate$1([validateTypesAsync_1([nonEmptyString_1, Participant]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "removeParticipant", null);
|
39186
39088
|
|
39187
|
-
__decorate$1([validateTypesAsync_1([
|
39089
|
+
__decorate$1([validateTypesAsync_1(["string", literal_1(null), // Wrapping it into a custom rule is necessary because the FormData class is not available on initialization.
|
39188
39090
|
custom_1(function (value) {
|
39189
|
-
return [value instanceof FormData,
|
39190
|
-
}), objectSchema_1(
|
39091
|
+
return [value instanceof FormData, "an instance of FormData"];
|
39092
|
+
}), objectSchema_1("media options", {
|
39191
39093
|
contentType: nonEmptyString_1,
|
39192
39094
|
media: custom_1(function (value) {
|
39193
|
-
var isValid = typeof value ===
|
39095
|
+
var isValid = typeof value === "string" && value.length > 0 || value instanceof Uint8Array || value instanceof ArrayBuffer;
|
39194
39096
|
|
39195
|
-
if (typeof Blob ===
|
39097
|
+
if (typeof Blob === "function") {
|
39196
39098
|
isValid = isValid || value instanceof Blob;
|
39197
39099
|
}
|
39198
39100
|
|
39199
|
-
return [isValid,
|
39101
|
+
return [isValid, "a non-empty string, an instance of Buffer or an instance of Blob"];
|
39200
39102
|
})
|
39201
|
-
})], optionalAttributesValidator, [
|
39202
|
-
subject: [nonEmptyString_1,
|
39103
|
+
})], optionalAttributesValidator, ["undefined", literal_1(null), objectSchema_1("email attributes", {
|
39104
|
+
subject: [nonEmptyString_1, "undefined"]
|
39203
39105
|
})]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object, Object, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "sendMessage", null);
|
39204
39106
|
|
39205
|
-
__decorate$1([validateTypesAsync_1(literal_1(
|
39107
|
+
__decorate$1([validateTypesAsync_1(literal_1("default", "muted")), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "setUserNotificationLevel", null);
|
39206
39108
|
|
39207
39109
|
__decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateAttributes", null);
|
39208
39110
|
|
39209
|
-
__decorate$1([validateTypesAsync_1([
|
39111
|
+
__decorate$1([validateTypesAsync_1(["string"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateFriendlyName", null);
|
39210
39112
|
|
39211
39113
|
__decorate$1([validateTypesAsync_1([literal_1(null), nonNegativeInteger_1]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Number]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateLastReadMessageIndex", null);
|
39212
39114
|
|
39213
|
-
__decorate$1([validateTypesAsync_1([
|
39115
|
+
__decorate$1([validateTypesAsync_1(["string", literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateUniqueName", null);
|
39214
39116
|
|
39215
39117
|
var Deferred = /*#__PURE__*/function () {
|
39216
39118
|
function Deferred() {
|
@@ -39264,7 +39166,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39264
39166
|
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); 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); }; }
|
39265
39167
|
|
39266
39168
|
function _isNativeReflectConstruct$2() { 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; } }
|
39267
|
-
var log$2 = Logger.scope(
|
39169
|
+
var log$2 = Logger.scope("Conversations");
|
39268
39170
|
/**
|
39269
39171
|
* Represents conversations collection
|
39270
39172
|
* {@see Conversation}
|
@@ -39306,12 +39208,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
39306
39208
|
while (1) {
|
39307
39209
|
switch (_context.prev = _context.next) {
|
39308
39210
|
case 0:
|
39309
|
-
attributes = typeof (options === null || options === void 0 ? void 0 : options.attributes) !==
|
39211
|
+
attributes = typeof (options === null || options === void 0 ? void 0 : options.attributes) !== "undefined" ? options.attributes : {};
|
39310
39212
|
_context.next = 3;
|
39311
|
-
return this.services.commandExecutor.mutateResource(
|
39213
|
+
return this.services.commandExecutor.mutateResource("post", this.configuration.links.conversations, {
|
39312
39214
|
friendly_name: options.friendlyName,
|
39313
39215
|
unique_name: options.uniqueName,
|
39314
|
-
attributes: typeof attributes !==
|
39216
|
+
attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
|
39315
39217
|
});
|
39316
39218
|
|
39317
39219
|
case 3:
|
@@ -39337,12 +39239,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
39337
39239
|
case 12:
|
39338
39240
|
conversation = new Conversation({
|
39339
39241
|
channel: conversationDocument,
|
39340
|
-
entityName:
|
39341
|
-
uniqueName:
|
39242
|
+
entityName: "",
|
39243
|
+
uniqueName: "",
|
39342
39244
|
attributes: null,
|
39343
|
-
createdBy:
|
39344
|
-
friendlyName:
|
39345
|
-
lastConsumedMessageIndex:
|
39245
|
+
createdBy: "",
|
39246
|
+
friendlyName: "",
|
39247
|
+
lastConsumedMessageIndex: 0,
|
39346
39248
|
dateCreated: null,
|
39347
39249
|
dateUpdated: null
|
39348
39250
|
}, conversationSid, links, this.configuration, this.services);
|
@@ -39354,7 +39256,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39354
39256
|
return conversation._subscribe();
|
39355
39257
|
|
39356
39258
|
case 17:
|
39357
|
-
this.emit(
|
39259
|
+
this.emit("conversationAdded", conversation);
|
39358
39260
|
return _context.abrupt("return", conversation);
|
39359
39261
|
|
39360
39262
|
case 19:
|
@@ -39393,12 +39295,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
39393
39295
|
|
39394
39296
|
case 3:
|
39395
39297
|
map = _context2.sent;
|
39396
|
-
map.on(
|
39298
|
+
map.on("itemAdded", function (args) {
|
39397
39299
|
log$2.debug("itemAdded: ".concat(args.item.key));
|
39398
39300
|
|
39399
|
-
_this2._upsertConversation(
|
39301
|
+
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
39400
39302
|
});
|
39401
|
-
map.on(
|
39303
|
+
map.on("itemRemoved", function (args) {
|
39402
39304
|
log$2.debug("itemRemoved: ".concat(args.key));
|
39403
39305
|
var sid = args.key;
|
39404
39306
|
|
@@ -39412,22 +39314,22 @@ this.Twilio.Conversations = (function (exports) {
|
|
39412
39314
|
return;
|
39413
39315
|
}
|
39414
39316
|
|
39415
|
-
if (conversation.status ===
|
39416
|
-
conversation._setStatus(
|
39317
|
+
if (conversation.status === "joined") {
|
39318
|
+
conversation._setStatus("notParticipating", "sync");
|
39417
39319
|
|
39418
|
-
_this2.emit(
|
39320
|
+
_this2.emit("conversationLeft", conversation);
|
39419
39321
|
}
|
39420
39322
|
|
39421
39323
|
_this2.conversations.delete(sid);
|
39422
39324
|
|
39423
|
-
_this2.emit(
|
39325
|
+
_this2.emit("conversationRemoved", conversation);
|
39424
39326
|
|
39425
|
-
conversation.emit(
|
39327
|
+
conversation.emit("removed", conversation);
|
39426
39328
|
});
|
39427
|
-
map.on(
|
39329
|
+
map.on("itemUpdated", function (args) {
|
39428
39330
|
log$2.debug("itemUpdated: ".concat(args.item.key));
|
39429
39331
|
|
39430
|
-
_this2._upsertConversation(
|
39332
|
+
_this2._upsertConversation("sync", args.item.key, args.item.data);
|
39431
39333
|
});
|
39432
39334
|
_context2.next = 9;
|
39433
39335
|
return this._fetchMyConversations();
|
@@ -39440,7 +39342,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39440
39342
|
try {
|
39441
39343
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
39442
39344
|
conversation = _step.value;
|
39443
|
-
upserts.push(this._upsertConversation(
|
39345
|
+
upserts.push(this._upsertConversation("rest", conversation["channel_sid"], conversation));
|
39444
39346
|
}
|
39445
39347
|
} catch (err) {
|
39446
39348
|
_iterator.e(err);
|
@@ -39455,15 +39357,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
39455
39357
|
case 16:
|
39456
39358
|
this.myConversationsFetched = true;
|
39457
39359
|
this.tombstones.clear();
|
39458
|
-
log$2.debug(
|
39360
|
+
log$2.debug("The conversations list has been successfully fetched");
|
39459
39361
|
return _context2.abrupt("return", this);
|
39460
39362
|
|
39461
39363
|
case 22:
|
39462
39364
|
_context2.prev = 22;
|
39463
39365
|
_context2.t0 = _context2["catch"](0);
|
39464
|
-
errorMessage =
|
39366
|
+
errorMessage = "Failed to fetch the conversations list";
|
39465
39367
|
|
39466
|
-
if (this.services.syncClient.connectionState !==
|
39368
|
+
if (this.services.syncClient.connectionState !== "disconnected") {
|
39467
39369
|
log$2.error(errorMessage, _context2.t0);
|
39468
39370
|
}
|
39469
39371
|
|
@@ -39487,7 +39389,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39487
39389
|
}, {
|
39488
39390
|
key: "getConversations",
|
39489
39391
|
value: function () {
|
39490
|
-
var _getConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(
|
39392
|
+
var _getConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3() {
|
39491
39393
|
var _this3 = this;
|
39492
39394
|
|
39493
39395
|
var conversationsMap, page;
|
@@ -39507,7 +39409,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39507
39409
|
page = _context3.sent;
|
39508
39410
|
return _context3.abrupt("return", this._wrapPaginator(page, function (items) {
|
39509
39411
|
return Promise.all(items.map(function (item) {
|
39510
|
-
return _this3._upsertConversation(
|
39412
|
+
return _this3._upsertConversation("sync", item.key, item.data);
|
39511
39413
|
}));
|
39512
39414
|
}));
|
39513
39415
|
|
@@ -39519,7 +39421,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39519
39421
|
}, _callee3, this);
|
39520
39422
|
}));
|
39521
39423
|
|
39522
|
-
function getConversations(
|
39424
|
+
function getConversations() {
|
39523
39425
|
return _getConversations.apply(this, arguments);
|
39524
39426
|
}
|
39525
39427
|
|
@@ -39549,7 +39451,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39549
39451
|
case 5:
|
39550
39452
|
page = _context4.sent;
|
39551
39453
|
items = page.items.map(function (item) {
|
39552
|
-
return _this4._upsertConversation(
|
39454
|
+
return _this4._upsertConversation("sync", item.key, item.data);
|
39553
39455
|
});
|
39554
39456
|
return _context4.abrupt("return", items.length > 0 ? items[0] : null);
|
39555
39457
|
|
@@ -39561,7 +39463,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39561
39463
|
}, _callee4, this);
|
39562
39464
|
}));
|
39563
39465
|
|
39564
|
-
function getConversation(
|
39466
|
+
function getConversation(_x2) {
|
39565
39467
|
return _getConversation.apply(this, arguments);
|
39566
39468
|
}
|
39567
39469
|
|
@@ -39587,7 +39489,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39587
39489
|
data = {
|
39588
39490
|
entityName: null,
|
39589
39491
|
lastConsumedMessageIndex: body.last_read_message_index,
|
39590
|
-
status: (body === null || body === void 0 ? void 0 : body.status) ||
|
39492
|
+
status: (body === null || body === void 0 ? void 0 : body.status) || "unknown",
|
39591
39493
|
friendlyName: body.friendly_name,
|
39592
39494
|
dateUpdated: body.date_updated,
|
39593
39495
|
dateCreated: body.date_created,
|
@@ -39598,7 +39500,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39598
39500
|
notificationLevel: body === null || body === void 0 ? void 0 : body.notification_level,
|
39599
39501
|
sid: sid
|
39600
39502
|
};
|
39601
|
-
return _context5.abrupt("return", this._upsertConversation(
|
39503
|
+
return _context5.abrupt("return", sid ? this._upsertConversation("sync", sid, data) : null);
|
39602
39504
|
|
39603
39505
|
case 8:
|
39604
39506
|
case "end":
|
@@ -39608,7 +39510,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39608
39510
|
}, _callee5, this);
|
39609
39511
|
}));
|
39610
39512
|
|
39611
|
-
function getConversationByUniqueName(
|
39513
|
+
function getConversationByUniqueName(_x3) {
|
39612
39514
|
return _getConversationByUniqueName.apply(this, arguments);
|
39613
39515
|
}
|
39614
39516
|
|
@@ -39633,7 +39535,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39633
39535
|
data = {
|
39634
39536
|
entityName: null,
|
39635
39537
|
// lastConsumedMessageIndex: body.last_read_message_index,
|
39636
|
-
status: (body === null || body === void 0 ? void 0 : body.status) ||
|
39538
|
+
status: (body === null || body === void 0 ? void 0 : body.status) || "unknown",
|
39637
39539
|
friendlyName: body.friendly_name,
|
39638
39540
|
dateUpdated: body.date_updated,
|
39639
39541
|
dateCreated: body.date_created,
|
@@ -39644,7 +39546,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39644
39546
|
// notificationLevel: body?.notification_level,
|
39645
39547
|
sid: sid
|
39646
39548
|
};
|
39647
|
-
return _context6.abrupt("return", this._upsertConversation(
|
39549
|
+
return _context6.abrupt("return", this._upsertConversation("sync", sid, data));
|
39648
39550
|
|
39649
39551
|
case 7:
|
39650
39552
|
case "end":
|
@@ -39654,7 +39556,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39654
39556
|
}, _callee6, this);
|
39655
39557
|
}));
|
39656
39558
|
|
39657
|
-
function peekConversation(
|
39559
|
+
function peekConversation(_x4) {
|
39658
39560
|
return _peekConversation.apply(this, arguments);
|
39659
39561
|
}
|
39660
39562
|
|
@@ -39671,7 +39573,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39671
39573
|
_context7.next = 2;
|
39672
39574
|
return this.services.syncClient.map({
|
39673
39575
|
id: this.configuration.myConversations,
|
39674
|
-
mode:
|
39576
|
+
mode: "open_existing"
|
39675
39577
|
});
|
39676
39578
|
|
39677
39579
|
case 2:
|
@@ -39731,7 +39633,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39731
39633
|
}, _callee8);
|
39732
39634
|
}));
|
39733
39635
|
|
39734
|
-
function _wrapPaginator(
|
39636
|
+
function _wrapPaginator(_x5, _x6) {
|
39735
39637
|
return _wrapPaginator2.apply(this, arguments);
|
39736
39638
|
}
|
39737
39639
|
|
@@ -39749,14 +39651,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
39749
39651
|
switch (_context9.prev = _context9.next) {
|
39750
39652
|
case 0:
|
39751
39653
|
areSourcesDifferent = conversation._statusSource() !== undefined && source !== conversation._statusSource();
|
39752
|
-
isChannelSourceSync = source !==
|
39654
|
+
isChannelSourceSync = source !== "rest" || conversation._statusSource() === "sync";
|
39753
39655
|
|
39754
|
-
if (!(areSourcesDifferent && isChannelSourceSync && source !==
|
39656
|
+
if (!(areSourcesDifferent && isChannelSourceSync && source !== "sync")) {
|
39755
39657
|
_context9.next = 5;
|
39756
39658
|
break;
|
39757
39659
|
}
|
39758
39660
|
|
39759
|
-
log$2.trace(
|
39661
|
+
log$2.trace("upsertConversation: conversation is known from sync and came from chat, ignoring", {
|
39760
39662
|
sid: conversation.sid,
|
39761
39663
|
data: data.status,
|
39762
39664
|
conversation: conversation.status
|
@@ -39764,20 +39666,20 @@ this.Twilio.Conversations = (function (exports) {
|
|
39764
39666
|
return _context9.abrupt("return");
|
39765
39667
|
|
39766
39668
|
case 5:
|
39767
|
-
if (!(data.status ===
|
39669
|
+
if (!(data.status === "joined" && conversation.status !== "joined")) {
|
39768
39670
|
_context9.next = 13;
|
39769
39671
|
break;
|
39770
39672
|
}
|
39771
39673
|
|
39772
|
-
conversation._setStatus(
|
39674
|
+
conversation._setStatus("joined", source);
|
39773
39675
|
|
39774
39676
|
updateData = {};
|
39775
39677
|
|
39776
|
-
if (typeof data.notificationLevel !==
|
39678
|
+
if (typeof data.notificationLevel !== "undefined") {
|
39777
39679
|
updateData.notificationLevel = data.notificationLevel;
|
39778
39680
|
}
|
39779
39681
|
|
39780
|
-
if (typeof data.lastConsumedMessageIndex !==
|
39682
|
+
if (typeof data.lastConsumedMessageIndex !== "undefined") {
|
39781
39683
|
updateData.lastConsumedMessageIndex = data.lastConsumedMessageIndex;
|
39782
39684
|
}
|
39783
39685
|
|
@@ -39786,18 +39688,18 @@ this.Twilio.Conversations = (function (exports) {
|
|
39786
39688
|
}
|
39787
39689
|
|
39788
39690
|
conversation._subscribe().then(function () {
|
39789
|
-
_this6.emit(
|
39691
|
+
_this6.emit("conversationJoined", conversation);
|
39790
39692
|
});
|
39791
39693
|
|
39792
39694
|
return _context9.abrupt("return");
|
39793
39695
|
|
39794
39696
|
case 13:
|
39795
|
-
if (!(data.status ===
|
39697
|
+
if (!(data.status === "notParticipating" && conversation.status === "joined")) {
|
39796
39698
|
_context9.next = 20;
|
39797
39699
|
break;
|
39798
39700
|
}
|
39799
39701
|
|
39800
|
-
conversation._setStatus(
|
39702
|
+
conversation._setStatus("notParticipating", source);
|
39801
39703
|
|
39802
39704
|
conversation._update(data);
|
39803
39705
|
|
@@ -39805,11 +39707,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
39805
39707
|
return conversation._subscribe();
|
39806
39708
|
|
39807
39709
|
case 18:
|
39808
|
-
this.emit(
|
39710
|
+
this.emit("conversationLeft", conversation);
|
39809
39711
|
return _context9.abrupt("return");
|
39810
39712
|
|
39811
39713
|
case 20:
|
39812
|
-
if (!(data.status ===
|
39714
|
+
if (!(data.status === "notParticipating")) {
|
39813
39715
|
_context9.next = 24;
|
39814
39716
|
break;
|
39815
39717
|
}
|
@@ -39831,7 +39733,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39831
39733
|
}, _callee9, this);
|
39832
39734
|
}));
|
39833
39735
|
|
39834
|
-
function _updateConversation(_x8, _x9
|
39736
|
+
function _updateConversation(_x7, _x8, _x9) {
|
39835
39737
|
return _updateConversation2.apply(this, arguments);
|
39836
39738
|
}
|
39837
39739
|
|
@@ -39866,17 +39768,17 @@ this.Twilio.Conversations = (function (exports) {
|
|
39866
39768
|
return _context10.abrupt("return", conversation);
|
39867
39769
|
|
39868
39770
|
case 9:
|
39869
|
-
if (!([
|
39771
|
+
if (!(["chat", "rest"].includes(source) && this.tombstones.has(sid))) {
|
39870
39772
|
_context10.next = 12;
|
39871
39773
|
break;
|
39872
39774
|
}
|
39873
39775
|
|
39874
|
-
log$2.trace(
|
39875
|
-
return _context10.abrupt("return");
|
39776
|
+
log$2.trace("upsertChannel: the channel is deleted but reappeared again from chat, ignoring", sid);
|
39777
|
+
return _context10.abrupt("return", null);
|
39876
39778
|
|
39877
39779
|
case 12:
|
39878
39780
|
// If the conversation is unknown, fetch it
|
39879
|
-
log$2.trace(
|
39781
|
+
log$2.trace("upsertConversation: creating a local conversation object with sid " + sid, data);
|
39880
39782
|
baseLink = "".concat(this.configuration.links.conversations, "/").concat(sid);
|
39881
39783
|
links = {
|
39882
39784
|
self: baseLink,
|
@@ -39891,12 +39793,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
39891
39793
|
case 19:
|
39892
39794
|
this._registerForEvents(newConversation);
|
39893
39795
|
|
39894
|
-
this.emit(
|
39796
|
+
this.emit("conversationAdded", newConversation);
|
39895
39797
|
|
39896
|
-
if (data.status ===
|
39897
|
-
newConversation._setStatus(
|
39798
|
+
if (data.status === "joined") {
|
39799
|
+
newConversation._setStatus("joined", source);
|
39898
39800
|
|
39899
|
-
this.emit(
|
39801
|
+
this.emit("conversationJoined", newConversation);
|
39900
39802
|
}
|
39901
39803
|
|
39902
39804
|
return _context10.abrupt("return", newConversation);
|
@@ -39909,7 +39811,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39909
39811
|
}, _callee10, this);
|
39910
39812
|
}));
|
39911
39813
|
|
39912
|
-
function _upsertConversation(_x11, _x12
|
39814
|
+
function _upsertConversation(_x10, _x11, _x12) {
|
39913
39815
|
return _upsertConversation2.apply(this, arguments);
|
39914
39816
|
}
|
39915
39817
|
|
@@ -39919,7 +39821,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
39919
39821
|
key: "_fetchMyConversations",
|
39920
39822
|
value: function () {
|
39921
39823
|
var _fetchMyConversations2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11() {
|
39922
|
-
var conversations, pageToken, url, response, receivedConversations;
|
39824
|
+
var conversations, pageToken, _response$body, url, response, receivedConversations;
|
39825
|
+
|
39923
39826
|
return _regeneratorRuntime$1.wrap(function _callee11$(_context11) {
|
39924
39827
|
while (1) {
|
39925
39828
|
switch (_context11.prev = _context11.next) {
|
@@ -39931,7 +39834,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39931
39834
|
url = new UriBuilder$1(this.configuration.links.myConversations);
|
39932
39835
|
|
39933
39836
|
if (pageToken) {
|
39934
|
-
url.arg(
|
39837
|
+
url.arg("PageToken", pageToken);
|
39935
39838
|
}
|
39936
39839
|
|
39937
39840
|
_context11.next = 6;
|
@@ -39939,7 +39842,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39939
39842
|
|
39940
39843
|
case 6:
|
39941
39844
|
response = _context11.sent;
|
39942
|
-
receivedConversations = response.body.conversations.map(function (conversationDescriptor) {
|
39845
|
+
receivedConversations = (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.conversations.map(function (conversationDescriptor) {
|
39943
39846
|
return {
|
39944
39847
|
descriptor: conversationDescriptor,
|
39945
39848
|
channel_sid: conversationDescriptor.conversation_sid,
|
@@ -39984,7 +39887,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
39984
39887
|
|
39985
39888
|
if (conversation) {
|
39986
39889
|
this.conversations.delete(sid);
|
39987
|
-
this.emit(
|
39890
|
+
this.emit("conversationRemoved", conversation);
|
39988
39891
|
}
|
39989
39892
|
}
|
39990
39893
|
}, {
|
@@ -39992,24 +39895,36 @@ this.Twilio.Conversations = (function (exports) {
|
|
39992
39895
|
value: function _registerForEvents(conversation) {
|
39993
39896
|
var _this7 = this;
|
39994
39897
|
|
39995
|
-
conversation.on(
|
39898
|
+
conversation.on("removed", function () {
|
39996
39899
|
return _this7._onConversationRemoved(conversation.sid);
|
39997
39900
|
});
|
39998
|
-
conversation.on(
|
39999
|
-
return _this7.emit(
|
39901
|
+
conversation.on("updated", function (args) {
|
39902
|
+
return _this7.emit("conversationUpdated", args);
|
39903
|
+
});
|
39904
|
+
conversation.on("participantJoined", function (participant) {
|
39905
|
+
return _this7.emit("participantJoined", participant);
|
39906
|
+
});
|
39907
|
+
conversation.on("participantLeft", function (participant) {
|
39908
|
+
return _this7.emit("participantLeft", participant);
|
39909
|
+
});
|
39910
|
+
conversation.on("participantUpdated", function (args) {
|
39911
|
+
return _this7.emit("participantUpdated", args);
|
40000
39912
|
});
|
40001
|
-
conversation.on(
|
40002
|
-
|
40003
|
-
conversation.on('participantUpdated', function (args) {
|
40004
|
-
return _this7.emit('participantUpdated', args);
|
39913
|
+
conversation.on("messageAdded", function (message) {
|
39914
|
+
return _this7.emit("messageAdded", message);
|
40005
39915
|
});
|
40006
|
-
conversation.on(
|
40007
|
-
|
40008
|
-
|
39916
|
+
conversation.on("messageUpdated", function (args) {
|
39917
|
+
return _this7.emit("messageUpdated", args);
|
39918
|
+
});
|
39919
|
+
conversation.on("messageRemoved", function (message) {
|
39920
|
+
return _this7.emit("messageRemoved", message);
|
39921
|
+
});
|
39922
|
+
conversation.on("typingStarted", function (participant) {
|
39923
|
+
return _this7.emit("typingStarted", participant);
|
39924
|
+
});
|
39925
|
+
conversation.on("typingEnded", function (participant) {
|
39926
|
+
return _this7.emit("typingEnded", participant);
|
40009
39927
|
});
|
40010
|
-
conversation.on('messageRemoved', this.emit.bind(this, 'messageRemoved'));
|
40011
|
-
conversation.on('typingStarted', this.emit.bind(this, 'typingStarted'));
|
40012
|
-
conversation.on('typingEnded', this.emit.bind(this, 'typingEnded'));
|
40013
39928
|
}
|
40014
39929
|
}]);
|
40015
39930
|
|
@@ -40060,16 +39975,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
40060
39975
|
_this.fifoStack = [];
|
40061
39976
|
_this.myself = myself;
|
40062
39977
|
|
40063
|
-
_this.myself.on(
|
40064
|
-
return _this.emit(
|
39978
|
+
_this.myself.on("updated", function (args) {
|
39979
|
+
return _this.emit("userUpdated", args);
|
40065
39980
|
});
|
40066
39981
|
|
40067
|
-
_this.myself.on(
|
40068
|
-
return _this.emit(
|
39982
|
+
_this.myself.on("userSubscribed", function () {
|
39983
|
+
return _this.emit("userSubscribed", _this.myself);
|
40069
39984
|
});
|
40070
39985
|
|
40071
|
-
_this.myself.on(
|
40072
|
-
_this.emit(
|
39986
|
+
_this.myself.on("userUnsubscribed", function () {
|
39987
|
+
_this.emit("userUnsubscribed", _this.myself);
|
40073
39988
|
|
40074
39989
|
_this.myself._ensureFetched();
|
40075
39990
|
});
|
@@ -40085,7 +40000,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40085
40000
|
this.subscribedUsers.delete(user.identity);
|
40086
40001
|
}
|
40087
40002
|
|
40088
|
-
var foundItemIndex =
|
40003
|
+
var foundItemIndex = 0;
|
40089
40004
|
var foundItem = this.fifoStack.find(function (item, index) {
|
40090
40005
|
if (item == user.identity) {
|
40091
40006
|
foundItemIndex = index;
|
@@ -40099,7 +40014,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40099
40014
|
this.fifoStack.splice(foundItemIndex, 1);
|
40100
40015
|
}
|
40101
40016
|
|
40102
|
-
this.emit(
|
40017
|
+
this.emit("userUnsubscribed", user);
|
40103
40018
|
}
|
40104
40019
|
}, {
|
40105
40020
|
key: "handleSubscribeUser",
|
@@ -40109,12 +40024,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
40109
40024
|
}
|
40110
40025
|
|
40111
40026
|
if (this.fifoStack.length >= this.configuration.userInfosToSubscribe) {
|
40112
|
-
|
40027
|
+
var _this$subscribedUsers, _this$subscribedUsers2;
|
40028
|
+
|
40029
|
+
var item = this.fifoStack.shift();
|
40030
|
+
(_this$subscribedUsers = this.subscribedUsers) === null || _this$subscribedUsers === void 0 ? void 0 : (_this$subscribedUsers2 = _this$subscribedUsers.get(item)) === null || _this$subscribedUsers2 === void 0 ? void 0 : _this$subscribedUsers2.unsubscribe();
|
40113
40031
|
}
|
40114
40032
|
|
40115
40033
|
this.fifoStack.push(user.identity);
|
40116
40034
|
this.subscribedUsers.set(user.identity, user);
|
40117
|
-
this.emit(
|
40035
|
+
this.emit("userSubscribed", user);
|
40118
40036
|
}
|
40119
40037
|
/**
|
40120
40038
|
* Gets user, if it's in subscribed list - then return the user object from it,
|
@@ -40125,65 +40043,74 @@ this.Twilio.Conversations = (function (exports) {
|
|
40125
40043
|
}, {
|
40126
40044
|
key: "getUser",
|
40127
40045
|
value: function () {
|
40128
|
-
var _getUser = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(
|
40046
|
+
var _getUser = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
40129
40047
|
var _this2 = this;
|
40130
40048
|
|
40131
|
-
var
|
40049
|
+
var identity,
|
40050
|
+
entityName,
|
40132
40051
|
user,
|
40052
|
+
newUser,
|
40133
40053
|
_args = arguments;
|
40134
40054
|
return _regeneratorRuntime$1.wrap(function _callee$(_context) {
|
40135
40055
|
while (1) {
|
40136
40056
|
switch (_context.prev = _context.next) {
|
40137
40057
|
case 0:
|
40138
|
-
|
40139
|
-
|
40058
|
+
identity = _args.length > 0 && _args[0] !== undefined ? _args[0] : "";
|
40059
|
+
entityName = _args.length > 1 && _args[1] !== undefined ? _args[1] : "";
|
40060
|
+
_context.next = 4;
|
40140
40061
|
return this.myself._ensureFetched();
|
40141
40062
|
|
40142
|
-
case
|
40063
|
+
case 4:
|
40143
40064
|
if (!(identity == this.myself.identity)) {
|
40144
|
-
_context.next =
|
40065
|
+
_context.next = 6;
|
40145
40066
|
break;
|
40146
40067
|
}
|
40147
40068
|
|
40148
40069
|
return _context.abrupt("return", this.myself);
|
40149
40070
|
|
40150
|
-
case
|
40071
|
+
case 6:
|
40151
40072
|
user = this.subscribedUsers.get(identity);
|
40152
40073
|
|
40153
|
-
if (user) {
|
40154
|
-
_context.next =
|
40074
|
+
if (!user) {
|
40075
|
+
_context.next = 9;
|
40155
40076
|
break;
|
40156
40077
|
}
|
40157
40078
|
|
40158
|
-
|
40159
|
-
|
40079
|
+
return _context.abrupt("return", user);
|
40080
|
+
|
40081
|
+
case 9:
|
40082
|
+
_context.t0 = entityName;
|
40083
|
+
|
40084
|
+
if (_context.t0) {
|
40085
|
+
_context.next = 14;
|
40160
40086
|
break;
|
40161
40087
|
}
|
40162
40088
|
|
40163
|
-
_context.next =
|
40089
|
+
_context.next = 13;
|
40164
40090
|
return this.getSyncUniqueName(identity);
|
40165
40091
|
|
40166
|
-
case
|
40167
|
-
|
40092
|
+
case 13:
|
40093
|
+
_context.t0 = _context.sent;
|
40168
40094
|
|
40169
|
-
case
|
40170
|
-
|
40171
|
-
|
40172
|
-
|
40095
|
+
case 14:
|
40096
|
+
entityName = _context.t0;
|
40097
|
+
newUser = new User(identity, entityName, this.configuration, this.services);
|
40098
|
+
newUser.on("updated", function (args) {
|
40099
|
+
return _this2.emit("userUpdated", args);
|
40173
40100
|
});
|
40174
|
-
|
40175
|
-
return _this2.handleSubscribeUser(
|
40101
|
+
newUser.on("userSubscribed", function () {
|
40102
|
+
return _this2.handleSubscribeUser(newUser);
|
40176
40103
|
});
|
40177
|
-
|
40178
|
-
return _this2.handleUnsubscribeUser(
|
40104
|
+
newUser.on("userUnsubscribed", function () {
|
40105
|
+
return _this2.handleUnsubscribeUser(newUser);
|
40179
40106
|
});
|
40180
|
-
_context.next =
|
40181
|
-
return
|
40107
|
+
_context.next = 21;
|
40108
|
+
return newUser._ensureFetched();
|
40182
40109
|
|
40183
|
-
case
|
40184
|
-
return _context.abrupt("return",
|
40110
|
+
case 21:
|
40111
|
+
return _context.abrupt("return", newUser);
|
40185
40112
|
|
40186
|
-
case
|
40113
|
+
case 22:
|
40187
40114
|
case "end":
|
40188
40115
|
return _context.stop();
|
40189
40116
|
}
|
@@ -40191,7 +40118,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40191
40118
|
}, _callee, this);
|
40192
40119
|
}));
|
40193
40120
|
|
40194
|
-
function getUser(
|
40121
|
+
function getUser() {
|
40195
40122
|
return _getUser.apply(this, arguments);
|
40196
40123
|
}
|
40197
40124
|
|
@@ -40242,6 +40169,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
40242
40169
|
key: "getSyncUniqueName",
|
40243
40170
|
value: function () {
|
40244
40171
|
var _getSyncUniqueName = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(identity) {
|
40172
|
+
var _response$body$sync_o, _response$body;
|
40173
|
+
|
40245
40174
|
var url, response;
|
40246
40175
|
return _regeneratorRuntime$1.wrap(function _callee3$(_context3) {
|
40247
40176
|
while (1) {
|
@@ -40253,7 +40182,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40253
40182
|
|
40254
40183
|
case 3:
|
40255
40184
|
response = _context3.sent;
|
40256
|
-
return _context3.abrupt("return", response.body.sync_objects.user_info_map);
|
40185
|
+
return _context3.abrupt("return", (_response$body$sync_o = (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.sync_objects.user_info_map) !== null && _response$body$sync_o !== void 0 ? _response$body$sync_o : "");
|
40257
40186
|
|
40258
40187
|
case 5:
|
40259
40188
|
case "end":
|
@@ -40263,7 +40192,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40263
40192
|
}, _callee3, this);
|
40264
40193
|
}));
|
40265
40194
|
|
40266
|
-
function getSyncUniqueName(
|
40195
|
+
function getSyncUniqueName(_x) {
|
40267
40196
|
return _getSyncUniqueName.apply(this, arguments);
|
40268
40197
|
}
|
40269
40198
|
|
@@ -40274,7 +40203,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40274
40203
|
return Users;
|
40275
40204
|
}(ReplayEventEmitter_1);
|
40276
40205
|
|
40277
|
-
var log$1 = Logger.scope(
|
40206
|
+
var log$1 = Logger.scope("TypingIndicator");
|
40278
40207
|
/**
|
40279
40208
|
* An important note in regards to typing timeout timers. There are two places that the SDK can get the "typing_timeout" attribute from. The first
|
40280
40209
|
* place that the attribute appears in is the response received from POST -> /v1/typing REST call. In the body of that response, the value of the
|
@@ -40321,7 +40250,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40321
40250
|
var _this = this;
|
40322
40251
|
|
40323
40252
|
// this.services.notificationClient.subscribe(NotificationTypes.TYPING_INDICATOR, 'twilsock');
|
40324
|
-
this.services.notificationClient.on(
|
40253
|
+
this.services.notificationClient.on("message", /*#__PURE__*/function () {
|
40325
40254
|
var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(type, message) {
|
40326
40255
|
return _regeneratorRuntime$1.wrap(function _callee$(_context) {
|
40327
40256
|
while (1) {
|
@@ -40362,7 +40291,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40362
40291
|
while (1) {
|
40363
40292
|
switch (_context2.prev = _context2.next) {
|
40364
40293
|
case 0:
|
40365
|
-
log$1.trace(
|
40294
|
+
log$1.trace("Got new typing indicator ", message);
|
40366
40295
|
this.getConversation(message.channel_sid).then(function (conversation) {
|
40367
40296
|
if (!conversation) {
|
40368
40297
|
return;
|
@@ -40373,7 +40302,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40373
40302
|
return;
|
40374
40303
|
}
|
40375
40304
|
|
40376
|
-
var timeout = _this2.configuration.typingIndicatorTimeoutOverride + 1000
|
40305
|
+
var timeout = _this2.configuration.typingIndicatorTimeoutOverride ? _this2.configuration.typingIndicatorTimeoutOverride + 1000 : message.typing_timeout * 1000;
|
40377
40306
|
|
40378
40307
|
participant._startTyping(timeout);
|
40379
40308
|
});
|
@@ -40418,18 +40347,18 @@ this.Twilio.Conversations = (function (exports) {
|
|
40418
40347
|
value: function _send(conversationSid) {
|
40419
40348
|
var _this3 = this;
|
40420
40349
|
|
40421
|
-
log$1.trace(
|
40350
|
+
log$1.trace("Sending typing indicator");
|
40422
40351
|
var url = this.configuration.links.typing;
|
40423
40352
|
var headers = {
|
40424
|
-
|
40353
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
40425
40354
|
};
|
40426
40355
|
var body = "ChannelSid=".concat(conversationSid);
|
40427
40356
|
return this.services.twilsockClient.post(url, headers, body, this.configuration.productId).then(function (response) {
|
40428
|
-
if (response.body.hasOwnProperty(
|
40357
|
+
if (response.body.hasOwnProperty("typing_timeout")) {
|
40429
40358
|
_this3.serviceTypingTimeout = response.body.typing_timeout * 1000;
|
40430
40359
|
}
|
40431
40360
|
}).catch(function (err) {
|
40432
|
-
log$1.error(
|
40361
|
+
log$1.error("Failed to send typing indicator:", err);
|
40433
40362
|
throw err;
|
40434
40363
|
});
|
40435
40364
|
}
|
@@ -40485,14 +40414,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
40485
40414
|
this.data = data.data || {};
|
40486
40415
|
};
|
40487
40416
|
|
40488
|
-
var version = "2.1.0-rc.
|
40417
|
+
var version = "2.1.0-rc.8";
|
40489
40418
|
|
40490
40419
|
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
40491
40420
|
|
40492
40421
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
40493
40422
|
|
40494
40423
|
var trimSlashes = function trimSlashes(url) {
|
40495
|
-
return url.replace(/(^\/+|\/+$)/g,
|
40424
|
+
return url.replace(/(^\/+|\/+$)/g, "");
|
40496
40425
|
};
|
40497
40426
|
|
40498
40427
|
var isMutationConflictResponse = function isMutationConflictResponse(response) {
|
@@ -40530,19 +40459,19 @@ this.Twilio.Conversations = (function (exports) {
|
|
40530
40459
|
case 0:
|
40531
40460
|
preProcessedUrl = this._preProcessUrl(url);
|
40532
40461
|
finalHeaders = _objectSpread$1({
|
40533
|
-
|
40462
|
+
"Content-Type": "application/json; charset=utf-8"
|
40534
40463
|
}, headers || {});
|
40535
40464
|
_context.t0 = method;
|
40536
|
-
_context.next = _context.t0 ===
|
40465
|
+
_context.next = _context.t0 === "get" ? 5 : _context.t0 === "post" ? 11 : _context.t0 === "delete" ? 15 : 19;
|
40537
40466
|
break;
|
40538
40467
|
|
40539
40468
|
case 5:
|
40540
40469
|
getUrl = preProcessedUrl;
|
40541
40470
|
|
40542
40471
|
if (requestBody) {
|
40543
|
-
getUrl +=
|
40544
|
-
return entry.map(encodeURIComponent).join(
|
40545
|
-
}).join(
|
40472
|
+
getUrl += "?" + Object.entries(requestBody).map(function (entry) {
|
40473
|
+
return entry.map(encodeURIComponent).join("=");
|
40474
|
+
}).join("&");
|
40546
40475
|
}
|
40547
40476
|
|
40548
40477
|
_context.next = 9;
|
@@ -40562,7 +40491,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40562
40491
|
|
40563
40492
|
case 15:
|
40564
40493
|
_context.next = 17;
|
40565
|
-
return this._services.transport.delete(preProcessedUrl, finalHeaders,
|
40494
|
+
return this._services.transport.delete(preProcessedUrl, finalHeaders, {}, this._productId);
|
40566
40495
|
|
40567
40496
|
case 17:
|
40568
40497
|
response = _context.sent;
|
@@ -40612,28 +40541,24 @@ this.Twilio.Conversations = (function (exports) {
|
|
40612
40541
|
max: 1600,
|
40613
40542
|
maxAttemptsCount: maxAttemptsCount
|
40614
40543
|
}).run(function () {
|
40615
|
-
return _this._makeRequest(
|
40544
|
+
return _this._makeRequest("get", url, requestBody);
|
40616
40545
|
});
|
40617
40546
|
|
40618
40547
|
case 4:
|
40619
40548
|
result = _context2.sent;
|
40620
|
-
_context2.
|
40621
|
-
break;
|
40549
|
+
return _context2.abrupt("return", result.body);
|
40622
40550
|
|
40623
|
-
case
|
40624
|
-
_context2.prev =
|
40551
|
+
case 8:
|
40552
|
+
_context2.prev = 8;
|
40625
40553
|
_context2.t0 = _context2["catch"](1);
|
40626
40554
|
throw new Error("Fetch resource from \"".concat(url, "\" failed."));
|
40627
40555
|
|
40628
|
-
case 10:
|
40629
|
-
return _context2.abrupt("return", result.body);
|
40630
|
-
|
40631
40556
|
case 11:
|
40632
40557
|
case "end":
|
40633
40558
|
return _context2.stop();
|
40634
40559
|
}
|
40635
40560
|
}
|
40636
|
-
}, _callee2, null, [[1,
|
40561
|
+
}, _callee2, null, [[1, 8]]);
|
40637
40562
|
}));
|
40638
40563
|
|
40639
40564
|
function fetchResource(_x5, _x6) {
|
@@ -40653,7 +40578,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40653
40578
|
case 0:
|
40654
40579
|
_context3.next = 2;
|
40655
40580
|
return this._makeRequest(method, url, requestBody, {
|
40656
|
-
|
40581
|
+
"X-Twilio-Mutation-Id": uuid_1.v4()
|
40657
40582
|
});
|
40658
40583
|
|
40659
40584
|
case 2:
|
@@ -40703,7 +40628,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40703
40628
|
function _isNativeReflectConstruct() { 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; } }
|
40704
40629
|
|
40705
40630
|
var Client_1;
|
40706
|
-
var log = Logger.scope(
|
40631
|
+
var log = Logger.scope("Client");
|
40707
40632
|
var SDK_VERSION = version;
|
40708
40633
|
|
40709
40634
|
var ClientServices = function ClientServices() {
|
@@ -40751,22 +40676,14 @@ this.Twilio.Conversations = (function (exports) {
|
|
40751
40676
|
|
40752
40677
|
_this = _super.call(this);
|
40753
40678
|
|
40754
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "connectionState",
|
40755
|
-
|
40756
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "conversationsPromise", null);
|
40757
|
-
|
40758
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "_ensureReady", null);
|
40759
|
-
|
40760
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "_resolveEnsureReady", null);
|
40761
|
-
|
40762
|
-
_defineProperty$3(_assertThisInitialized$3(_this), "_rejectEnsureReady", null);
|
40679
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "connectionState", "unknown");
|
40763
40680
|
|
40764
40681
|
_defineProperty$3(_assertThisInitialized$3(_this), "version", SDK_VERSION);
|
40765
40682
|
|
40766
40683
|
_defineProperty$3(_assertThisInitialized$3(_this), "parsePushNotification", Client_1.parsePushNotification);
|
40767
40684
|
|
40768
|
-
_this.fpaToken = fpaToken;
|
40769
|
-
_this.options = options;
|
40685
|
+
_this.fpaToken = fpaToken !== null && fpaToken !== void 0 ? fpaToken : "";
|
40686
|
+
_this.options = options !== null && options !== void 0 ? options : {};
|
40770
40687
|
|
40771
40688
|
if (!_this.options.disableDeepClone) {
|
40772
40689
|
var _options = _objectSpread(_objectSpread({}, _this.options), {}, {
|
@@ -40780,25 +40697,25 @@ this.Twilio.Conversations = (function (exports) {
|
|
40780
40697
|
_this.options = _options;
|
40781
40698
|
}
|
40782
40699
|
|
40783
|
-
_this.options.logLevel = (_this$options$logLeve = _this.options.logLevel) !== null && _this$options$logLeve !== void 0 ? _this$options$logLeve :
|
40700
|
+
_this.options.logLevel = (_this$options$logLeve = _this.options.logLevel) !== null && _this$options$logLeve !== void 0 ? _this$options$logLeve : "silent";
|
40784
40701
|
log.setLevel(_this.options.logLevel);
|
40785
|
-
var productId = _this.options.productId =
|
40702
|
+
var productId = _this.options.productId = "ip_messaging"; // Filling ClientMetadata
|
40786
40703
|
|
40787
40704
|
_this.options.clientMetadata = _this.options.clientMetadata || {};
|
40788
40705
|
|
40789
|
-
if (!_this.options.clientMetadata.hasOwnProperty(
|
40790
|
-
_this.options.clientMetadata.type =
|
40706
|
+
if (!_this.options.clientMetadata.hasOwnProperty("type")) {
|
40707
|
+
_this.options.clientMetadata.type = "conversations";
|
40791
40708
|
}
|
40792
40709
|
|
40793
|
-
if (!_this.options.clientMetadata.hasOwnProperty(
|
40794
|
-
_this.options.clientMetadata.sdk =
|
40710
|
+
if (!_this.options.clientMetadata.hasOwnProperty("sdk")) {
|
40711
|
+
_this.options.clientMetadata.sdk = "JS";
|
40795
40712
|
_this.options.clientMetadata.sdkv = SDK_VERSION;
|
40796
40713
|
} // Enable session local storage for Sync
|
40797
40714
|
|
40798
40715
|
|
40799
40716
|
_this.options.Sync = _this.options.Sync || {};
|
40800
40717
|
|
40801
|
-
if (typeof _this.options.Sync.enableSessionStorage ===
|
40718
|
+
if (typeof _this.options.Sync.enableSessionStorage === "undefined") {
|
40802
40719
|
_this.options.Sync.enableSessionStorage = true;
|
40803
40720
|
}
|
40804
40721
|
|
@@ -40807,11 +40724,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
40807
40724
|
}
|
40808
40725
|
|
40809
40726
|
if (!fpaToken) {
|
40810
|
-
throw new Error(
|
40727
|
+
throw new Error("A valid Twilio token should be provided");
|
40811
40728
|
}
|
40812
40729
|
|
40813
40730
|
_this.services = new ClientServices();
|
40814
|
-
_this._myself = new User(
|
40731
|
+
_this._myself = new User("", "", null, _this.services);
|
40815
40732
|
var startTwilsock = !_this.options.twilsockClient; // Create default init registrations if none were provided.
|
40816
40733
|
// Otherwise, the outside party have to list all the init registrations they
|
40817
40734
|
// need.
|
@@ -40826,34 +40743,34 @@ this.Twilio.Conversations = (function (exports) {
|
|
40826
40743
|
|
40827
40744
|
_this.services.twilsockClient = _this.options.twilsockClient = (_this$options$twilsoc = _this.options.twilsockClient) !== null && _this$options$twilsoc !== void 0 ? _this$options$twilsoc : new browser$3.TwilsockClient(fpaToken, productId, _this.options);
|
40828
40745
|
|
40829
|
-
_this.services.twilsockClient.on(
|
40830
|
-
return _this.emit(
|
40746
|
+
_this.services.twilsockClient.on("tokenAboutToExpire", function (ttl) {
|
40747
|
+
return _this.emit("tokenAboutToExpire", ttl);
|
40831
40748
|
});
|
40832
40749
|
|
40833
|
-
_this.services.twilsockClient.on(
|
40834
|
-
return _this.emit(
|
40750
|
+
_this.services.twilsockClient.on("tokenExpired", function () {
|
40751
|
+
return _this.emit("tokenExpired");
|
40835
40752
|
});
|
40836
40753
|
|
40837
|
-
_this.services.twilsockClient.on(
|
40838
|
-
return _this.emit(
|
40754
|
+
_this.services.twilsockClient.on("connectionError", function (error) {
|
40755
|
+
return _this.emit("connectionError", error);
|
40839
40756
|
});
|
40840
40757
|
|
40841
|
-
_this.services.twilsockClient.on(
|
40758
|
+
_this.services.twilsockClient.on("stateChanged", function (state) {
|
40842
40759
|
log.debug("Handling stateChanged for ConversationsClient: new state ".concat(state));
|
40843
40760
|
|
40844
40761
|
if (state !== _this.connectionState) {
|
40845
40762
|
_this.connectionState = state;
|
40846
40763
|
|
40847
|
-
_this.emit(
|
40764
|
+
_this.emit("connectionStateChanged", _this.connectionState);
|
40848
40765
|
}
|
40849
40766
|
});
|
40850
40767
|
|
40851
40768
|
_this.services.transport = _this.options.transport = (_this$options$transpo = _this.options.transport) !== null && _this$options$transpo !== void 0 ? _this$options$transpo : _this.options.twilsockClient;
|
40852
40769
|
_this.services.notificationClient = _this.options.notificationsClient = (_this$options$notific = _this.options.notificationsClient) !== null && _this$options$notific !== void 0 ? _this$options$notific : new browser$2.Notifications(fpaToken, _this.options);
|
40853
40770
|
_this.services.syncClient = _this.options.syncClient = (_this$options$syncCli = _this.options.syncClient) !== null && _this$options$syncCli !== void 0 ? _this$options$syncCli : new SyncClient(fpaToken, _this.options);
|
40854
|
-
var configurationOptions = options.Chat || options.IPMessaging || options || {};
|
40855
|
-
var region = configurationOptions.region || options.region;
|
40856
|
-
var baseUrl = configurationOptions.apiUri || configurationOptions.typingUri || "https://aim.".concat(region ||
|
40771
|
+
var configurationOptions = (options === null || options === void 0 ? void 0 : options.Chat) || (options === null || options === void 0 ? void 0 : options.IPMessaging) || options || {};
|
40772
|
+
var region = configurationOptions.region || (options === null || options === void 0 ? void 0 : options.region);
|
40773
|
+
var baseUrl = configurationOptions.apiUri || configurationOptions.typingUri || "https://aim.".concat(region || "us1", ".twilio.com");
|
40857
40774
|
_this.services.commandExecutor = new CommandExecutor(baseUrl, {
|
40858
40775
|
transport: _this.options.transport
|
40859
40776
|
}, productId);
|
@@ -40861,15 +40778,15 @@ this.Twilio.Conversations = (function (exports) {
|
|
40861
40778
|
var emitFailed = function emitFailed(err) {
|
40862
40779
|
_this._rejectEnsureReady(err);
|
40863
40780
|
|
40864
|
-
_this.emit(
|
40781
|
+
_this.emit("stateChanged", "failed");
|
40865
40782
|
};
|
40866
40783
|
|
40867
|
-
_this.services.twilsockClient.once(
|
40784
|
+
_this.services.twilsockClient.once("connectionError", emitFailed);
|
40868
40785
|
|
40869
|
-
_this.services.twilsockClient.once(
|
40786
|
+
_this.services.twilsockClient.once("disconnected", emitFailed); // ConversationsClient will be able to initialize only after twilsock is connected
|
40870
40787
|
|
40871
40788
|
|
40872
|
-
_this.services.twilsockClient.once(
|
40789
|
+
_this.services.twilsockClient.once("connected", /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
40873
40790
|
var startupEvent;
|
40874
40791
|
return _regeneratorRuntime$1.wrap(function _callee$(_context) {
|
40875
40792
|
while (1) {
|
@@ -40877,20 +40794,20 @@ this.Twilio.Conversations = (function (exports) {
|
|
40877
40794
|
case 0:
|
40878
40795
|
log.debug("ConversationsClient started INITIALIZING");
|
40879
40796
|
|
40880
|
-
_this.services.twilsockClient.off(
|
40797
|
+
_this.services.twilsockClient.off("connectionError", emitFailed);
|
40881
40798
|
|
40882
|
-
_this.services.twilsockClient.off(
|
40799
|
+
_this.services.twilsockClient.off("disconnected", emitFailed);
|
40883
40800
|
|
40884
40801
|
_context.prev = 3;
|
40885
|
-
startupEvent =
|
40802
|
+
startupEvent = "conversations.client.startup";
|
40886
40803
|
|
40887
|
-
_this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription(startupEvent,
|
40804
|
+
_this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription(startupEvent, "Conversations client startup", new Date()), startupEvent, browser$3.TelemetryPoint.Start);
|
40888
40805
|
|
40889
40806
|
_context.next = 8;
|
40890
40807
|
return _this._initialize();
|
40891
40808
|
|
40892
40809
|
case 8:
|
40893
|
-
_this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription(
|
40810
|
+
_this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription("", "", new Date()), startupEvent, browser$3.TelemetryPoint.End);
|
40894
40811
|
|
40895
40812
|
_context.next = 15;
|
40896
40813
|
break;
|
@@ -40902,7 +40819,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40902
40819
|
// Fail ChatClient if initialization is incomplete
|
40903
40820
|
_this._rejectEnsureReady(_context.t0);
|
40904
40821
|
|
40905
|
-
_this.emit(
|
40822
|
+
_this.emit("stateChanged", "failed");
|
40906
40823
|
|
40907
40824
|
case 15:
|
40908
40825
|
case "end":
|
@@ -40915,7 +40832,9 @@ this.Twilio.Conversations = (function (exports) {
|
|
40915
40832
|
_this._ensureReady = new Promise(function (resolve, reject) {
|
40916
40833
|
_this._resolveEnsureReady = resolve;
|
40917
40834
|
_this._rejectEnsureReady = reject;
|
40918
|
-
}).catch(function (
|
40835
|
+
}).catch(function () {
|
40836
|
+
return void 0;
|
40837
|
+
}); // @todo How to process unhandled rejection here?
|
40919
40838
|
|
40920
40839
|
if (startTwilsock) {
|
40921
40840
|
_this.services.twilsockClient.connect();
|
@@ -40944,7 +40863,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40944
40863
|
key: "reachabilityEnabled",
|
40945
40864
|
get: function get() {
|
40946
40865
|
if (!this.configuration) {
|
40947
|
-
throw new Error(
|
40866
|
+
throw new Error("Reachability information could not yet be accessed as the client " + "has not yet been initialized. Subscribe to the 'stateChanged' event " + "to properly react to the client initialization.");
|
40948
40867
|
}
|
40949
40868
|
|
40950
40869
|
return this.configuration.reachabilityEnabled;
|
@@ -40984,7 +40903,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
40984
40903
|
switch (_context2.prev = _context2.next) {
|
40985
40904
|
case 0:
|
40986
40905
|
_context2.next = 2;
|
40987
|
-
return this.services.commandExecutor.fetchResource(
|
40906
|
+
return this.services.commandExecutor.fetchResource("Client/v2/Configuration");
|
40988
40907
|
|
40989
40908
|
case 2:
|
40990
40909
|
configurationResponse = _context2.sent;
|
@@ -40995,31 +40914,55 @@ this.Twilio.Conversations = (function (exports) {
|
|
40995
40914
|
this.services.typingIndicator = new TypingIndicator(this.getConversationBySid.bind(this), this.configuration, this.services);
|
40996
40915
|
this.services.network = new Network(this.configuration, this.services);
|
40997
40916
|
this.services.users = new Users(this._myself, this.configuration, this.services);
|
40998
|
-
this.services.users.on(
|
40999
|
-
|
41000
|
-
|
40917
|
+
this.services.users.on("userSubscribed", function (user) {
|
40918
|
+
_this4.emit("userSubscribed", user);
|
40919
|
+
});
|
40920
|
+
this.services.users.on("userUpdated", function (args) {
|
40921
|
+
return _this4.emit("userUpdated", args);
|
40922
|
+
});
|
40923
|
+
this.services.users.on("userUnsubscribed", function (user) {
|
40924
|
+
_this4.emit("userUnsubscribed", user);
|
41001
40925
|
});
|
41002
|
-
this.services.users.on('userUnsubscribed', this.emit.bind(this, 'userUnsubscribed'));
|
41003
40926
|
this.conversations = new Conversations(this.configuration, this.services);
|
41004
|
-
this.conversations.on(
|
41005
|
-
|
41006
|
-
|
41007
|
-
this.conversations.on(
|
41008
|
-
|
41009
|
-
|
40927
|
+
this.conversations.on("conversationAdded", function (conversation) {
|
40928
|
+
_this4.emit("conversationAdded", conversation);
|
40929
|
+
});
|
40930
|
+
this.conversations.on("conversationRemoved", function (conversation) {
|
40931
|
+
_this4.emit("conversationRemoved", conversation);
|
40932
|
+
});
|
40933
|
+
this.conversations.on("conversationJoined", function (conversation) {
|
40934
|
+
_this4.emit("conversationJoined", conversation);
|
40935
|
+
});
|
40936
|
+
this.conversations.on("conversationLeft", function (conversation) {
|
40937
|
+
_this4.emit("conversationLeft", conversation);
|
40938
|
+
});
|
40939
|
+
this.conversations.on("conversationUpdated", function (args) {
|
40940
|
+
return _this4.emit("conversationUpdated", args);
|
40941
|
+
});
|
40942
|
+
this.conversations.on("participantJoined", function (participant) {
|
40943
|
+
_this4.emit("participantJoined", participant);
|
40944
|
+
});
|
40945
|
+
this.conversations.on("participantLeft", function (participant) {
|
40946
|
+
_this4.emit("participantLeft", participant);
|
40947
|
+
});
|
40948
|
+
this.conversations.on("participantUpdated", function (args) {
|
40949
|
+
return _this4.emit("participantUpdated", args);
|
40950
|
+
});
|
40951
|
+
this.conversations.on("messageAdded", function (message) {
|
40952
|
+
return _this4.emit("messageAdded", message);
|
40953
|
+
});
|
40954
|
+
this.conversations.on("messageUpdated", function (args) {
|
40955
|
+
return _this4.emit("messageUpdated", args);
|
40956
|
+
});
|
40957
|
+
this.conversations.on("messageRemoved", function (message) {
|
40958
|
+
return _this4.emit("messageRemoved", message);
|
41010
40959
|
});
|
41011
|
-
this.conversations.on(
|
41012
|
-
|
41013
|
-
this.conversations.on('participantUpdated', function (args) {
|
41014
|
-
return _this4.emit('participantUpdated', args);
|
40960
|
+
this.conversations.on("typingStarted", function (participant) {
|
40961
|
+
return _this4.emit("typingStarted", participant);
|
41015
40962
|
});
|
41016
|
-
this.conversations.on(
|
41017
|
-
|
41018
|
-
return _this4.emit('messageUpdated', args);
|
40963
|
+
this.conversations.on("typingEnded", function (participant) {
|
40964
|
+
return _this4.emit("typingEnded", participant);
|
41019
40965
|
});
|
41020
|
-
this.conversations.on('messageRemoved', this.emit.bind(this, 'messageRemoved'));
|
41021
|
-
this.conversations.on('typingStarted', this.emit.bind(this, 'typingStarted'));
|
41022
|
-
this.conversations.on('typingEnded', this.emit.bind(this, 'typingEnded'));
|
41023
40966
|
this.conversationsPromise = this.conversations.fetchConversations().then(function () {
|
41024
40967
|
return _this4.conversations;
|
41025
40968
|
}).catch(function (error) {
|
@@ -41034,12 +40977,12 @@ this.Twilio.Conversations = (function (exports) {
|
|
41034
40977
|
});
|
41035
40978
|
this.services.typingIndicator.initialize();
|
41036
40979
|
this.services.mcsClient = new browser.McsClient(this.fpaToken, this.configuration.links.mediaService, this.configuration.links.mediaSetService, _objectSpread(_objectSpread({}, this.options), {}, {
|
41037
|
-
transport:
|
40980
|
+
transport: undefined
|
41038
40981
|
}));
|
41039
40982
|
|
41040
40983
|
this._resolveEnsureReady();
|
41041
40984
|
|
41042
|
-
this.emit(
|
40985
|
+
this.emit("stateChanged", "initialized");
|
41043
40986
|
|
41044
40987
|
case 33:
|
41045
40988
|
case "end":
|
@@ -41105,7 +41048,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41105
41048
|
return this._ensureReady;
|
41106
41049
|
|
41107
41050
|
case 2:
|
41108
|
-
log.info(
|
41051
|
+
log.info("updateToken");
|
41109
41052
|
|
41110
41053
|
if (!(this.fpaToken === token)) {
|
41111
41054
|
_context4.next = 5;
|
@@ -41267,7 +41210,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41267
41210
|
}, {
|
41268
41211
|
key: "getSubscribedConversations",
|
41269
41212
|
value: function () {
|
41270
|
-
var _getSubscribedConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(
|
41213
|
+
var _getSubscribedConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7() {
|
41271
41214
|
return _regeneratorRuntime$1.wrap(function _callee7$(_context7) {
|
41272
41215
|
while (1) {
|
41273
41216
|
switch (_context7.prev = _context7.next) {
|
@@ -41277,7 +41220,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41277
41220
|
|
41278
41221
|
case 2:
|
41279
41222
|
return _context7.abrupt("return", this.conversationsPromise.then(function (conversations) {
|
41280
|
-
return conversations.getConversations(
|
41223
|
+
return conversations.getConversations();
|
41281
41224
|
}));
|
41282
41225
|
|
41283
41226
|
case 3:
|
@@ -41288,7 +41231,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41288
41231
|
}, _callee7, this);
|
41289
41232
|
}));
|
41290
41233
|
|
41291
|
-
function getSubscribedConversations(
|
41234
|
+
function getSubscribedConversations() {
|
41292
41235
|
return _getSubscribedConversations.apply(this, arguments);
|
41293
41236
|
}
|
41294
41237
|
|
@@ -41325,7 +41268,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41325
41268
|
}, _callee8, this);
|
41326
41269
|
}));
|
41327
41270
|
|
41328
|
-
function createConversation(
|
41271
|
+
function createConversation(_x4) {
|
41329
41272
|
return _createConversation.apply(this, arguments);
|
41330
41273
|
}
|
41331
41274
|
|
@@ -41363,7 +41306,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41363
41306
|
}, _callee9, this);
|
41364
41307
|
}));
|
41365
41308
|
|
41366
|
-
function setPushRegistrationId(
|
41309
|
+
function setPushRegistrationId(_x5, _x6) {
|
41367
41310
|
return _setPushRegistrationId.apply(this, arguments);
|
41368
41311
|
}
|
41369
41312
|
|
@@ -41400,7 +41343,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41400
41343
|
}, _callee10, this);
|
41401
41344
|
}));
|
41402
41345
|
|
41403
|
-
function unsetPushRegistrationId(
|
41346
|
+
function unsetPushRegistrationId(_x7) {
|
41404
41347
|
return _unsetPushRegistrationId.apply(this, arguments);
|
41405
41348
|
}
|
41406
41349
|
|
@@ -41436,7 +41379,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41436
41379
|
}, _callee11, this);
|
41437
41380
|
}));
|
41438
41381
|
|
41439
|
-
function removePushRegistrations(
|
41382
|
+
function removePushRegistrations(_x8, _x9) {
|
41440
41383
|
return _removePushRegistrations.apply(this, arguments);
|
41441
41384
|
}
|
41442
41385
|
|
@@ -41459,8 +41402,8 @@ this.Twilio.Conversations = (function (exports) {
|
|
41459
41402
|
return this._ensureReady;
|
41460
41403
|
|
41461
41404
|
case 2:
|
41462
|
-
log.debug(
|
41463
|
-
this.emit(
|
41405
|
+
log.debug("handlePushNotification, notificationPayload=", notificationPayload);
|
41406
|
+
this.emit("pushNotification", Client_1.parsePushNotification(notificationPayload));
|
41464
41407
|
|
41465
41408
|
case 4:
|
41466
41409
|
case "end":
|
@@ -41470,7 +41413,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41470
41413
|
}, _callee12, this);
|
41471
41414
|
}));
|
41472
41415
|
|
41473
|
-
function handlePushNotification(
|
41416
|
+
function handlePushNotification(_x10) {
|
41474
41417
|
return _handlePushNotification.apply(this, arguments);
|
41475
41418
|
}
|
41476
41419
|
|
@@ -41505,7 +41448,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41505
41448
|
}, _callee13, this);
|
41506
41449
|
}));
|
41507
41450
|
|
41508
|
-
function getUser(
|
41451
|
+
function getUser(_x11) {
|
41509
41452
|
return _getUser.apply(this, arguments);
|
41510
41453
|
}
|
41511
41454
|
|
@@ -41592,7 +41535,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41592
41535
|
break;
|
41593
41536
|
}
|
41594
41537
|
|
41595
|
-
throw new Error(
|
41538
|
+
throw new Error("Obsolete usage of ConversationsClient.create() " + "factory method: if you pass twilsock from the outside then you must " + "use ConversationsClient constructor and be prepared to work with " + "uninitialized client.");
|
41596
41539
|
|
41597
41540
|
case 2:
|
41598
41541
|
client = new Client_1(token, options);
|
@@ -41610,7 +41553,7 @@ this.Twilio.Conversations = (function (exports) {
|
|
41610
41553
|
}, _callee15);
|
41611
41554
|
}));
|
41612
41555
|
|
41613
|
-
function create(
|
41556
|
+
function create(_x12, _x13) {
|
41614
41557
|
return _create.apply(this, arguments);
|
41615
41558
|
}
|
41616
41559
|
|
@@ -41622,11 +41565,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
41622
41565
|
var result = {};
|
41623
41566
|
|
41624
41567
|
for (var key in Client_1.supportedPushDataFields) {
|
41625
|
-
if (typeof data[key] ===
|
41568
|
+
if (typeof data[key] === "undefined" || data[key] === null) {
|
41626
41569
|
continue;
|
41627
41570
|
}
|
41628
41571
|
|
41629
|
-
if (key !==
|
41572
|
+
if (key !== "message_index") {
|
41630
41573
|
result[Client_1.supportedPushDataFields[key]] = data[key];
|
41631
41574
|
continue;
|
41632
41575
|
}
|
@@ -41646,19 +41589,19 @@ this.Twilio.Conversations = (function (exports) {
|
|
41646
41589
|
}, {
|
41647
41590
|
key: "parsePushNotification",
|
41648
41591
|
value: function parsePushNotification(notificationPayload) {
|
41649
|
-
log.debug(
|
41592
|
+
log.debug("parsePushNotification, notificationPayload=", notificationPayload); // APNS specifics
|
41650
41593
|
|
41651
|
-
if (typeof notificationPayload.aps !==
|
41594
|
+
if (typeof notificationPayload.aps !== "undefined") {
|
41652
41595
|
if (!notificationPayload.twi_message_type) {
|
41653
|
-
throw new Error(
|
41596
|
+
throw new Error("Provided push notification payload does not contain Programmable Chat push notification type");
|
41654
41597
|
}
|
41655
41598
|
|
41656
41599
|
var data = Client_1.parsePushNotificationChatData(notificationPayload);
|
41657
41600
|
var apsPayload = notificationPayload.aps;
|
41658
|
-
var body
|
41601
|
+
var body;
|
41659
41602
|
var title = null;
|
41660
41603
|
|
41661
|
-
if (typeof apsPayload.alert ===
|
41604
|
+
if (typeof apsPayload.alert === "string") {
|
41662
41605
|
body = apsPayload.alert || null;
|
41663
41606
|
} else {
|
41664
41607
|
body = apsPayload.alert.body || null;
|
@@ -41677,11 +41620,11 @@ this.Twilio.Conversations = (function (exports) {
|
|
41677
41620
|
} // FCM specifics
|
41678
41621
|
|
41679
41622
|
|
41680
|
-
if (typeof notificationPayload.data !==
|
41623
|
+
if (typeof notificationPayload.data !== "undefined") {
|
41681
41624
|
var dataPayload = notificationPayload.data;
|
41682
41625
|
|
41683
41626
|
if (!dataPayload.twi_message_type) {
|
41684
|
-
throw new Error(
|
41627
|
+
throw new Error("Provided push notification payload does not contain Programmable Chat push notification type");
|
41685
41628
|
}
|
41686
41629
|
|
41687
41630
|
var _data = Client_1.parsePushNotificationChatData(notificationPayload.data);
|
@@ -41697,16 +41640,16 @@ this.Twilio.Conversations = (function (exports) {
|
|
41697
41640
|
});
|
41698
41641
|
}
|
41699
41642
|
|
41700
|
-
throw new Error(
|
41643
|
+
throw new Error("Provided push notification payload is not Programmable Chat notification");
|
41701
41644
|
}
|
41702
41645
|
}]);
|
41703
41646
|
|
41704
41647
|
return Client;
|
41705
|
-
}(ReplayEventEmitter_1), _defineProperty$3(_class, "version", SDK_VERSION), _defineProperty$3(_class, "supportedPushChannels", [
|
41706
|
-
|
41707
|
-
|
41708
|
-
|
41709
|
-
}), _defineProperty$3(_class, "conversationAdded",
|
41648
|
+
}(ReplayEventEmitter_1), _defineProperty$3(_class, "version", SDK_VERSION), _defineProperty$3(_class, "supportedPushChannels", ["fcm", "apn"]), _defineProperty$3(_class, "supportedPushDataFields", {
|
41649
|
+
conversation_sid: "conversationSid",
|
41650
|
+
message_sid: "messageSid",
|
41651
|
+
message_index: "messageIndex"
|
41652
|
+
}), _defineProperty$3(_class, "conversationAdded", "conversationAdded"), _defineProperty$3(_class, "conversationJoined", "conversationJoined"), _defineProperty$3(_class, "conversationLeft", "conversationLeft"), _defineProperty$3(_class, "conversationRemoved", "conversationRemoved"), _defineProperty$3(_class, "conversationUpdated", "conversationUpdated"), _defineProperty$3(_class, "participantJoined", "participantJoined"), _defineProperty$3(_class, "participantLeft", "participantLeft"), _defineProperty$3(_class, "participantUpdated", "participantUpdated"), _defineProperty$3(_class, "messageAdded", "messageAdded"), _defineProperty$3(_class, "messageRemoved", "messageRemoved"), _defineProperty$3(_class, "messageUpdated", "messageUpdated"), _defineProperty$3(_class, "tokenAboutToExpire", "tokenAboutToExpire"), _defineProperty$3(_class, "tokenExpired", "tokenExpired"), _defineProperty$3(_class, "typingEnded", "typingEnded"), _defineProperty$3(_class, "typingStarted", "typingStarted"), _defineProperty$3(_class, "pushNotification", "pushNotification"), _defineProperty$3(_class, "userSubscribed", "userSubscribed"), _defineProperty$3(_class, "userUnsubscribed", "userUnsubscribed"), _defineProperty$3(_class, "userUpdated", "userUpdated"), _defineProperty$3(_class, "stateChanged", "stateChanged"), _defineProperty$3(_class, "connectionStateChanged", "connectionStateChanged"), _defineProperty$3(_class, "connectionError", "connectionError"), _temp);
|
41710
41653
|
|
41711
41654
|
__decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "updateToken", null);
|
41712
41655
|
|
@@ -41714,27 +41657,27 @@ this.Twilio.Conversations = (function (exports) {
|
|
41714
41657
|
|
41715
41658
|
__decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "getConversationByUniqueName", null);
|
41716
41659
|
|
41717
|
-
__decorate$1([validateTypesAsync_1([
|
41718
|
-
friendlyName: [
|
41719
|
-
isPrivate: [
|
41720
|
-
uniqueName: [
|
41660
|
+
__decorate$1([validateTypesAsync_1(["undefined", objectSchema_1("conversation options", {
|
41661
|
+
friendlyName: ["string", "undefined"],
|
41662
|
+
isPrivate: ["boolean", "undefined"],
|
41663
|
+
uniqueName: ["string", "undefined"]
|
41721
41664
|
})]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "createConversation", null);
|
41722
41665
|
|
41723
|
-
__decorate$1([validateTypesAsync_1(literal_1(
|
41666
|
+
__decorate$1([validateTypesAsync_1(literal_1("fcm", "apn"), "string"), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "setPushRegistrationId", null);
|
41724
41667
|
|
41725
|
-
__decorate$1([validateTypesAsync_1(literal_1(
|
41668
|
+
__decorate$1([validateTypesAsync_1(literal_1("fcm", "apn")), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "unsetPushRegistrationId", null);
|
41726
41669
|
|
41727
|
-
__decorate$1([validateTypesAsync_1(literal_1(
|
41670
|
+
__decorate$1([validateTypesAsync_1(literal_1("fcm", "apn"), nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "removePushRegistrations", null);
|
41728
41671
|
|
41729
41672
|
__decorate$1([validateTypesAsync_1(pureObject_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "handlePushNotification", null);
|
41730
41673
|
|
41731
41674
|
__decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "getUser", null);
|
41732
41675
|
|
41733
|
-
__decorate$1([validateTypesAsync_1(
|
41676
|
+
__decorate$1([validateTypesAsync_1("string", ["undefined", pureObject_1]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, Object]), __metadata$1("design:returntype", Promise)], exports.Client, "create", null);
|
41734
41677
|
|
41735
41678
|
__decorate$1([validateTypes_1(pureObject_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", PushNotification)], exports.Client, "parsePushNotification", null);
|
41736
41679
|
|
41737
|
-
exports.Client = Client_1 = __decorate$1([validateConstructorTypes_1(nonEmptyString_1, [pureObject_1,
|
41680
|
+
exports.Client = Client_1 = __decorate$1([validateConstructorTypes_1(nonEmptyString_1, [pureObject_1, "undefined"]), __metadata$1("design:paramtypes", [String, Object])], exports.Client);
|
41738
41681
|
|
41739
41682
|
exports.AggregatedDeliveryReceipt = AggregatedDeliveryReceipt;
|
41740
41683
|
exports.Conversation = Conversation;
|