@widergy/react-social-auth 2.2.1 → 3.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 +13 -0
- package/dist/components/ActiveDirectory/index.js +55 -115
- package/dist/components/ActiveDirectory/utils.js +5 -4
- package/dist/components/Apple/index.js +38 -62
- package/dist/components/Apple/utils.js +14 -34
- package/dist/components/Button/index.js +17 -14
- package/dist/components/ButtonContainer/index.js +14 -24
- package/dist/components/Facebook/index.js +43 -48
- package/dist/components/Google/components/GoogleButton/index.js +20 -21
- package/dist/components/Google/index.js +17 -19
- package/dist/components/Microsoft/index.js +19 -19
- package/dist/components/Microsoft/styles.module.scss +2 -2
- package/dist/components/Twitter/errors.js +43 -84
- package/dist/components/Twitter/index.js +38 -62
- package/dist/components/Twitter/utils.js +47 -82
- package/dist/components/utils.js +3 -2
- package/dist/constants/buttonSizes.js +2 -2
- package/dist/index.js +8 -8
- package/dist/scss/variables/_colors.scss +4 -4
- package/package.json +27 -68
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [3.0.0](https://github.com/widergy/react-social-auth/compare/v2.2.1...v3.0.0) (2023-11-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update deps react social auth ([#18](https://github.com/widergy/react-social-auth/issues/18)) ([aab914d](https://github.com/widergy/react-social-auth/commit/aab914d3fd2392a5fc0717e61d40992b26920b52))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* dependencies
|
|
12
|
+
* dependencies
|
|
13
|
+
|
|
1
14
|
## [2.2.1](https://github.com/widergy/react-social-auth/compare/v2.2.0...v2.2.1) (2023-11-02)
|
|
2
15
|
|
|
3
16
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,120 +8,61 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
8
|
var _propTypes = require("prop-types");
|
|
10
9
|
var _msalBrowser = require("@azure/msal-browser");
|
|
11
10
|
var _utils = require("./utils");
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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();
|
|
86
|
-
}
|
|
87
|
-
}, _callee, null, [[0, 11]]);
|
|
88
|
-
}));
|
|
89
|
-
return function getAccessToken(_x) {
|
|
90
|
-
return _ref2.apply(this, arguments);
|
|
91
|
-
};
|
|
92
|
-
}();
|
|
93
|
-
var handleLogin = /*#__PURE__*/function () {
|
|
94
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
95
|
-
var response;
|
|
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();
|
|
119
|
-
}
|
|
120
|
-
}, _callee2, null, [[0, 8]]);
|
|
121
|
-
}));
|
|
122
|
-
return function handleLogin() {
|
|
123
|
-
return _ref3.apply(this, arguments);
|
|
124
|
-
};
|
|
125
|
-
}();
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
const ActiveDirectory = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
Component,
|
|
16
|
+
authority,
|
|
17
|
+
onSuccess,
|
|
18
|
+
onFailure,
|
|
19
|
+
clientId,
|
|
20
|
+
redirectUri,
|
|
21
|
+
scopes
|
|
22
|
+
} = _ref;
|
|
23
|
+
const [publicClientApplication] = (0, _react.useState)(new _msalBrowser.PublicClientApplication({
|
|
24
|
+
auth: {
|
|
25
|
+
clientId,
|
|
26
|
+
redirectUri,
|
|
27
|
+
...(authority ? {
|
|
28
|
+
authority
|
|
29
|
+
} : {})
|
|
30
|
+
},
|
|
31
|
+
cache: {
|
|
32
|
+
cacheLocation: 'sessionStorage',
|
|
33
|
+
storeAuthStateInCookie: true,
|
|
34
|
+
claimsBasedCachingEnabled: true
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
const getAccessToken = async selectedAccount => {
|
|
38
|
+
try {
|
|
39
|
+
await publicClientApplication.initialize();
|
|
40
|
+
const accounts = publicClientApplication.getAllAccounts();
|
|
41
|
+
const account = accounts.find(_account => _account.homeAccountId === selectedAccount.homeAccountId);
|
|
42
|
+
if (!account) throw new Error('login_required');
|
|
43
|
+
const silentResult = await publicClientApplication.acquireTokenSilent({
|
|
44
|
+
scopes,
|
|
45
|
+
account
|
|
46
|
+
});
|
|
47
|
+
onSuccess({
|
|
48
|
+
access_token: silentResult.accessToken
|
|
49
|
+
});
|
|
50
|
+
} catch (err) {
|
|
51
|
+
if (onFailure) onFailure((0, _utils.normalizeError)(err));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const handleLogin = async () => {
|
|
55
|
+
try {
|
|
56
|
+
await publicClientApplication.initialize();
|
|
57
|
+
const response = await publicClientApplication.loginPopup({
|
|
58
|
+
scopes,
|
|
59
|
+
prompt: 'select_account'
|
|
60
|
+
});
|
|
61
|
+
await getAccessToken(response.account);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
if (onFailure) onFailure((0, _utils.normalizeError)(err));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
126
66
|
return /*#__PURE__*/_react.default.createElement(Component, {
|
|
127
67
|
onLogin: handleLogin
|
|
128
68
|
});
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.normalizeError = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const normalizeError = error => {
|
|
8
|
+
let normalizedError = {};
|
|
9
9
|
if (typeof error === 'string') {
|
|
10
|
-
|
|
10
|
+
const errParts = error.split('|');
|
|
11
11
|
normalizedError = errParts.length > 1 ? {
|
|
12
12
|
message: errParts[1],
|
|
13
13
|
debug: errParts[0]
|
|
@@ -21,4 +21,5 @@ var normalizeError = exports.normalizeError = function normalizeError(error) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
return normalizedError;
|
|
24
|
-
};
|
|
24
|
+
};
|
|
25
|
+
exports.normalizeError = normalizeError;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -15,65 +14,38 @@ var _appleIcon = _interopRequireDefault(require("./assets/appleIcon.svg"));
|
|
|
15
14
|
var _utils2 = require("./utils");
|
|
16
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var _ref2 = config || {},
|
|
39
|
-
clientId = _ref2.clientId,
|
|
40
|
-
failureCallback = _ref2.failureCallback,
|
|
41
|
-
redirectUrl = _ref2.redirectUrl,
|
|
42
|
-
scope = _ref2.scope,
|
|
43
|
-
successCallback = _ref2.successCallback;
|
|
44
|
-
(0, _react.useEffect)(function () {
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
+
const Apple = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
classNames = {},
|
|
22
|
+
config,
|
|
23
|
+
email,
|
|
24
|
+
label,
|
|
25
|
+
size = _buttonSizes.SMALL,
|
|
26
|
+
tooltipContent,
|
|
27
|
+
triggerOnMount
|
|
28
|
+
} = _ref;
|
|
29
|
+
const {
|
|
30
|
+
clientId,
|
|
31
|
+
failureCallback,
|
|
32
|
+
redirectUrl,
|
|
33
|
+
scope,
|
|
34
|
+
successCallback
|
|
35
|
+
} = config || {};
|
|
36
|
+
(0, _react.useEffect)(() => {
|
|
45
37
|
if ((0, _utils.isValidId)(clientId)) (0, _utils2.initAppleAuth)(clientId, redirectUrl, scope);
|
|
46
38
|
// eslint-disable-next-line no-console
|
|
47
39
|
else console.error('El id de Apple es inválido');
|
|
48
40
|
}, []);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return window.AppleID.auth.signIn();
|
|
58
|
-
case 3:
|
|
59
|
-
data = _context.sent;
|
|
60
|
-
if (successCallback) successCallback(data);
|
|
61
|
-
_context.next = 10;
|
|
62
|
-
break;
|
|
63
|
-
case 7:
|
|
64
|
-
_context.prev = 7;
|
|
65
|
-
_context.t0 = _context["catch"](0);
|
|
66
|
-
if (failureCallback) failureCallback(_context.t0);
|
|
67
|
-
case 10:
|
|
68
|
-
case "end":
|
|
69
|
-
return _context.stop();
|
|
70
|
-
}
|
|
71
|
-
}, _callee, null, [[0, 7]]);
|
|
72
|
-
}));
|
|
73
|
-
return function handleLogin() {
|
|
74
|
-
return _ref3.apply(this, arguments);
|
|
75
|
-
};
|
|
76
|
-
}();
|
|
41
|
+
const handleLogin = async () => {
|
|
42
|
+
try {
|
|
43
|
+
const data = await window.AppleID.auth.signIn();
|
|
44
|
+
if (successCallback) successCallback(data);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (failureCallback) failureCallback(error);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
77
49
|
return (0, _utils.isValidId)(clientId) ? /*#__PURE__*/_react.default.createElement(_ButtonContainer.default, {
|
|
78
50
|
className: classNames.container,
|
|
79
51
|
size: size,
|
|
@@ -87,8 +59,10 @@ var Apple = function Apple(_ref) {
|
|
|
87
59
|
emailLabelProps: {
|
|
88
60
|
colorTheme: 'light'
|
|
89
61
|
},
|
|
90
|
-
Icon:
|
|
91
|
-
|
|
62
|
+
Icon: _ref2 => {
|
|
63
|
+
let {
|
|
64
|
+
className
|
|
65
|
+
} = _ref2;
|
|
92
66
|
return /*#__PURE__*/_react.default.createElement("img", {
|
|
93
67
|
alt: "Logo de Apple",
|
|
94
68
|
className: className,
|
|
@@ -96,12 +70,14 @@ var Apple = function Apple(_ref) {
|
|
|
96
70
|
});
|
|
97
71
|
},
|
|
98
72
|
label: label,
|
|
99
|
-
mainLabelProps:
|
|
100
|
-
|
|
101
|
-
|
|
73
|
+
mainLabelProps: {
|
|
74
|
+
...(size === _buttonSizes.LARGE ? {
|
|
75
|
+
colorTheme: 'light'
|
|
76
|
+
} : {})
|
|
77
|
+
},
|
|
102
78
|
onClick: handleLogin,
|
|
103
79
|
size: size
|
|
104
|
-
})) :
|
|
80
|
+
})) : null;
|
|
105
81
|
};
|
|
106
82
|
Apple.propTypes = {
|
|
107
83
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
@@ -1,40 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.initAppleAuth = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return window.AppleID.auth.init({
|
|
23
|
-
clientId: clientId,
|
|
24
|
-
scope: scope,
|
|
25
|
-
usePopup: true,
|
|
26
|
-
redirectURI: redirectUrl
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
_context.next = 7;
|
|
30
|
-
return head.appendChild(script);
|
|
31
|
-
case 7:
|
|
32
|
-
case "end":
|
|
33
|
-
return _context.stop();
|
|
34
|
-
}
|
|
35
|
-
}, _callee);
|
|
36
|
-
}));
|
|
37
|
-
return function initAppleAuth(_x, _x2, _x3) {
|
|
38
|
-
return _ref.apply(this, arguments);
|
|
39
|
-
};
|
|
40
|
-
}();
|
|
7
|
+
const initAppleAuth = async (clientId, redirectUrl, scope) => {
|
|
8
|
+
const head = document.getElementsByTagName('head')[0];
|
|
9
|
+
const script = document.createElement('script');
|
|
10
|
+
script.type = 'text/javascript';
|
|
11
|
+
script.src = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';
|
|
12
|
+
script.onload = () => window.AppleID.auth.init({
|
|
13
|
+
clientId,
|
|
14
|
+
scope,
|
|
15
|
+
usePopup: true,
|
|
16
|
+
redirectURI: redirectUrl
|
|
17
|
+
});
|
|
18
|
+
await head.appendChild(script);
|
|
19
|
+
};
|
|
20
|
+
exports.initAppleAuth = initAppleAuth;
|
|
@@ -11,16 +11,17 @@ var _buttonSizes = require("../../constants/buttonSizes");
|
|
|
11
11
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
classNames =
|
|
17
|
-
email
|
|
18
|
-
emailLabelProps
|
|
19
|
-
|
|
20
|
-
label
|
|
21
|
-
mainLabelProps
|
|
22
|
-
onClick
|
|
23
|
-
size
|
|
14
|
+
const Button = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
classNames = {},
|
|
17
|
+
email,
|
|
18
|
+
emailLabelProps,
|
|
19
|
+
Icon,
|
|
20
|
+
label,
|
|
21
|
+
mainLabelProps,
|
|
22
|
+
onClick,
|
|
23
|
+
size
|
|
24
|
+
} = _ref;
|
|
24
25
|
return size === _buttonSizes.LARGE ? /*#__PURE__*/_react.default.createElement(_energyUi.UTButton, {
|
|
25
26
|
onClick: onClick,
|
|
26
27
|
classNames: {
|
|
@@ -28,7 +29,7 @@ var Button = function Button(_ref) {
|
|
|
28
29
|
childrenContainer: _stylesModule.default.fullWidth,
|
|
29
30
|
text: "".concat(_stylesModule.default.largeText, " ").concat(email && _stylesModule.default.labelsContainer)
|
|
30
31
|
},
|
|
31
|
-
Icon:
|
|
32
|
+
Icon: Icon
|
|
32
33
|
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, mainLabelProps, label), email && /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, _extends({
|
|
33
34
|
variant: "small"
|
|
34
35
|
}, emailLabelProps), email)) : /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -38,9 +39,11 @@ var Button = function Button(_ref) {
|
|
|
38
39
|
root: "".concat(_stylesModule.default.smallContainer, " ").concat(classNames.container)
|
|
39
40
|
},
|
|
40
41
|
onClick: onClick,
|
|
41
|
-
Icon:
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
Icon: _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
className
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(Icon, {
|
|
44
47
|
className: className
|
|
45
48
|
});
|
|
46
49
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,31 +7,22 @@ exports.default = void 0;
|
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _propTypes = require("prop-types");
|
|
10
9
|
var _energyUi = require("@widergy/energy-ui");
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
triggerOnMount = _ref.triggerOnMount;
|
|
24
|
-
var ref = (0, _react.useRef)();
|
|
25
|
-
var _useState = (0, _react.useState)(false),
|
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
-
triggered = _useState2[0],
|
|
28
|
-
setTriggered = _useState2[1];
|
|
29
|
-
(0, _react.useEffect)(function () {
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
const ButtonContainer = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
tooltipContent,
|
|
17
|
+
triggerOnMount
|
|
18
|
+
} = _ref;
|
|
19
|
+
const ref = (0, _react.useRef)();
|
|
20
|
+
const [triggered, setTriggered] = (0, _react.useState)(false);
|
|
21
|
+
(0, _react.useEffect)(() => {
|
|
30
22
|
if (triggerOnMount && !triggered && ref.current) {
|
|
31
|
-
|
|
23
|
+
const buttonElement = ref.current.getElementsByTagName('button');
|
|
32
24
|
if (buttonElement && buttonElement.length) {
|
|
33
|
-
setTimeout(
|
|
34
|
-
return buttonElement[0].click();
|
|
35
|
-
}, 400);
|
|
25
|
+
setTimeout(() => buttonElement[0].click(), 400);
|
|
36
26
|
}
|
|
37
27
|
setTriggered(true);
|
|
38
28
|
}
|