Socket
Socket
Sign inDemoInstall

twilio-chat

Package Overview
Dependencies
87
Maintainers
2
Versions
367
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.13.0-dev-build.359 to 0.13.0-dev-build.360

77

browser/client.js

@@ -208,2 +208,4 @@ "use strict";

return __awaiter(this, void 0, void 0, _regenerator2.default.mark(function _callee() {
var _this2 = this;
var response, links;

@@ -225,16 +227,16 @@ return _regenerator2.default.wrap(function _callee$(_context) {

case 6:
this.notifications.subscribe('twilio.channel.new_message', 'fcm');
this.notifications.subscribe('twilio.channel.added_to_channel', 'fcm');
this.notifications.subscribe('twilio.channel.invited_to_channel', 'fcm');
_context.next = 11;
Client.supportedPushChannels.forEach(function (channelType) {
return _this2.subscribeToPushNotifications(channelType);
});
_context.next = 9;
return this.session.getSessionLinks();
case 11:
case 9:
links = _context.sent;
this.publicChannels = new publicchannels_1.PublicChannels(this.config, this, this.network, links.publicChannelsUrl);
_context.next = 15;
_context.next = 13;
return this.typingIndicator.initialize();
case 15:
case 13:
case "end":

@@ -247,2 +249,11 @@ return _context.stop();

}
}, {
key: "subscribeToPushNotifications",
value: function subscribeToPushNotifications(channelType) {
var _this3 = this;
['twilio.channel.new_message', 'twilio.channel.added_to_channel', 'twilio.channel.invited_to_channel', 'twilio.channel.removed_from_channel', 'twilio.ipmsg.typing_indicator', 'twilio.channel.consumption_update'].forEach(function (messageType) {
_this3.notifications.subscribe(messageType, channelType);
});
}
/**

@@ -261,6 +272,6 @@ * Initializes library

value: function initialize() {
var _this2 = this;
var _this4 = this;
return this.initializePromise.then(function () {
return _this2;
return _this4;
});

@@ -288,3 +299,3 @@ }

return __awaiter(this, void 0, void 0, _regenerator2.default.mark(function _callee2() {
var _this3 = this;
var _this5 = this;

@@ -320,10 +331,10 @@ return _regenerator2.default.wrap(function _callee2$(_context2) {

}).then(function (rtdToken) {
return _this3.twilsock.updateToken(fpaToken).then(function () {
return _this3.datasync.updateToken(fpaToken);
return _this5.twilsock.updateToken(fpaToken).then(function () {
return _this5.datasync.updateToken(fpaToken);
}).then(function () {
return _this3.notifications.updateToken(fpaToken);
return _this5.notifications.updateToken(fpaToken);
}).then(function () {
return _this3.sessionPromise;
return _this5.sessionPromise;
}).then(function () {
return _this3.session.updateToken(rtdToken);
return _this5.session.updateToken(rtdToken);
}).then(function () {

@@ -333,5 +344,5 @@ return rtdToken;

}).then(function (rtdToken) {
_this3.config.updateToken(rtdToken);
_this3.fpaToken = fpaToken;
return _this3;
_this5.config.updateToken(rtdToken);
_this5.fpaToken = fpaToken;
return _this5;
}));

@@ -357,3 +368,3 @@

return __awaiter(this, void 0, void 0, _regenerator2.default.mark(function _callee3() {
var _this4 = this;
var _this6 = this;

@@ -373,4 +384,4 @@ return _regenerator2.default.wrap(function _callee3$(_context3) {

return _context3.abrupt("return", this.channels.getChannel(channelSid).then(function (channel) {
return channel || _this4.publicChannels.getChannelBySid(channelSid).then(function (x) {
return _this4.channels.pushChannel(x);
return channel || _this6.publicChannels.getChannelBySid(channelSid).then(function (x) {
return _this6.channels.pushChannel(x);
});

@@ -397,3 +408,3 @@ }));

return __awaiter(this, void 0, void 0, _regenerator2.default.mark(function _callee4() {
var _this5 = this;
var _this7 = this;

@@ -413,3 +424,3 @@ return _regenerator2.default.wrap(function _callee4$(_context4) {

return _context4.abrupt("return", this.publicChannels.getChannelByUniqueName(uniqueName).then(function (x) {
return _this5.channels.pushChannel(x);
return _this7.channels.pushChannel(x);
}));

@@ -463,5 +474,4 @@

* Registers for push notifications
* @param {string} channelType - 'gcm', 'apn' and 'fcm' are supported
* @param {string} registrationId - Push notification id provided by platform
* @param {string} channelType - 'gcm' or 'apn' for now
* @private
*/

@@ -471,13 +481,17 @@

key: "setPushRegistrationId",
value: function setPushRegistrationId(registrationId, type) {
this.notifications.setPushRegistrationId(registrationId, type || 'gcm'); // notification? TBD
value: function setPushRegistrationId(channelType, registrationId) {
if (Client.supportedPushChannels.indexOf(channelType) === -1) {
throw new Error('Invalid or unsupported channelType: ' + channelType);
}
this.notifications.setPushRegistrationId(registrationId, channelType);
}
/**
* Push notification payload handler
* @private
* Incoming push notification handler
* @param {string} channelType - 'gcm', 'apn' and 'fcm' are supported
* @param {string} notificationPayload - Push notification payload
*/
}, {
key: "putPushNotificationPayload",
value: function putPushNotificationPayload(notification) {
key: "handlePushNotification",
value: function handlePushNotification(channelType, notification) {
var data = notification.additionalData;

@@ -510,3 +524,4 @@ switch (data.type) {

Client.version = SDK_VERSION;
Client.supportedPushChannels = ['fcm', 'apn', 'gcm'];
exports.Client = Client;
exports.default = Client;

@@ -78,2 +78,3 @@ /// <reference types="node" />

static readonly version: any;
private static readonly supportedPushChannels;
constructor(token: string, options?: Options);

@@ -87,2 +88,3 @@ readonly userInfo: UserInfo;

private _initialize();
private subscribeToPushNotifications(channelType);
/**

@@ -139,12 +141,12 @@ * Initializes library

* Registers for push notifications
* @param {string} channelType - 'gcm', 'apn' and 'fcm' are supported
* @param {string} registrationId - Push notification id provided by platform
* @param {string} channelType - 'gcm' or 'apn' for now
* @private
*/
setPushRegistrationId(registrationId: any, type: any): void;
setPushRegistrationId(channelType: string, registrationId: any): void;
/**
* Push notification payload handler
* @private
* Incoming push notification handler
* @param {string} channelType - 'gcm', 'apn' and 'fcm' are supported
* @param {string} notificationPayload - Push notification payload
*/
putPushNotificationPayload(notification: any): void;
handlePushNotification(channelType: string, notification: any): void;
}

@@ -151,0 +153,0 @@ /**

@@ -154,5 +154,3 @@ "use strict";

yield this.sessionPromise;
this.notifications.subscribe('twilio.channel.new_message', 'fcm');
this.notifications.subscribe('twilio.channel.added_to_channel', 'fcm');
this.notifications.subscribe('twilio.channel.invited_to_channel', 'fcm');
Client.supportedPushChannels.forEach(channelType => this.subscribeToPushNotifications(channelType));
let links = yield this.session.getSessionLinks();

@@ -163,2 +161,13 @@ this.publicChannels = new publicchannels_1.PublicChannels(this.config, this, this.network, links.publicChannelsUrl);

}
subscribeToPushNotifications(channelType) {
['twilio.channel.new_message',
'twilio.channel.added_to_channel',
'twilio.channel.invited_to_channel',
'twilio.channel.removed_from_channel',
'twilio.ipmsg.typing_indicator',
'twilio.channel.consumption_update']
.forEach(messageType => {
this.notifications.subscribe(messageType, channelType);
});
}
/**

@@ -273,14 +282,17 @@ * Initializes library

* Registers for push notifications
* @param {string} channelType - 'gcm', 'apn' and 'fcm' are supported
* @param {string} registrationId - Push notification id provided by platform
* @param {string} channelType - 'gcm' or 'apn' for now
* @private
*/
setPushRegistrationId(registrationId, type) {
this.notifications.setPushRegistrationId(registrationId, type || 'gcm'); // notification? TBD
setPushRegistrationId(channelType, registrationId) {
if (Client.supportedPushChannels.indexOf(channelType) === -1) {
throw new Error('Invalid or unsupported channelType: ' + channelType);
}
this.notifications.setPushRegistrationId(registrationId, channelType);
}
/**
* Push notification payload handler
* @private
* Incoming push notification handler
* @param {string} channelType - 'gcm', 'apn' and 'fcm' are supported
* @param {string} notificationPayload - Push notification payload
*/
putPushNotificationPayload(notification) {
handlePushNotification(channelType, notification) {
let data = notification.additionalData;

@@ -298,3 +310,4 @@ switch (data.type) {

Client.version = SDK_VERSION;
Client.supportedPushChannels = ['fcm', 'apn', 'gcm'];
exports.Client = Client;
exports.default = Client;
{
"name": "twilio-chat",
"version": "0.13.0-dev-build.359",
"version": "0.13.0-dev-build.360",
"description": "Twilio Chat service client library",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc