auth0-lock
Version:
Auth0 Lock
74 lines (72 loc) • 3.58 kB
JavaScript
;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.STRATEGIES = void 0;
exports.authButtonsTheme = authButtonsTheme;
exports.displayName = displayName;
exports.socialConnections = socialConnections;
var l = _interopRequireWildcard(require("../../core/index"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
// TODO: Android version also has "unknonwn-social", "evernote" and
// "evernote-sandbox""evernote" in the list, considers "google-openid"
// to be enterprise and doesn't contain "salesforce-community". See
// https://github.com/auth0/Lock.Android/blob/98262cb7110e5d1c8a97e1129faf2621c1d8d111/lock/src/main/java/com/auth0/android/lock/utils/Strategies.java
var STRATEGIES = {
apple: 'Apple',
amazon: 'Amazon',
aol: 'Aol',
baidu: '百度',
bitbucket: 'Bitbucket',
box: 'Box',
dropbox: 'Dropbox',
dwolla: 'Dwolla',
ebay: 'ebay',
exact: 'Exact',
facebook: 'Facebook',
fitbit: 'Fitbit',
github: 'GitHub',
'google-openid': 'Google OpenId',
'google-oauth2': 'Google',
instagram: 'Instagram',
linkedin: 'LinkedIn',
miicard: 'miiCard',
paypal: 'PayPal',
'paypal-sandbox': 'PayPal Sandbox',
planningcenter: 'Planning Center',
renren: '人人',
salesforce: 'Salesforce',
'salesforce-community': 'Salesforce Community',
'salesforce-sandbox': 'Salesforce (sandbox)',
evernote: 'Evernote',
'evernote-sandbox': 'Evernote (sandbox)',
shopify: 'Shopify',
soundcloud: 'Soundcloud',
thecity: 'The City',
'thecity-sandbox': 'The City (sandbox)',
thirtysevensignals: 'Basecamp',
twitter: 'Twitter',
vkontakte: 'vKontakte',
windowslive: 'Microsoft Account',
wordpress: 'Wordpress',
yahoo: 'Yahoo!',
yammer: 'Yammer',
yandex: 'Yandex',
weibo: '新浪微博',
line: 'Line'
};
exports.STRATEGIES = STRATEGIES;
function displayName(connection) {
if (['oauth1', 'oauth2'].indexOf(connection.get('strategy')) !== -1) {
return connection.get('name');
}
return STRATEGIES[connection.get('strategy')];
}
function socialConnections(m) {
return l.connections(m, 'social');
}
function authButtonsTheme(m) {
return l.ui.authButtonsTheme(m);
}