Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lesca-facebook-share

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lesca-facebook-share - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

.vscode/settings.json

4

lib/index.d.ts

@@ -10,6 +10,6 @@ declare global {

}
declare type Options = {
type Options = {
id: string;
};
declare type ShareOptions = {
type ShareOptions = {
method: string;

@@ -16,0 +16,0 @@ href: string;

@@ -1,90 +0,84 @@

var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _mise = require("./mise");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var defaultOption = {
v: 'v8.0',
onload: function onload() {}
};
var property = {
id: ''
};
var install = function install(uid, options) {
var opt = _objectSpread(_objectSpread({}, defaultOption), options);
var onload = opt.onload,
v = opt.v;
property.id = uid;
window.fbAsyncInit = function () {
window.FB.init({
appId: uid,
cookie: true,
xfbml: true,
version: v
});
onload === null || onload === void 0 || onload();
};
(function (d, s, id, _fjs$parentNode) {
var js,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk.js';
(_fjs$parentNode = fjs.parentNode) === null || _fjs$parentNode === void 0 || _fjs$parentNode.insertBefore(js, fjs);
})(document, 'script', 'facebook-jssdk');
};
var defaultShareOptions = {
method: 'share',
href: ''
};
var share = function share() {
var shareOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultShareOptions;
var href = shareOptions.href,
redirect_uri = shareOptions.redirect_uri,
hashtag = shareOptions.hashtag,
quote = shareOptions.quote;
var id = property.id;
if (!id) {
console.log('need to install');
return;
}
if ((0, _mise.userAgent)()) {
var p = {
method: 'share',
href: href
};
return __assign.apply(this, arguments);
if (hashtag) p.hashtag = '#' + hashtag;
if (quote) p.quote = quote;
window.FB.ui(p, function () {
if (redirect_uri) window.location.replace(redirect_uri);
});
} else {
var u = ["https://www.facebook.com/dialog/share?app_id=".concat(id, "&href=").concat(encodeURIComponent(href))];
if (redirect_uri) u.push("&redirect_uri=".concat(encodeURIComponent(redirect_uri)));
if (hashtag) u.push("&hashtag=%23".concat(encodeURIComponent(hashtag)));
if (quote) u.push("&quote=".concat(encodeURIComponent(quote)));
if (redirect_uri) window.location.href = u.join('');else {
if ((0, _mise.device)() === 'desktop') window.open(u[0]);else window.location.href = u.join('') + "&redirect_uri=".concat(encodeURIComponent((0, _mise.root)()));
}
}
};
define(["require", "exports", "./mise"], function (require, exports, mise_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var defaultOption = { v: 'v8.0', onload: function () { } };
var property = { id: '' };
var install = function (uid, options) {
var opt = __assign(__assign({}, defaultOption), options);
var onload = opt.onload, v = opt.v;
property.id = uid;
window.fbAsyncInit = function () {
window.FB.init({
appId: uid,
cookie: true,
xfbml: true,
version: v,
});
onload === null || onload === void 0 ? void 0 : onload();
};
(function (d, s, id) {
var _a;
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk.js';
(_a = fjs.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(js, fjs);
})(document, 'script', 'facebook-jssdk');
};
var defaultShareOptions = {
method: 'share',
href: '',
};
var share = function (shareOptions) {
if (shareOptions === void 0) { shareOptions = defaultShareOptions; }
var href = shareOptions.href, redirect_uri = shareOptions.redirect_uri, hashtag = shareOptions.hashtag, quote = shareOptions.quote;
var id = property.id;
if (!id) {
console.log('need to install');
return;
}
if ((0, mise_1.userAgent)()) {
var p = {
method: 'share',
href: href,
};
if (hashtag)
p.hashtag = '#' + hashtag;
if (quote)
p.quote = quote;
window.FB.ui(p, function () {
if (redirect_uri)
window.location.replace(redirect_uri);
});
}
else {
var u = [
"https://www.facebook.com/dialog/share?app_id=".concat(id, "&href=").concat(encodeURIComponent(href)),
];
if (redirect_uri)
u.push("&redirect_uri=".concat(encodeURIComponent(redirect_uri)));
if (hashtag)
u.push("&hashtag=%23".concat(encodeURIComponent(hashtag)));
if (quote)
u.push("&quote=".concat(encodeURIComponent(quote)));
if (redirect_uri)
window.location.href = u.join('');
else {
if ((0, mise_1.device)() === 'desktop')
window.open(u[0]);
else
window.location.href = u.join('') + "&redirect_uri=".concat(encodeURIComponent((0, mise_1.root)()));
}
}
};
var Facebook = { install: install, share: share };
exports.default = Facebook;
});
var Facebook = {
install: install,
share: share
};
var _default = exports["default"] = Facebook;

@@ -1,35 +0,29 @@

var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.userAgent = exports.root = exports.device = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _mobileDetect = _interopRequireDefault(require("mobile-detect"));
var userAgent = exports.userAgent = function userAgent() {
var ua = navigator.userAgent || navigator.vendor || window.opera;
return ua.indexOf('FBAN') > -1 || ua.indexOf('FBAV') > -1;
};
define(["require", "exports", "mobile-detect"], function (require, exports, mobile_detect_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.root = exports.device = exports.userAgent = void 0;
mobile_detect_1 = __importDefault(mobile_detect_1);
var userAgent = function () {
var ua = navigator.userAgent || navigator.vendor || window.opera;
return ua.indexOf('FBAN') > -1 || ua.indexOf('FBAV') > -1;
};
exports.userAgent = userAgent;
var device = function () {
var m = new mobile_detect_1.default(window.navigator.userAgent);
if (m.tablet())
return 'mobile';
else if (m.mobile())
return 'mobile';
else
return 'desktop';
};
exports.device = device;
var root = function () {
var u = window.location.origin + window.location.pathname;
if (u.indexOf('.') > 0) {
var p = u.split('/');
p.pop();
var f = p.splice(0, 2)[0];
return "".concat(f, "//").concat(p.join('/'), "/");
}
return u;
};
exports.root = root;
});
var device = exports.device = function device() {
var m = new _mobileDetect["default"](window.navigator.userAgent);
if (m.tablet()) return 'mobile';else if (m.mobile()) return 'mobile';else return 'desktop';
};
var root = exports.root = function root() {
var u = window.location.origin + window.location.pathname;
if (u.indexOf('.') > 0) {
var p = u.split('/');
p.pop();
var _p$splice = p.splice(0, 2),
_p$splice2 = (0, _slicedToArray2["default"])(_p$splice, 1),
f = _p$splice2[0];
return "".concat(f, "//").concat(p.join('/'), "/");
}
return u;
};
{
"name": "lesca-facebook-share",
"version": "1.1.0",
"version": "1.1.1",
"description": "Simple facebook share",

@@ -18,4 +18,2 @@ "main": "lib/index.js",

"lesca",
"衝康吉",
"jameshsu1125",
"Facebook share"

@@ -25,41 +23,42 @@ ],

"devDependencies": {
"@babel/cli": "^7.18.6",
"@babel/core": "^7.18.6",
"@babel/cli": "^7.23.0",
"@babel/core": "^7.23.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
"@mui/icons-material": "^5.8.4",
"@mui/material": "^5.8.6",
"autoprefixer": "^10.4.7",
"babel-loader": "^8.2.5",
"concurrently": "^7.2.2",
"css-loader": "^6.7.1",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.14",
"@mui/material": "^5.14.14",
"autoprefixer": "^10.4.16",
"babel-loader": "^9.1.3",
"concurrently": "^8.2.2",
"css-loader": "^6.8.1",
"file-loader": "^6.2.0",
"gh-pages": "^4.0.0",
"html-react-parser": "^2.0.0",
"html-webpack-plugin": "^5.5.0",
"less": "^4.1.3",
"less-loader": "^11.0.0",
"gh-pages": "^6.0.0",
"html-react-parser": "^4.2.9",
"html-webpack-plugin": "^5.5.3",
"less": "^4.2.0",
"less-loader": "^11.1.3",
"less-vars-to-js": "^1.3.0",
"postcss": "^8.4.14",
"postcss-loader": "^7.0.0",
"prismjs": "^1.28.0",
"postcss": "^8.4.31",
"postcss-loader": "^7.3.3",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"style-loader": "^3.3.1",
"ts-loader": "^9.3.1",
"typescript": "^4.7.4",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.3"
"style-loader": "^3.3.3",
"ts-loader": "^9.5.0",
"typescript": "^5.2.2",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"author": "jamehsu1125 <jameshsu1125@gmail.com>",
"dependencies": {
"@babel/runtime": "^7.23.2",
"mobile-detect": "^1.4.5"
}
}
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