Socket
Socket
Sign inDemoInstall

cordova-plugin-facebook4

Package Overview
Dependencies
Maintainers
3
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-facebook4 - npm Package Compare versions

Comparing version 1.7.2 to 1.7.3

scripts/after_prepare.js

10

docs/browser/README.md

@@ -31,14 +31,4 @@ # Facebook Requirements and Set-Up [Web App]

- The difference between the JS API and Native is that the Facebook JS SDK must be initiated. Here is an example:
```js
if (window.cordova.platformId == "browser") {
facebookConnectPlugin.browserInit(appId, version, success);
// version is optional. It refers to the version of API you may want to use.
// success is optional. It calls the function when the SDK has been inited
}
```
- In your facebook develop website settings page, add your server's domain to app domain (or localhost for testing).
![image](app_domain_setup.png)

2

package.json
{
"name": "cordova-plugin-facebook4",
"version": "1.7.2",
"version": "1.7.3",
"description": "Cordova Facebook SDK 4 Plugin",

@@ -5,0 +5,0 @@ "cordova": {

@@ -7,2 +7,4 @@ # cordova-plugin-facebook4

See npm package for versions - https://www.npmjs.com/package/cordova-plugin-facebook4
Make sure you've registered your Facebook app with Facebook and have an `APP_ID` [https://developers.facebook.com/apps](https://developers.facebook.com/apps).

@@ -46,4 +48,2 @@

**NOTE** : Developers should call `facebookConnectPlugin.browserInit(<appId>)` before login - **Web App ONLY** (see [Web App Guide](docs/browser/README.md))
Success function returns an Object like:

@@ -50,0 +50,0 @@

@@ -1,6 +0,13 @@

/* global FB */
var isInited = false
/* globals */
var __fbSdkReady = false;
var __fbCallbacks = [];
/* */
exports.getLoginStatus = function getLoginStatus (s, f) {
if (!assertInited()) return printError(f, new Error('init not called with valid version'))
if (!__fbSdkReady) {
return __fbCallbacks.push(function() {
getLoginStatus(s, f);
});
}
FB.getLoginStatus(function (response) {

@@ -12,3 +19,7 @@ s(response)

exports.showDialog = function showDialog (options, s, f) {
if (!assertInited()) return printError(f, new Error('init not called with valid version'))
if (!__fbSdkReady) {
return __fbCallbacks.push(function() {
showDialog(options, s, f);
});
}

@@ -21,2 +32,3 @@ options.name = options.name || ''

options.picture = options.picture || ''
options.quote = options.quote || ''

@@ -28,3 +40,3 @@ FB.ui(options, function (response) {

}
printError(f, response)
f(response.message)
})

@@ -34,3 +46,7 @@ }

exports.login = function login (permissions, s, f) {
if (!assertInited()) return printError(f, new Error('init not called with valid version'))
if (!__fbSdkReady) {
return __fbCallbacks.push(function() {
login(permissions, s, f);
});
}
// JS SDK takes an object here but the native SDKs use array.

@@ -51,3 +67,3 @@ var options = {}

} else {
printError(f, response.status)
f(response.status.message)
}

@@ -63,3 +79,3 @@ }, options)

}
printError(f, new Error('NO_TOKEN'))
f('NO_TOKEN')
}

@@ -72,3 +88,3 @@

exports.logPurchase = function (value, currency, s, f) {
exports.logPurchase = function logPurchase (value, currency, s, f) {
// AppEvents are not avaliable in JS.

@@ -78,3 +94,3 @@ s()

exports.appInvite = function (options, s, f) {
exports.appInvite = function appInvite (options, s, f) {
// App Invites are not avaliable in JS.

@@ -84,4 +100,9 @@ s()

exports.logout = function (s, f) {
if (!assertInited()) return printError(f, new Error('init not called with valid version'))
exports.logout = function logout (s, f) {
if (!__fbSdkReady) {
return __fbCallbacks.push(function() {
logout(s, f);
});
}
FB.logout(function (response) {

@@ -92,4 +113,9 @@ s(response)

exports.api = function (graphPath, permissions, s, f) {
if (!assertInited()) return printError(f, new Error('init not called with valid version'))
exports.api = function api (graphPath, permissions, s, f) {
if (!__fbSdkReady) {
return __fbCallbacks.push(function() {
api(graphPath, permissions, s, f);
});
}
// JS API does not take additional permissions

@@ -105,53 +131,31 @@ FB.api(graphPath, function (response) {

// Browser wrapper API ONLY
exports.browserInit = function (appId, version, s) {
if (s == null && typeof version === 'function') {
s = version
version = null
}
exports.browserInit = function browserInit (appId, version, s) {
console.warn("browserInit is deprecated and may be removed in the future");
console.trace();
}
// Global :(
// This function will be called by the FB SDK when the client is inited
window.fbAsyncInit = function fbAsyncInit () {
version = version || 'v2.6'
if (window.location.protocol === "file:") {
console.warn("Facebook JS SDK is not supported when using file:// protocol");
} else {
window.fbAsyncInit = function() {
FB.init({
appId: appId,
xfbml: false,
version: version
})
appId : APP_ID, // APP_ID is populated by the cordova after_prepare hook
xfbml : true,
version : 'v2.6'
});
isInited = true
__fbSdkReady = true;
if (typeof s === 'function') s()
}
for (var i = 0; i < __fbCallbacks.length; i++) {
__fbCallbacks[i]();
}
};
// Bake in the JS SDK
insertSdk()
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
}
function assertInited () {
if (!isInited) {
return false
}
return true
}
function printError (f, err) {
if (typeof f === 'function') {
f(err.message)
return
}
console.error(err.stack)
}
function insertSdk () {
var js
var fjs = document.getElementsByTagName('script')[0]
if (document.getElementById('facebook-jssdk')) return
js = document.createElement('script')
js.id = 'facebook-jssdk'
js.src = 'https://connect.facebook.net/en_US/sdk.js'
fjs.parentNode.insertBefore(js, fjs)
}

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 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 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 not supported yet

Sorry, the diff of this file is not supported yet

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