@widergy/react-social-auth 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [2.0.0](https://github.com/widergy/react-social-auth/compare/v1.3.0...v2.0.0) (2023-01-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * buttons & labels ([#10](https://github.com/widergy/react-social-auth/issues/10)) ([88c542f](https://github.com/widergy/react-social-auth/commit/88c542f767175c36ecaea495986dd9f57bafe6d6))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * ..
12
+
1
13
  # [1.3.0](https://github.com/widergy/react-social-auth/compare/v1.2.1...v1.3.0) (2022-01-17)
2
14
 
3
15
 
@@ -1,169 +1,132 @@
1
1
  "use strict";
2
2
 
3
3
  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); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _propTypes = require("prop-types");
13
-
14
10
  var _msalBrowser = require("@azure/msal-browser");
15
-
16
11
  var _utils = require("./utils");
17
-
18
12
  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); }
19
-
20
13
  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; }
21
-
14
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
22
15
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
23
-
24
16
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
25
-
26
17
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
-
28
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
-
30
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
-
19
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
32
22
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
-
34
23
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
-
36
24
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
-
38
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39
-
40
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
41
-
25
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
26
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
42
27
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
-
44
28
  var ActiveDirectory = function ActiveDirectory(_ref) {
45
29
  var Component = _ref.Component,
46
- authority = _ref.authority,
47
- onSuccess = _ref.onSuccess,
48
- onFailure = _ref.onFailure,
49
- clientId = _ref.clientId,
50
- redirectUri = _ref.redirectUri,
51
- scopes = _ref.scopes;
52
-
30
+ authority = _ref.authority,
31
+ onSuccess = _ref.onSuccess,
32
+ onFailure = _ref.onFailure,
33
+ clientId = _ref.clientId,
34
+ redirectUri = _ref.redirectUri,
35
+ scopes = _ref.scopes;
53
36
  var _useState = (0, _react.useState)(new _msalBrowser.PublicClientApplication({
54
- auth: _objectSpread({
55
- clientId: clientId,
56
- redirectUri: redirectUri
57
- }, authority ? {
58
- authority: authority
59
- } : {}),
60
- cache: {
61
- cacheLocation: 'sessionStorage',
62
- storeAuthStateInCookie: true
63
- }
64
- })),
65
- _useState2 = _slicedToArray(_useState, 1),
66
- publicClientApplication = _useState2[0];
67
-
37
+ auth: _objectSpread({
38
+ clientId: clientId,
39
+ redirectUri: redirectUri
40
+ }, authority ? {
41
+ authority: authority
42
+ } : {}),
43
+ cache: {
44
+ cacheLocation: 'sessionStorage',
45
+ storeAuthStateInCookie: true
46
+ }
47
+ })),
48
+ _useState2 = _slicedToArray(_useState, 1),
49
+ publicClientApplication = _useState2[0];
68
50
  var getAccessToken = /*#__PURE__*/function () {
69
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(selectedAccount) {
51
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(selectedAccount) {
70
52
  var accounts, account, silentResult;
71
- return regeneratorRuntime.wrap(function _callee$(_context) {
72
- while (1) {
73
- switch (_context.prev = _context.next) {
74
- case 0:
75
- _context.prev = 0;
76
- accounts = publicClientApplication.getAllAccounts();
77
- account = accounts.find(function (_account) {
78
- return _account.homeAccountId === selectedAccount.homeAccountId;
79
- });
80
-
81
- if (account) {
82
- _context.next = 5;
83
- break;
84
- }
85
-
86
- throw new Error('login_required');
87
-
88
- case 5:
89
- _context.next = 7;
90
- return publicClientApplication.acquireTokenSilent({
91
- scopes: scopes,
92
- account: account
93
- });
94
-
95
- case 7:
96
- silentResult = _context.sent;
97
- onSuccess({
98
- access_token: silentResult.accessToken
99
- });
100
- _context.next = 14;
53
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
54
+ while (1) switch (_context.prev = _context.next) {
55
+ case 0:
56
+ _context.prev = 0;
57
+ accounts = publicClientApplication.getAllAccounts();
58
+ account = accounts.find(function (_account) {
59
+ return _account.homeAccountId === selectedAccount.homeAccountId;
60
+ });
61
+ if (account) {
62
+ _context.next = 5;
101
63
  break;
102
-
103
- case 11:
104
- _context.prev = 11;
105
- _context.t0 = _context["catch"](0);
106
- if (onFailure) onFailure((0, _utils.normalizeError)(_context.t0));
107
-
108
- case 14:
109
- case "end":
110
- return _context.stop();
111
- }
64
+ }
65
+ throw new Error('login_required');
66
+ case 5:
67
+ _context.next = 7;
68
+ return publicClientApplication.acquireTokenSilent({
69
+ scopes: scopes,
70
+ account: account
71
+ });
72
+ case 7:
73
+ silentResult = _context.sent;
74
+ onSuccess({
75
+ access_token: silentResult.accessToken
76
+ });
77
+ _context.next = 14;
78
+ break;
79
+ case 11:
80
+ _context.prev = 11;
81
+ _context.t0 = _context["catch"](0);
82
+ if (onFailure) onFailure((0, _utils.normalizeError)(_context.t0));
83
+ case 14:
84
+ case "end":
85
+ return _context.stop();
112
86
  }
113
87
  }, _callee, null, [[0, 11]]);
114
88
  }));
115
-
116
- return function getAccessToken(_x) {
89
+ return function getAccessToken(_x2) {
117
90
  return _ref2.apply(this, arguments);
118
91
  };
119
92
  }();
120
-
121
93
  var handleLogin = /*#__PURE__*/function () {
122
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
94
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
123
95
  var response;
124
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
125
- while (1) {
126
- switch (_context2.prev = _context2.next) {
127
- case 0:
128
- _context2.prev = 0;
129
- _context2.next = 3;
130
- return publicClientApplication.loginPopup({
131
- scopes: scopes,
132
- prompt: 'select_account'
133
- });
134
-
135
- case 3:
136
- response = _context2.sent;
137
- _context2.next = 6;
138
- return getAccessToken(response.account);
139
-
140
- case 6:
141
- _context2.next = 11;
142
- break;
143
-
144
- case 8:
145
- _context2.prev = 8;
146
- _context2.t0 = _context2["catch"](0);
147
- if (onFailure) onFailure((0, _utils.normalizeError)(_context2.t0));
148
-
149
- case 11:
150
- case "end":
151
- return _context2.stop();
152
- }
96
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
97
+ while (1) switch (_context2.prev = _context2.next) {
98
+ case 0:
99
+ _context2.prev = 0;
100
+ _context2.next = 3;
101
+ return publicClientApplication.loginPopup({
102
+ scopes: scopes,
103
+ prompt: 'select_account'
104
+ });
105
+ case 3:
106
+ response = _context2.sent;
107
+ _context2.next = 6;
108
+ return getAccessToken(response.account);
109
+ case 6:
110
+ _context2.next = 11;
111
+ break;
112
+ case 8:
113
+ _context2.prev = 8;
114
+ _context2.t0 = _context2["catch"](0);
115
+ if (onFailure) onFailure((0, _utils.normalizeError)(_context2.t0));
116
+ case 11:
117
+ case "end":
118
+ return _context2.stop();
153
119
  }
154
120
  }, _callee2, null, [[0, 8]]);
155
121
  }));
156
-
157
122
  return function handleLogin() {
158
123
  return _ref3.apply(this, arguments);
159
124
  };
160
125
  }();
161
-
162
126
  return /*#__PURE__*/_react.default.createElement(Component, {
163
127
  onLogin: handleLogin
164
128
  });
165
129
  };
166
-
167
130
  ActiveDirectory.propTypes = {
168
131
  Component: _propTypes.node,
169
132
  authority: _propTypes.string,
@@ -4,10 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.normalizeError = void 0;
7
-
8
7
  var normalizeError = function normalizeError(error) {
9
8
  var normalizedError = {};
10
-
11
9
  if (typeof error === 'string') {
12
10
  var errParts = error.split('|');
13
11
  normalizedError = errParts.length > 1 ? {
@@ -22,8 +20,6 @@ var normalizeError = function normalizeError(error) {
22
20
  debug: JSON.stringify(error)
23
21
  };
24
22
  }
25
-
26
23
  return normalizedError;
27
24
  };
28
-
29
25
  exports.normalizeError = normalizeError;
@@ -4,51 +4,41 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _energyUi = require("@widergy/energy-ui");
11
-
12
9
  var _propTypes = require("prop-types");
13
-
14
10
  var _apple = _interopRequireDefault(require("../../assets/apple.svg"));
15
-
16
11
  var _types = require("../../types");
17
-
18
12
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  var LargeButton = function LargeButton(_ref) {
23
15
  var onClick = _ref.onClick,
24
- label = _ref.label,
25
- _ref$classes = _ref.classes,
26
- classes = _ref$classes === void 0 ? {} : _ref$classes,
27
- icon = _ref.icon,
28
- uppercase = _ref.uppercase;
16
+ label = _ref.label,
17
+ _ref$classes = _ref.classes,
18
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
19
+ icon = _ref.icon;
29
20
  return /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
30
- onPress: onClick,
31
- className: "".concat(_stylesModule.default.button, " ").concat(classes.root)
32
- }, /*#__PURE__*/_react.default.createElement("div", {
33
- className: "".concat(_stylesModule.default.content, " ").concat(classes.content)
34
- }, /*#__PURE__*/_react.default.createElement("img", {
35
- src: icon || _apple.default,
36
- alt: "",
37
- className: "".concat(_stylesModule.default.icon, " ").concat(classes.largeIcon)
38
- }), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
39
- uppercase: uppercase,
40
- bold: true,
41
- white: true,
42
- className: "".concat(_stylesModule.default.label, " ").concat(classes.label)
43
- }, label)));
21
+ classNames: {
22
+ childrenContainer: _stylesModule.default.childrenContainer,
23
+ root: "".concat(_stylesModule.default.button, " ").concat(classes.root),
24
+ text: "".concat(_stylesModule.default.label, " ").concat(classes.label)
25
+ },
26
+ Icon: function Icon(_ref2) {
27
+ var className = _ref2.className;
28
+ return /*#__PURE__*/_react.default.createElement("img", {
29
+ src: icon || _apple.default,
30
+ alt: "",
31
+ className: "".concat(_stylesModule.default.icon, " ").concat(classes.largeIcon, " ").concat(className)
32
+ });
33
+ },
34
+ onClick: onClick
35
+ }, label);
44
36
  };
45
-
46
37
  LargeButton.propTypes = {
47
- onClick: _propTypes.func,
48
- label: _propTypes.string,
49
38
  classes: _types.classesType,
50
39
  icon: _propTypes.string,
51
- uppercase: _propTypes.bool
40
+ label: _propTypes.string,
41
+ onClick: _propTypes.func
52
42
  };
53
43
  var _default = LargeButton;
54
44
  exports.default = _default;
@@ -15,9 +15,7 @@
15
15
  }
16
16
  }
17
17
 
18
- .content {
19
- align-items: center;
20
- display: flex;
18
+ .childrenContainer {
21
19
  width: 100%;
22
20
  }
23
21
 
@@ -31,5 +29,7 @@
31
29
  }
32
30
 
33
31
  .label {
32
+ font-size: 0.875rem;
33
+ font-weight: 700;
34
34
  margin: 0 auto -2px;
35
35
  }
@@ -4,36 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _energyUi = require("@widergy/energy-ui");
11
-
12
9
  var _propTypes = require("prop-types");
13
-
14
10
  var _apple = _interopRequireDefault(require("../../assets/apple.svg"));
15
-
16
11
  var _types = require("../../types");
17
-
18
12
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  var SmallButton = function SmallButton(_ref) {
23
15
  var onClick = _ref.onClick,
24
- _ref$classes = _ref.classes,
25
- classes = _ref$classes === void 0 ? {} : _ref$classes,
26
- icon = _ref.icon;
27
- return /*#__PURE__*/_react.default.createElement(_energyUi.UTIconButton, {
28
- className: "".concat(_stylesModule.default.button, " ").concat(classes.root),
16
+ _ref$classes = _ref.classes,
17
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
18
+ icon = _ref.icon;
19
+ return /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
20
+ classNames: {
21
+ root: "".concat(_stylesModule.default.button, " ").concat(classes.root)
22
+ },
23
+ Icon: function Icon(_ref2) {
24
+ var className = _ref2.className;
25
+ return /*#__PURE__*/_react.default.createElement("img", {
26
+ src: icon || _apple.default,
27
+ alt: "",
28
+ className: "".concat(classes.smallIcon, " ").concat(className)
29
+ });
30
+ },
29
31
  onClick: onClick
30
- }, /*#__PURE__*/_react.default.createElement("img", {
31
- src: icon || _apple.default,
32
- alt: "",
33
- className: classes.smallIcon
34
- }));
32
+ });
35
33
  };
36
-
37
34
  SmallButton.propTypes = {
38
35
  onClick: _propTypes.func,
39
36
  classes: _types.classesType,
@@ -2,6 +2,7 @@
2
2
 
3
3
  .button {
4
4
  background-color: $black;
5
+ border-radius: 50%;
5
6
 
6
7
  &:hover {
7
8
  background-color: $black;
@@ -1,82 +1,62 @@
1
1
  "use strict";
2
2
 
3
3
  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); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _propTypes = require("prop-types");
13
-
14
10
  var _LargeButton = _interopRequireDefault(require("./components/LargeButton"));
15
-
16
11
  var _SmallButton = _interopRequireDefault(require("./components/SmallButton"));
17
-
18
12
  var _types = require("./types");
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  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); }
23
-
24
15
  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; }
25
-
16
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
26
17
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
27
-
28
18
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
29
-
30
19
  var SMALL_VARIANT = 'small';
31
-
32
20
  var Apple = function Apple(_ref) {
33
- var onSuccess = _ref.onSuccess,
34
- onFailure = _ref.onFailure,
35
- _ref$classes = _ref.classes,
36
- classes = _ref$classes === void 0 ? {} : _ref$classes,
37
- _ref$label = _ref.label,
38
- label = _ref$label === void 0 ? 'apple' : _ref$label,
39
- _ref$variant = _ref.variant,
40
- variant = _ref$variant === void 0 ? SMALL_VARIANT : _ref$variant,
41
- Component = _ref.Component,
42
- icon = _ref.icon,
43
- uppercase = _ref.uppercase;
44
-
21
+ var _ref$classes = _ref.classes,
22
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
23
+ Component = _ref.Component,
24
+ icon = _ref.icon,
25
+ _ref$label = _ref.label,
26
+ label = _ref$label === void 0 ? 'apple' : _ref$label,
27
+ onFailure = _ref.onFailure,
28
+ onSuccess = _ref.onSuccess,
29
+ uppercase = _ref.uppercase,
30
+ _ref$variant = _ref.variant,
31
+ variant = _ref$variant === void 0 ? SMALL_VARIANT : _ref$variant;
45
32
  var handleLogin = /*#__PURE__*/function () {
46
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
33
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
47
34
  var data;
48
- return regeneratorRuntime.wrap(function _callee$(_context) {
49
- while (1) {
50
- switch (_context.prev = _context.next) {
51
- case 0:
52
- _context.prev = 0;
53
- _context.next = 3;
54
- return window.AppleID.auth.signIn();
55
-
56
- case 3:
57
- data = _context.sent;
58
- if (onSuccess) onSuccess(data);
59
- _context.next = 10;
60
- break;
61
-
62
- case 7:
63
- _context.prev = 7;
64
- _context.t0 = _context["catch"](0);
65
- if (onFailure) onFailure(_context.t0);
66
-
67
- case 10:
68
- case "end":
69
- return _context.stop();
70
- }
35
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
36
+ while (1) switch (_context.prev = _context.next) {
37
+ case 0:
38
+ _context.prev = 0;
39
+ _context.next = 3;
40
+ return window.AppleID.auth.signIn();
41
+ case 3:
42
+ data = _context.sent;
43
+ if (onSuccess) onSuccess(data);
44
+ _context.next = 10;
45
+ break;
46
+ case 7:
47
+ _context.prev = 7;
48
+ _context.t0 = _context["catch"](0);
49
+ if (onFailure) onFailure(_context.t0);
50
+ case 10:
51
+ case "end":
52
+ return _context.stop();
71
53
  }
72
54
  }, _callee, null, [[0, 7]]);
73
55
  }));
74
-
75
56
  return function handleLogin() {
76
57
  return _ref2.apply(this, arguments);
77
58
  };
78
59
  }();
79
-
80
60
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, Component ? /*#__PURE__*/_react.default.createElement(Component, {
81
61
  onClick: handleLogin
82
62
  }) : variant === SMALL_VARIANT ? /*#__PURE__*/_react.default.createElement(_SmallButton.default, {
@@ -91,16 +71,15 @@ var Apple = function Apple(_ref) {
91
71
  classes: classes
92
72
  }));
93
73
  };
94
-
95
74
  Apple.propTypes = {
96
- onSuccess: _propTypes.func.required,
97
- onFailure: _propTypes.func.required,
98
75
  classes: _types.classesType,
99
- label: _propTypes.string,
100
- variant: _propTypes.string,
101
76
  Component: _propTypes.node,
102
77
  icon: _propTypes.string,
103
- uppercase: _propTypes.bool
78
+ label: _propTypes.string,
79
+ onSuccess: _propTypes.func,
80
+ onFailure: _propTypes.func,
81
+ uppercase: _propTypes.bool,
82
+ variant: _propTypes.string
104
83
  };
105
84
  var _default = Apple;
106
85
  exports.default = _default;