New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wingbot-facebook

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wingbot-facebook - npm Package Compare versions

Comparing version 2.1.5 to 2.5.0-alpha.1

.nyc_output/03bed62f-1b68-4fe2-8e8f-6b08af9ee141.json

6

package.json
{
"name": "wingbot-facebook",
"version": "2.1.5",
"version": "2.5.0-alpha.1",
"description": "Facebook messenger plugin for wingbot",

@@ -50,3 +50,3 @@ "main": "src/main.js",

"sinon": "^6.3.5",
"wingbot": "^2.0.0"
"wingbot": "^2.5.0-alpha.14"
},

@@ -59,4 +59,4 @@ "dependencies": {

"peerDependencies": {
"wingbot": "^2.0.0"
"wingbot": "^2.5.0-alpha.14"
}
}

@@ -125,2 +125,4 @@ /*

//
const messageSender = new FacebookSender(

@@ -137,7 +139,7 @@ options,

if (message.take_thread_control) {
const takeFromSelf = `${message.take_thread_control
.previous_owner_app_id}` === this._options.appId;
const takeFromSelf = !this._options.appId
|| `${message.take_thread_control.previous_owner_app_id}` === this._options.appId;
const appIdInMetaData = message.take_thread_control
.metadata === this._options.appId;
const appIdInMetaData = this._options.appId
&& message.take_thread_control.metadata === this._options.appId;

@@ -184,2 +186,4 @@ if (this._options.takeThreadAction && takeFromSelf && !appIdInMetaData) {

//
if (!event) {

@@ -213,4 +217,10 @@ return Promise.resolve({ status: 201 });

if (PROCESS_EVENTS.some(e => typeof message[e] !== 'undefined')) {
const senderId = (message.sender && message.sender.id) || null;
let senderId = null;
if (message.sender && message.sender.id) {
senderId = message.sender.id;
} else if (message.optin && message.optin.user_ref) {
senderId = message.optin.user_ref;
}
if (!eventsBySenderId.has(senderId)) {

@@ -217,0 +227,0 @@ eventsBySenderId.set(senderId, []);

@@ -32,3 +32,3 @@ /*

if (this._userRef) {
if (incommingMessage.optin) {
this._replaceRecipient = {

@@ -39,4 +39,2 @@ recipient: { user_ref: this._userRef }

this._gotUserId = null;
this.url = 'https://graph.facebook.com/v2.8/me';

@@ -145,12 +143,2 @@

const hasRecipientId = res && typeof res === 'object' && res.recipient_id;
if (hasRecipientId && this._resolveRef) {
this._replaceRecipient = {
// @ts-ignore
recipient: { id: res.recipient_id }
};
this._resolveRef({ senderId: res.recipient_id });
}
return res;

@@ -166,27 +154,31 @@ } catch (e) {

send (payload) {
if (payload.recipient && this._userRef && this._gotUserId === null) {
// we will be waiting for ref
this._gotUserId = new Promise((resolve) => {
this._resolveRef = (data = null) => {
this._resolveRef = null;
resolve(data);
async modifyStateAfterLoad (state, processor) {
if (this._incommingMessage.prior_message) {
const { identifier } = this._incommingMessage.prior_message;
const refState = await processor.stateStorage.getState(identifier, state.pageId);
if (refState) {
return {
state: refState.state
};
});
}
}
super.send(payload);
if (state._replaceRecipient) {
this._replaceRecipient = state._replaceRecipient;
}
return null;
}
async modifyStateBeforeStore () {
if (this._userRef && !this._gotUserId) {
throw new Error('No text message was sent, when optin arrived!');
if (this._replaceRecipient) {
return { _replaceRecipient: this._replaceRecipient };
}
if (this._gotUserId) {
return this._gotUserId;
}
return null;
}
}
module.exports = FacebookSender;
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc