@stokr/components-library 2.3.65-beta.20 → 2.3.65-beta.21
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.
|
@@ -86,7 +86,7 @@ const LoginWithOTP = _ref => {
|
|
|
86
86
|
message: undefined
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
const backgroundProp = "url(".concat(_background.default, ") left
|
|
89
|
+
const backgroundProp = "url(".concat(_background.default, ") left top no-repeat");
|
|
90
90
|
return /*#__PURE__*/_react.default.createElement(_Layout.Layout, {
|
|
91
91
|
noHeader: true,
|
|
92
92
|
noFooter: true
|
|
@@ -17,7 +17,7 @@ var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
|
17
17
|
var _InfoIcon = _interopRequireDefault(require("../InfoIcon/InfoIcon"));
|
|
18
18
|
var _Modal = require("../Modal/Modal");
|
|
19
19
|
var _Sucess2FA = _interopRequireDefault(require("./Sucess2FA"));
|
|
20
|
-
const _excluded = ["onRequiresRecentLoginError", "open2faflow", "onLoginAgainClick", "openDisable2faflow", "title", "subtitle", "showSwitch", "customComponent"];
|
|
20
|
+
const _excluded = ["onRequiresRecentLoginError", "open2faflow", "onLoginAgainClick", "openDisable2faflow", "title", "subtitle", "showSwitch", "customComponent", "onFlowClose"];
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
23
23
|
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; }
|
|
@@ -36,7 +36,8 @@ const Main2FAFlow = _ref => {
|
|
|
36
36
|
title = 'SET UP YOUR LOG IN TWO FACTOR AUTHENTICATION',
|
|
37
37
|
subtitle = 'Protect your account with an additional layer of security to log in',
|
|
38
38
|
showSwitch = true,
|
|
39
|
-
customComponent
|
|
39
|
+
customComponent,
|
|
40
|
+
onFlowClose
|
|
40
41
|
} = _ref,
|
|
41
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
43
|
const {
|
|
@@ -88,6 +89,14 @@ const Main2FAFlow = _ref => {
|
|
|
88
89
|
[nextFlowId]: true
|
|
89
90
|
}));
|
|
90
91
|
};
|
|
92
|
+
|
|
93
|
+
// Helper to close a flow and call the custom onFlowClose handler
|
|
94
|
+
const handleFlowClose = flowId => {
|
|
95
|
+
setIsFlowOpen(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
96
|
+
[flowId]: false
|
|
97
|
+
}));
|
|
98
|
+
onFlowClose && onFlowClose(flowId);
|
|
99
|
+
};
|
|
91
100
|
const onEnable2FASuccess = async () => {
|
|
92
101
|
setis2FAEnabled(true);
|
|
93
102
|
checkMfaEnrollment();
|
|
@@ -112,11 +121,15 @@ const Main2FAFlow = _ref => {
|
|
|
112
121
|
openEnable2FA: () => switchOpenFlow('disable2fa', 'enable2fa'),
|
|
113
122
|
openDisable2FA: () => switchOpenFlow('enable2fa', 'disable2fa'),
|
|
114
123
|
closeFlows: () => {
|
|
124
|
+
const wasOpen = Object.keys(isFlowopen).find(key => isFlowopen[key]);
|
|
115
125
|
setIsFlowOpen({
|
|
116
126
|
enable2fa: false,
|
|
117
127
|
disable2fa: false,
|
|
118
128
|
requiresRecentLogin: false
|
|
119
129
|
});
|
|
130
|
+
if (wasOpen) {
|
|
131
|
+
onFlowClose && onFlowClose(wasOpen);
|
|
132
|
+
}
|
|
120
133
|
},
|
|
121
134
|
is2FAEnabled,
|
|
122
135
|
isFlowOpen: isFlowopen
|
|
@@ -169,24 +182,34 @@ const Main2FAFlow = _ref => {
|
|
|
169
182
|
flowActions
|
|
170
183
|
}) : customComponent), isFlowopen.enable2fa && /*#__PURE__*/_react.default.createElement(_enable2faFlow.default, {
|
|
171
184
|
showFlow: isFlowopen.enable2fa,
|
|
172
|
-
setShowFlow: value =>
|
|
173
|
-
|
|
174
|
-
|
|
185
|
+
setShowFlow: value => {
|
|
186
|
+
if (!value) {
|
|
187
|
+
handleFlowClose('enable2fa');
|
|
188
|
+
} else {
|
|
189
|
+
setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
|
|
190
|
+
enable2fa: value
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
},
|
|
175
194
|
totpData: totpData,
|
|
176
195
|
onRequiresRecentLoginError: onRequiresRecentLoginErrorHandler,
|
|
177
196
|
onSuccess: onEnable2FASuccess
|
|
178
197
|
}), isFlowopen.disable2fa && /*#__PURE__*/_react.default.createElement(_disable2faFlow.default, {
|
|
179
198
|
showFlow: isFlowopen.disable2fa,
|
|
180
|
-
setShowFlow: value =>
|
|
181
|
-
|
|
182
|
-
|
|
199
|
+
setShowFlow: value => {
|
|
200
|
+
if (!value) {
|
|
201
|
+
handleFlowClose('disable2fa');
|
|
202
|
+
} else {
|
|
203
|
+
setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
|
|
204
|
+
disable2fa: value
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
},
|
|
183
208
|
onRequiresRecentLoginError: onRequiresRecentLoginErrorHandler,
|
|
184
209
|
onSuccess: onDisable2FASuccess
|
|
185
210
|
}), isFlowopen.requiresRecentLogin && /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
186
211
|
isOpen: isFlowopen.requiresRecentLogin,
|
|
187
|
-
onClose: () =>
|
|
188
|
-
requiresRecentLogin: false
|
|
189
|
-
}))
|
|
212
|
+
onClose: () => handleFlowClose('requiresRecentLogin')
|
|
190
213
|
}, /*#__PURE__*/_react.default.createElement(_Modal.ModalInner, {
|
|
191
214
|
noPadding: true
|
|
192
215
|
}, /*#__PURE__*/_react.default.createElement(_Sucess2FA.default, {
|
|
@@ -200,6 +223,8 @@ const Main2FAFlow = _ref => {
|
|
|
200
223
|
};
|
|
201
224
|
exports.Main2FAFlow = Main2FAFlow;
|
|
202
225
|
Main2FAFlow.propTypes = {
|
|
203
|
-
onRequiresRecentLoginError: _propTypes.default.func
|
|
226
|
+
onRequiresRecentLoginError: _propTypes.default.func,
|
|
227
|
+
/** Called when any flow/modal is closed. Receives the flowId: 'enable2fa' | 'disable2fa' | 'requiresRecentLogin' */
|
|
228
|
+
onFlowClose: _propTypes.default.func
|
|
204
229
|
};
|
|
205
230
|
var _default = exports.default = Main2FAFlow;
|
|
Binary file
|