@stytch/vanilla-js 5.6.2 → 5.8.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 +25 -0
- package/README.md +1 -1
- package/dist/adminPortal/index.esm.js +2 -2
- package/dist/adminPortal/index.js +2 -2
- package/dist/adminPortal/settings/AdminPortalOrgSettings.d.ts +1 -0
- package/dist/b2b/index.esm.js +1866 -1307
- package/dist/b2b/index.headless.esm.js +3 -3
- package/dist/b2b/index.headless.js +2 -2
- package/dist/b2b/index.js +1869 -1310
- package/dist/{extractErrorMessage-DqI8LnhU.js → extractErrorMessage-C0TeBTBa.js} +4 -4
- package/dist/{extractErrorMessage-Ddemk2Gq.js → extractErrorMessage-CYXucHbA.js} +5 -5
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +43 -39
- package/dist/index.headless.js +43 -39
- package/dist/index.js +1 -1
- package/dist/{internal-8PFEtDRF.js → internal-BeiYVaO7.js} +597 -435
- package/dist/{internal-B_3PRrIX.js → internal-HC6WhS3G.js} +598 -436
- package/dist/ui/b2b/GlobalContextProvider.d.ts +11 -4
- package/dist/ui/b2b/generateProductComponentsOrdering.d.ts +4 -3
- package/dist/ui/b2b/getOtpCodeExpiration.d.ts +1 -0
- package/dist/ui/b2b/hooks/useEmailOtpDiscoverySend.d.ts +5 -0
- package/dist/ui/b2b/hooks/useEmailOtpLoginOrSignup.d.ts +6 -0
- package/dist/ui/b2b/hooks/useEmlDiscoverySend.d.ts +5 -0
- package/dist/ui/b2b/hooks/useEmlLoginOrSignup.d.ts +6 -0
- package/dist/ui/b2b/reducer.d.ts +7 -1
- package/dist/ui/b2b/screens/EmailForm.d.ts +3 -0
- package/dist/ui/b2b/screens/EmailMethodSelectionScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/EmailOTPEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/utils.d.ts +3 -1
- package/dist/ui/components/LoadingButton.d.ts +8 -0
- package/dist/ui/components/MenuButton.d.ts +6 -0
- package/dist/ui/components/SubmitButton.d.ts +1 -1
- package/dist/utils/StyledComponentProps.d.ts +2 -0
- package/package.json +2 -2
- package/dist/ui/b2b/screens/MagicLinkForm.d.ts +0 -3
package/dist/b2b/index.js
CHANGED
|
@@ -19,21 +19,21 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
19
19
|
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."); }
|
|
20
20
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
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); }
|
|
25
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
26
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
27
|
-
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; }
|
|
28
22
|
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; }
|
|
29
23
|
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) { _defineProperty(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; }
|
|
30
24
|
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; }
|
|
31
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
32
26
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
33
27
|
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); }
|
|
28
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
29
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
30
|
+
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); }
|
|
31
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
32
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
33
|
+
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; }
|
|
34
34
|
var b2b_index_headless = require('./index.headless.js');
|
|
35
|
-
var extractErrorMessage = require('../extractErrorMessage-
|
|
36
|
-
var internal = require('../internal-
|
|
35
|
+
var extractErrorMessage = require('../extractErrorMessage-C0TeBTBa.js');
|
|
36
|
+
var internal = require('../internal-BeiYVaO7.js');
|
|
37
37
|
var DEFAULT_MFA_STATE = {
|
|
38
38
|
primaryInfo: null,
|
|
39
39
|
isEnrolling: false,
|
|
@@ -343,20 +343,36 @@ var reducer = function reducer(state, action) {
|
|
|
343
343
|
var _a, _b, _c;
|
|
344
344
|
switch (action.type) {
|
|
345
345
|
case 'transition':
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
{
|
|
347
|
+
var screenHistory = action.history === 'push' ? [].concat(_toConsumableArray(state.screenHistory), [state.screen]) : [];
|
|
348
|
+
return Object.assign(Object.assign({}, state), {
|
|
349
|
+
screen: action.screen,
|
|
350
|
+
screenHistory: screenHistory
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
case 'navigate_back':
|
|
354
|
+
{
|
|
355
|
+
var screen = state.screenHistory.at(-1);
|
|
356
|
+
if (!screen) {
|
|
357
|
+
return state;
|
|
358
|
+
}
|
|
359
|
+
var _screenHistory = state.screenHistory.slice(0, -1);
|
|
360
|
+
return Object.assign(Object.assign({}, state), {
|
|
361
|
+
screen: screen,
|
|
362
|
+
screenHistory: _screenHistory
|
|
363
|
+
});
|
|
364
|
+
}
|
|
349
365
|
case 'set_error_message_and_transition':
|
|
350
366
|
return Object.assign(Object.assign({}, state), {
|
|
351
367
|
screen: AppScreens$1.Error,
|
|
352
368
|
errorType: action.errorType
|
|
353
369
|
});
|
|
354
|
-
case '
|
|
370
|
+
case 'set_user_supplied_email':
|
|
355
371
|
{
|
|
356
372
|
return Object.assign(Object.assign({}, state), {
|
|
357
373
|
formState: Object.assign(Object.assign({}, state.formState), {
|
|
358
|
-
|
|
359
|
-
|
|
374
|
+
emailState: {
|
|
375
|
+
userSuppliedEmail: action.email
|
|
360
376
|
}
|
|
361
377
|
})
|
|
362
378
|
});
|
|
@@ -427,6 +443,18 @@ var reducer = function reducer(state, action) {
|
|
|
427
443
|
})
|
|
428
444
|
});
|
|
429
445
|
}
|
|
446
|
+
case 'send_email_otp':
|
|
447
|
+
{
|
|
448
|
+
return Object.assign(Object.assign({}, state), {
|
|
449
|
+
formState: Object.assign(Object.assign({}, state.formState), {
|
|
450
|
+
otpState: {
|
|
451
|
+
codeExpiration: action.codeExpiration
|
|
452
|
+
}
|
|
453
|
+
}),
|
|
454
|
+
screen: AppScreens$1.EmailOTPEntry,
|
|
455
|
+
screenHistory: [].concat(_toConsumableArray(state.screenHistory), [state.screen])
|
|
456
|
+
});
|
|
457
|
+
}
|
|
430
458
|
default:
|
|
431
459
|
return mfaReducer(state, action);
|
|
432
460
|
}
|
|
@@ -452,6 +480,8 @@ var AppScreens$1;
|
|
|
452
480
|
AppScreens["TOTPEnrollmentManual"] = "TOTP Enrollment Manual";
|
|
453
481
|
AppScreens["TOTPEnrollmentQRCode"] = "TOTP Enrollment QR Code";
|
|
454
482
|
AppScreens["TOTPEntry"] = "TOTP Entry";
|
|
483
|
+
AppScreens["EmailMethodSelection"] = "Email Method Selection";
|
|
484
|
+
AppScreens["EmailOTPEntry"] = "Email OTP Entry";
|
|
455
485
|
})(AppScreens$1 || (AppScreens$1 = {}));
|
|
456
486
|
var ErrorType;
|
|
457
487
|
(function (ErrorType) {
|
|
@@ -463,9 +493,13 @@ var ErrorType;
|
|
|
463
493
|
})(ErrorType || (ErrorType = {}));
|
|
464
494
|
var DEFAULT_STATE = {
|
|
465
495
|
screen: AppScreens$1.Main,
|
|
496
|
+
screenHistory: [],
|
|
466
497
|
formState: {
|
|
467
|
-
|
|
468
|
-
|
|
498
|
+
emailState: {
|
|
499
|
+
userSuppliedEmail: ''
|
|
500
|
+
},
|
|
501
|
+
otpState: {
|
|
502
|
+
codeExpiration: null
|
|
469
503
|
},
|
|
470
504
|
discoveryState: {
|
|
471
505
|
email: '',
|
|
@@ -1511,186 +1545,495 @@ var ErrorScreen = function ErrorScreen() {
|
|
|
1511
1545
|
size: "header"
|
|
1512
1546
|
}, "Looks like there was an error!"), /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorSVG, null), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, ErrorTypeMap[currentErrorType]));
|
|
1513
1547
|
};
|
|
1514
|
-
var
|
|
1515
|
-
return
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
throw new Error('Can’t trigger the mutation: missing key.');
|
|
1551
|
-
case 5:
|
|
1552
|
-
options = extractErrorMessage.mergeObjects(extractErrorMessage.mergeObjects({
|
|
1553
|
-
populateCache: false,
|
|
1554
|
-
throwOnError: true
|
|
1555
|
-
}, configRef.current), opts);
|
|
1556
|
-
mutationStartedAt = extractErrorMessage.getTimestamp();
|
|
1557
|
-
ditchMutationsUntilRef.current = mutationStartedAt;
|
|
1558
|
-
setState({
|
|
1559
|
-
isMutating: true
|
|
1560
|
-
});
|
|
1561
|
-
_context.prev = 9;
|
|
1562
|
-
_context.next = 12;
|
|
1563
|
-
return mutate(serializedKey, fetcherRef.current(resolvedKey, {
|
|
1564
|
-
arg: arg
|
|
1565
|
-
}), extractErrorMessage.mergeObjects(options, {
|
|
1566
|
-
throwOnError: true
|
|
1567
|
-
}));
|
|
1568
|
-
case 12:
|
|
1569
|
-
data = _context.sent;
|
|
1570
|
-
if (ditchMutationsUntilRef.current <= mutationStartedAt) {
|
|
1571
|
-
setState({
|
|
1572
|
-
data: data,
|
|
1573
|
-
isMutating: false,
|
|
1574
|
-
error: undefined
|
|
1575
|
-
});
|
|
1576
|
-
options.onSuccess == null ? void 0 : options.onSuccess(data, serializedKey, options);
|
|
1577
|
-
}
|
|
1578
|
-
return _context.abrupt("return", data);
|
|
1579
|
-
case 17:
|
|
1580
|
-
_context.prev = 17;
|
|
1581
|
-
_context.t0 = _context["catch"](9);
|
|
1582
|
-
if (!(ditchMutationsUntilRef.current <= mutationStartedAt)) {
|
|
1583
|
-
_context.next = 24;
|
|
1584
|
-
break;
|
|
1585
|
-
}
|
|
1586
|
-
setState({
|
|
1587
|
-
error: _context.t0,
|
|
1588
|
-
isMutating: false
|
|
1589
|
-
});
|
|
1590
|
-
options.onError == null ? void 0 : options.onError(_context.t0, serializedKey, options);
|
|
1591
|
-
if (!options.throwOnError) {
|
|
1592
|
-
_context.next = 24;
|
|
1593
|
-
break;
|
|
1594
|
-
}
|
|
1595
|
-
throw _context.t0;
|
|
1596
|
-
case 24:
|
|
1597
|
-
case "end":
|
|
1598
|
-
return _context.stop();
|
|
1599
|
-
}
|
|
1600
|
-
}, _callee, null, [[9, 17]]);
|
|
1601
|
-
}));
|
|
1602
|
-
return function (_x, _x2) {
|
|
1603
|
-
return _ref39.apply(this, arguments);
|
|
1604
|
-
};
|
|
1605
|
-
}(), []);
|
|
1606
|
-
var reset = extractErrorMessage.T(function () {
|
|
1607
|
-
ditchMutationsUntilRef.current = extractErrorMessage.getTimestamp();
|
|
1608
|
-
setState({
|
|
1609
|
-
data: extractErrorMessage.UNDEFINED,
|
|
1610
|
-
error: extractErrorMessage.UNDEFINED,
|
|
1611
|
-
isMutating: false
|
|
1612
|
-
});
|
|
1613
|
-
}, []);
|
|
1614
|
-
extractErrorMessage.useIsomorphicLayoutEffect(function () {
|
|
1615
|
-
keyRef.current = key;
|
|
1616
|
-
fetcherRef.current = fetcher;
|
|
1617
|
-
configRef.current = config;
|
|
1618
|
-
});
|
|
1619
|
-
return {
|
|
1620
|
-
trigger: trigger,
|
|
1621
|
-
reset: reset,
|
|
1622
|
-
get data() {
|
|
1623
|
-
stateDependencies.data = true;
|
|
1624
|
-
return currentState.data;
|
|
1625
|
-
},
|
|
1626
|
-
get error() {
|
|
1627
|
-
stateDependencies.error = true;
|
|
1628
|
-
return currentState.error;
|
|
1629
|
-
},
|
|
1630
|
-
get isMutating() {
|
|
1631
|
-
stateDependencies.isMutating = true;
|
|
1632
|
-
return currentState.isMutating;
|
|
1633
|
-
}
|
|
1634
|
-
};
|
|
1635
|
-
};
|
|
1636
|
-
};
|
|
1637
|
-
var index = extractErrorMessage.withMiddleware(extractErrorMessage.useSWR, mutation);
|
|
1638
|
-
var KeyToStytchEventMap = {
|
|
1639
|
-
'stytch.magicLinks.authenticate': internal.StytchEventType.B2BMagicLinkAuthenticate,
|
|
1640
|
-
'stytch.sso.authenticate': internal.StytchEventType.B2BSSOAuthenticate,
|
|
1641
|
-
'stytch.magicLinks.discovery.authenticate': internal.StytchEventType.B2BMagicLinkDiscoveryAuthenticate,
|
|
1642
|
-
'stytch.discovery.organization.create': internal.StytchEventType.B2BDiscoveryOrganizationsCreate,
|
|
1643
|
-
'stytch.discovery.intermediateSessions.exchange': internal.StytchEventType.B2BDiscoveryIntermediateSessionExchange,
|
|
1644
|
-
'stytch.magicLinks.email.loginOrSignup': internal.StytchEventType.B2BMagicLinkEmailLoginOrSignup,
|
|
1645
|
-
'stytch.magicLinks.discovery.send': internal.StytchEventType.B2BMagicLinkEmailDiscoverySend,
|
|
1646
|
-
'stytch.oauth.authenticate': internal.StytchEventType.B2BOAuthAuthenticate,
|
|
1647
|
-
'stytch.oauth.discovery.authenticate': internal.StytchEventType.B2BOAuthDiscoveryAuthenticate,
|
|
1648
|
-
'stytch.otps.sms.send': internal.StytchEventType.B2BSMSOTPSend,
|
|
1649
|
-
'stytch.otps.sms.authenticate': internal.StytchEventType.B2BSMSOTPAuthenticate,
|
|
1650
|
-
'stytch.totp.create': internal.StytchEventType.B2BTOTPCreate,
|
|
1651
|
-
'stytch.totp.authenticate': internal.StytchEventType.B2BTOTPAuthenticate,
|
|
1652
|
-
'stytch.recoveryCodes.recover': internal.StytchEventType.B2BRecoveryCodesRecover
|
|
1653
|
-
};
|
|
1654
|
-
var useMutate = function useMutate(key, fetcher, options) {
|
|
1655
|
-
var onEvent = useEventCallback();
|
|
1656
|
-
var _onError = useErrorCallback();
|
|
1657
|
-
return index(key, fetcher, Object.assign(Object.assign({
|
|
1658
|
-
throwOnError: false
|
|
1659
|
-
}, options), {
|
|
1660
|
-
onSuccess: function onSuccess(data, key, config) {
|
|
1661
|
-
if (KeyToStytchEventMap[key]) {
|
|
1662
|
-
onEvent({
|
|
1663
|
-
type: KeyToStytchEventMap[key],
|
|
1664
|
-
data: data
|
|
1665
|
-
});
|
|
1666
|
-
}
|
|
1667
|
-
(options === null || options === void 0 ? void 0 : options.onSuccess) && options.onSuccess(data, key, config);
|
|
1548
|
+
var Input = extractErrorMessage.He.input(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n background-color: ", ";\n height: 47px;\n padding: 0 8px;\n box-sizing: border-box;\n border: 1px solid ", ";\n border-radius: ", ";\n color: ", ";\n font-family: ", ";\n font-size: 18px;\n &::placeholder {\n color: ", ";\n }\n\n &:disabled {\n border: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n }\n"])), function (props) {
|
|
1549
|
+
return props.theme.inputs.backgroundColor;
|
|
1550
|
+
}, function (props) {
|
|
1551
|
+
return props.theme.inputs.borderColor;
|
|
1552
|
+
}, function (props) {
|
|
1553
|
+
return props.theme.inputs.borderRadius;
|
|
1554
|
+
}, function (props) {
|
|
1555
|
+
return props.theme.inputs.textColor;
|
|
1556
|
+
}, function (props) {
|
|
1557
|
+
return props.theme.typography.fontFamily;
|
|
1558
|
+
}, function (props) {
|
|
1559
|
+
return props.theme.inputs.placeholderColor;
|
|
1560
|
+
}, function (props) {
|
|
1561
|
+
return props.theme.colors.disabledText;
|
|
1562
|
+
}, function (props) {
|
|
1563
|
+
return props.theme.colors.disabledText;
|
|
1564
|
+
}, function (props) {
|
|
1565
|
+
return props.theme.colors.disabled;
|
|
1566
|
+
});
|
|
1567
|
+
var EmailInput = function EmailInput(_ref39) {
|
|
1568
|
+
var email = _ref39.email,
|
|
1569
|
+
setEmail = _ref39.setEmail,
|
|
1570
|
+
_ref39$disableInput = _ref39.disableInput,
|
|
1571
|
+
disableInput = _ref39$disableInput === void 0 ? false : _ref39$disableInput,
|
|
1572
|
+
_ref39$hasPasskeys = _ref39.hasPasskeys,
|
|
1573
|
+
hasPasskeys = _ref39$hasPasskeys === void 0 ? false : _ref39$hasPasskeys;
|
|
1574
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Input, Object.assign({
|
|
1575
|
+
placeholder: "example@email.com",
|
|
1576
|
+
name: "email",
|
|
1577
|
+
type: "email",
|
|
1578
|
+
autoComplete: hasPasskeys ? 'email webauthn' : 'email',
|
|
1579
|
+
disabled: disableInput,
|
|
1580
|
+
id: "email-input",
|
|
1581
|
+
value: email,
|
|
1582
|
+
onChange: function onChange(e) {
|
|
1583
|
+
return setEmail(e.target.value);
|
|
1668
1584
|
},
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1585
|
+
required: true
|
|
1586
|
+
}, hasPasskeys ? extractErrorMessage.passwordManagerDisableAutofillProps : {}));
|
|
1587
|
+
};
|
|
1588
|
+
var DASHBOARD_REGEX = /https:\/\/stytch\.com\/[#a-zA-Z0-9/-]+/g;
|
|
1589
|
+
var mapURLsToLinks = function mapURLsToLinks(str) {
|
|
1590
|
+
var nonLinkChunks = str.split(DASHBOARD_REGEX);
|
|
1591
|
+
var linkChunks = Array.from(str.matchAll(DASHBOARD_REGEX)).map(function (el) {
|
|
1592
|
+
return el[0];
|
|
1593
|
+
});
|
|
1594
|
+
var chunkResults = [];
|
|
1595
|
+
while (nonLinkChunks.length || linkChunks.length) {
|
|
1596
|
+
if (nonLinkChunks.length) {
|
|
1597
|
+
chunkResults.push(nonLinkChunks.shift());
|
|
1672
1598
|
}
|
|
1673
|
-
|
|
1599
|
+
if (linkChunks.length) {
|
|
1600
|
+
var chunk = linkChunks.shift();
|
|
1601
|
+
chunkResults.push( /*#__PURE__*/extractErrorMessage.wn.createElement("a", {
|
|
1602
|
+
key: chunk + '__' + String(linkChunks.length),
|
|
1603
|
+
href: chunk,
|
|
1604
|
+
target: "_blank",
|
|
1605
|
+
rel: "noreferrer"
|
|
1606
|
+
}, chunk));
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
return chunkResults;
|
|
1674
1610
|
};
|
|
1675
|
-
var
|
|
1676
|
-
var
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1611
|
+
var ErrorText = function ErrorText(_ref40) {
|
|
1612
|
+
var errorMessage = _ref40.errorMessage;
|
|
1613
|
+
var tokens = extractErrorMessage.F(function () {
|
|
1614
|
+
return mapURLsToLinks(errorMessage);
|
|
1615
|
+
}, [errorMessage]);
|
|
1616
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
1617
|
+
size: "helper",
|
|
1618
|
+
color: "error"
|
|
1619
|
+
}, tokens);
|
|
1620
|
+
};
|
|
1621
|
+
var Button = extractErrorMessage.He.button(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n all: unset;\n width: 100%;\n height: 45px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 18px;\n text-transform: none;\n font-family: ", ";\n box-shadow: none;\n text-align: center;\n\n ", "\n\n &:disabled {\n background-color: ", ";\n color: ", ";\n border: ", ";\n border-radius: ", ";\n cursor: not-allowed;\n }\n"])), function (props) {
|
|
1622
|
+
return props.theme.typography.fontFamily;
|
|
1623
|
+
}, function (props) {
|
|
1624
|
+
switch (props.variant) {
|
|
1625
|
+
case 'primary':
|
|
1626
|
+
return "\n border: ".concat(props.theme.buttons.primary.border, ";\n border-radius: ").concat(props.theme.buttons.primary.borderRadius, ";\n color: ").concat(props.theme.buttons.primary.textColor, ";\n background-color: ").concat(props.theme.buttons.primary.backgroundColor, ";\n ");
|
|
1627
|
+
case 'outlined':
|
|
1628
|
+
return "\n border: ".concat(props.theme.buttons.secondary.border, ";\n border-radius: ").concat(props.theme.buttons.secondary.borderRadius, ";\n color: ").concat(props.theme.buttons.secondary.textColor, ";\n background-color: ").concat(props.theme.buttons.secondary.backgroundColor, ";\n ");
|
|
1629
|
+
case 'text':
|
|
1630
|
+
return "\n color: ".concat(props.theme.colors.primary, ";\n background-color: transparent;\n font-weight: 600;\n ");
|
|
1631
|
+
}
|
|
1632
|
+
}, function (props) {
|
|
1633
|
+
return props.theme.buttons.disabled.backgroundColor;
|
|
1634
|
+
}, function (props) {
|
|
1635
|
+
return props.theme.buttons.disabled.textColor;
|
|
1636
|
+
}, function (props) {
|
|
1637
|
+
return props.theme.buttons.disabled.border;
|
|
1638
|
+
}, function (props) {
|
|
1639
|
+
return props.theme.buttons.disabled.borderRadius;
|
|
1640
|
+
});
|
|
1641
|
+
Button.defaultProps = {
|
|
1642
|
+
variant: 'primary'
|
|
1643
|
+
};
|
|
1644
|
+
var circularRotateKeyframe = extractErrorMessage.Ue(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
|
|
1645
|
+
var circularDashKeyframe = extractErrorMessage.Ue(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"])));
|
|
1646
|
+
var AnimatedCircle = extractErrorMessage.He.circle(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n stroke-dasharray: 80px, 200px;\n stroke-dashoffset: 0;\n animation: ", " 1.4s ease-in-out infinite;\n stroke: ", ";\n fill: none;\n"])), circularDashKeyframe, function (props) {
|
|
1647
|
+
return props.theme.colors.primary;
|
|
1648
|
+
});
|
|
1649
|
+
var CircularProgressRoot = extractErrorMessage.He.div(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n animation: ", " 1.4s ease-in-out infinite;\n"])), function (props) {
|
|
1650
|
+
return props.size;
|
|
1651
|
+
}, function (props) {
|
|
1652
|
+
return props.size;
|
|
1653
|
+
}, circularRotateKeyframe);
|
|
1654
|
+
var CircularProgressSVG = extractErrorMessage.He.svg(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n display: block;\n"])));
|
|
1655
|
+
var CircularProgress = function CircularProgress(_ref41) {
|
|
1656
|
+
var size = _ref41.size,
|
|
1657
|
+
thickness = _ref41.thickness;
|
|
1658
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(CircularProgressRoot, {
|
|
1659
|
+
size: size
|
|
1660
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(CircularProgressSVG, {
|
|
1661
|
+
viewBox: "".concat(size / 2, " ").concat(size / 2, " ").concat(size, " ").concat(size)
|
|
1662
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(AnimatedCircle, {
|
|
1663
|
+
cx: size,
|
|
1664
|
+
cy: size,
|
|
1665
|
+
r: (size - thickness) / 2,
|
|
1666
|
+
fill: "none",
|
|
1667
|
+
strokeWidth: thickness
|
|
1668
|
+
})));
|
|
1669
|
+
};
|
|
1670
|
+
var LoadingButton = function LoadingButton(_a) {
|
|
1671
|
+
var children = _a.children,
|
|
1672
|
+
isLoading = _a.isLoading,
|
|
1673
|
+
buttonProps = internal.__rest(_a, ["children", "isLoading"]);
|
|
1674
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Button, Object.assign({}, buttonProps), isLoading ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
1675
|
+
justifyContent: "center"
|
|
1676
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(CircularProgress, {
|
|
1677
|
+
size: 18,
|
|
1678
|
+
thickness: 1,
|
|
1679
|
+
"data-testid": "loading-icon"
|
|
1680
|
+
}))) : children);
|
|
1681
|
+
};
|
|
1682
|
+
var SubmitButton = function SubmitButton(_ref42) {
|
|
1683
|
+
var isSubmitting = _ref42.isSubmitting,
|
|
1684
|
+
disabled = _ref42.disabled,
|
|
1685
|
+
text = _ref42.text,
|
|
1686
|
+
variant = _ref42.variant;
|
|
1687
|
+
var buttonDisabled = isSubmitting || disabled;
|
|
1688
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingButton, {
|
|
1689
|
+
isLoading: isSubmitting,
|
|
1690
|
+
type: "submit",
|
|
1691
|
+
disabled: buttonDisabled,
|
|
1692
|
+
variant: variant
|
|
1693
|
+
}, text);
|
|
1694
|
+
};
|
|
1695
|
+
var getParamsFromB2BOAuthProviderConfig = function getParamsFromB2BOAuthProviderConfig(provider) {
|
|
1696
|
+
var providerType = '';
|
|
1697
|
+
var oneTap = false;
|
|
1698
|
+
var customScopes = [];
|
|
1699
|
+
var providerParams = {};
|
|
1700
|
+
if (typeof provider === 'string') {
|
|
1701
|
+
providerType = provider;
|
|
1702
|
+
} else {
|
|
1703
|
+
providerType = provider.type;
|
|
1704
|
+
if (provider.type === internal.B2BOAuthProviders.Google && 'one_tap' in provider) {
|
|
1705
|
+
oneTap = provider.one_tap;
|
|
1706
|
+
}
|
|
1707
|
+
customScopes = provider.customScopes || [];
|
|
1708
|
+
providerParams = provider.providerParams || {};
|
|
1709
|
+
}
|
|
1710
|
+
var oauthProvider = providerType;
|
|
1711
|
+
return {
|
|
1712
|
+
type: oauthProvider,
|
|
1713
|
+
one_tap: oneTap,
|
|
1714
|
+
customScopes: customScopes,
|
|
1715
|
+
providerParams: providerParams
|
|
1716
|
+
};
|
|
1717
|
+
};
|
|
1718
|
+
var productsToAuthMethods = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, internal.B2BProducts.oauth, undefined), internal.B2BProducts.sso, 'sso'), internal.B2BProducts.emailMagicLinks, 'magic_link'), internal.B2BProducts.emailOtp, 'email_otp'), internal.B2BProducts.passwords, 'password');
|
|
1719
|
+
var oauthProvidersToAuthMethods = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, internal.B2BOAuthProviders.Google, 'google_oauth'), internal.B2BOAuthProviders.Microsoft, 'microsoft_oauth'), internal.B2BOAuthProviders.HubSpot, 'hubspot_oauth'), internal.B2BOAuthProviders.Slack, 'slack_oauth'), internal.B2BOAuthProviders.GitHub, 'github_oauth');
|
|
1720
|
+
var authMethodsToProducts = Object.entries(productsToAuthMethods).reduce(function (acc, _ref43) {
|
|
1721
|
+
var _ref44 = _slicedToArray(_ref43, 2),
|
|
1722
|
+
product = _ref44[0],
|
|
1723
|
+
method = _ref44[1];
|
|
1724
|
+
if (method) {
|
|
1725
|
+
acc[method] = product;
|
|
1726
|
+
}
|
|
1727
|
+
return acc;
|
|
1728
|
+
}, {});
|
|
1729
|
+
var oauthMethodsToOauthProviders = Object.entries(oauthProvidersToAuthMethods).reduce(function (acc, _ref45) {
|
|
1730
|
+
var _ref46 = _slicedToArray(_ref45, 2),
|
|
1731
|
+
provider = _ref46[0],
|
|
1732
|
+
method = _ref46[1];
|
|
1733
|
+
acc[method] = provider;
|
|
1734
|
+
return acc;
|
|
1735
|
+
}, {});
|
|
1736
|
+
var oauthProviderToAuthMethod = function oauthProviderToAuthMethod(provider) {
|
|
1737
|
+
return oauthProvidersToAuthMethods[provider];
|
|
1738
|
+
};
|
|
1739
|
+
var oauthMethodToOauthProvider = function oauthMethodToOauthProvider(authMethod) {
|
|
1740
|
+
return oauthMethodsToOauthProviders[authMethod];
|
|
1741
|
+
};
|
|
1742
|
+
var productToAuthMethod = function productToAuthMethod(product) {
|
|
1743
|
+
return productsToAuthMethods[product];
|
|
1744
|
+
};
|
|
1745
|
+
var authMethodToProduct = function authMethodToProduct(authMethod) {
|
|
1746
|
+
if (authMethod in oauthMethodsToOauthProviders) {
|
|
1747
|
+
return internal.B2BProducts.oauth;
|
|
1748
|
+
}
|
|
1749
|
+
return authMethodsToProducts[authMethod];
|
|
1750
|
+
};
|
|
1751
|
+
var allProducts = Object.keys(productsToAuthMethods);
|
|
1752
|
+
var allOauthProviders = Object.values(internal.B2BOAuthProviders);
|
|
1753
|
+
var flattenConfigToAuthMethods = function flattenConfigToAuthMethods(products, oauthProviders) {
|
|
1754
|
+
return products.reduce(function (acc, product) {
|
|
1755
|
+
if (product === internal.B2BProducts.oauth) {
|
|
1756
|
+
oauthProviders.forEach(function (provider) {
|
|
1757
|
+
var authMethod = oauthProviderToAuthMethod(typeof provider === 'string' ? provider : provider.type);
|
|
1758
|
+
if (authMethod) {
|
|
1759
|
+
acc.push(authMethod);
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
} else {
|
|
1763
|
+
var authMethod = productToAuthMethod(product);
|
|
1764
|
+
if (authMethod) {
|
|
1765
|
+
acc.push(authMethod);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
return acc;
|
|
1769
|
+
}, []);
|
|
1770
|
+
};
|
|
1771
|
+
var useOAuthProviderConfigs = function useOAuthProviderConfigs() {
|
|
1772
|
+
var _a;
|
|
1773
|
+
var config = useConfig();
|
|
1774
|
+
return extractErrorMessage.F(function () {
|
|
1775
|
+
var _a;
|
|
1776
|
+
if (!((_a = config.oauthOptions) === null || _a === void 0 ? void 0 : _a.providers)) {
|
|
1777
|
+
return [];
|
|
1778
|
+
}
|
|
1779
|
+
return config.oauthOptions.providers.map(getParamsFromB2BOAuthProviderConfig);
|
|
1780
|
+
}, [(_a = config.oauthOptions) === null || _a === void 0 ? void 0 : _a.providers]);
|
|
1781
|
+
};
|
|
1782
|
+
var useRestrictedAuthMethods = function useRestrictedAuthMethods() {
|
|
1783
|
+
var _a, _b;
|
|
1784
|
+
var _useGlobalReducer3 = useGlobalReducer(),
|
|
1785
|
+
_useGlobalReducer4 = _slicedToArray(_useGlobalReducer3, 1),
|
|
1786
|
+
state = _useGlobalReducer4[0];
|
|
1787
|
+
var primaryAuthMethods = state.primary.primaryAuthMethods;
|
|
1788
|
+
var hasPrimaryAuthMethods = !!primaryAuthMethods;
|
|
1789
|
+
var restrictedAuthMethods = extractErrorMessage.F(function () {
|
|
1790
|
+
var _a, _b, _c;
|
|
1791
|
+
if (state.primary.primaryAuthMethods) {
|
|
1792
|
+
return new Set(state.primary.primaryAuthMethods);
|
|
1793
|
+
}
|
|
1794
|
+
if (((_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods) === 'RESTRICTED') {
|
|
1795
|
+
return new Set((_c = (_b = state.flowState.organization) === null || _b === void 0 ? void 0 : _b.allowed_auth_methods) !== null && _c !== void 0 ? _c : []);
|
|
1796
|
+
}
|
|
1797
|
+
}, [(_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.allowed_auth_methods, (_b = state.flowState.organization) === null || _b === void 0 ? void 0 : _b.auth_methods, state.primary.primaryAuthMethods]);
|
|
1798
|
+
return {
|
|
1799
|
+
restrictedAuthMethods: restrictedAuthMethods,
|
|
1800
|
+
hasPrimaryAuthMethods: hasPrimaryAuthMethods
|
|
1801
|
+
};
|
|
1802
|
+
};
|
|
1803
|
+
var useEffectiveAuthConfig = function useEffectiveAuthConfig() {
|
|
1804
|
+
var _a;
|
|
1805
|
+
var _useGlobalReducer5 = useGlobalReducer(),
|
|
1806
|
+
_useGlobalReducer6 = _slicedToArray(_useGlobalReducer5, 1),
|
|
1807
|
+
state = _useGlobalReducer6[0];
|
|
1808
|
+
var config = useConfig();
|
|
1809
|
+
var _useRestrictedAuthMet = useRestrictedAuthMethods(),
|
|
1810
|
+
restrictedAuthMethods = _useRestrictedAuthMet.restrictedAuthMethods,
|
|
1811
|
+
hasPrimaryAuthMethods = _useRestrictedAuthMet.hasPrimaryAuthMethods;
|
|
1812
|
+
var oauthProviderConfigs = useOAuthProviderConfigs();
|
|
1813
|
+
var flattenedConfiguredAuthMethods = extractErrorMessage.F(function () {
|
|
1814
|
+
return flattenConfigToAuthMethods(config.products, oauthProviderConfigs);
|
|
1815
|
+
}, [config.products, oauthProviderConfigs]);
|
|
1816
|
+
var authMethodsToShow = extractErrorMessage.F(function () {
|
|
1817
|
+
var _a;
|
|
1818
|
+
if (!restrictedAuthMethods) {
|
|
1819
|
+
return flattenedConfiguredAuthMethods;
|
|
1820
|
+
}
|
|
1821
|
+
var restrictedAuthMethodsInUiConfig = flattenedConfiguredAuthMethods.filter(function (authMethod) {
|
|
1822
|
+
return restrictedAuthMethods.has(authMethod);
|
|
1823
|
+
});
|
|
1824
|
+
if (restrictedAuthMethodsInUiConfig.length > 0 || !hasPrimaryAuthMethods) {
|
|
1825
|
+
return restrictedAuthMethodsInUiConfig;
|
|
1826
|
+
}
|
|
1827
|
+
if (((_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods) === 'RESTRICTED') {
|
|
1828
|
+
return flattenConfigToAuthMethods(allProducts, allOauthProviders).filter(function (authMethod) {
|
|
1829
|
+
return restrictedAuthMethods.has(authMethod);
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
return ['magic_link'];
|
|
1833
|
+
}, [flattenedConfiguredAuthMethods, hasPrimaryAuthMethods, restrictedAuthMethods, (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods]);
|
|
1834
|
+
var products = extractErrorMessage.F(function () {
|
|
1835
|
+
return _toConsumableArray(new Set(authMethodsToShow.map(authMethodToProduct).filter(extractErrorMessage.isTruthy)));
|
|
1836
|
+
}, [authMethodsToShow]);
|
|
1837
|
+
var oauthProviderSettings = extractErrorMessage.F(function () {
|
|
1838
|
+
return authMethodsToShow.map(function (authMethod) {
|
|
1839
|
+
var _a;
|
|
1840
|
+
var provider = oauthMethodToOauthProvider(authMethod);
|
|
1841
|
+
if (provider) {
|
|
1842
|
+
return (_a = oauthProviderConfigs.find(function (oauthProvider) {
|
|
1843
|
+
return oauthProvider.type === provider;
|
|
1844
|
+
})) !== null && _a !== void 0 ? _a : getParamsFromB2BOAuthProviderConfig(provider);
|
|
1845
|
+
}
|
|
1846
|
+
}).filter(extractErrorMessage.isTruthy);
|
|
1847
|
+
}, [authMethodsToShow, oauthProviderConfigs]);
|
|
1848
|
+
return {
|
|
1849
|
+
products: products,
|
|
1850
|
+
oauthProviderSettings: oauthProviderSettings
|
|
1851
|
+
};
|
|
1852
|
+
};
|
|
1853
|
+
var DEFAULT_OTP_EXPIRATION_MS = 1000 * 60 * 10;
|
|
1854
|
+
var getOtpCodeExpiration = function getOtpCodeExpiration() {
|
|
1855
|
+
return new Date(Date.now() + DEFAULT_OTP_EXPIRATION_MS);
|
|
1856
|
+
};
|
|
1857
|
+
var mutation = function mutation() {
|
|
1858
|
+
return function (key, fetcher) {
|
|
1859
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1860
|
+
var _extractErrorMessage$3 = extractErrorMessage.useSWRConfig(),
|
|
1861
|
+
mutate = _extractErrorMessage$3.mutate;
|
|
1862
|
+
var keyRef = extractErrorMessage._(key);
|
|
1863
|
+
var fetcherRef = extractErrorMessage._(fetcher);
|
|
1864
|
+
var configRef = extractErrorMessage._(config);
|
|
1865
|
+
var ditchMutationsUntilRef = extractErrorMessage._(0);
|
|
1866
|
+
var _extractErrorMessage$4 = extractErrorMessage.useStateWithDeps({
|
|
1867
|
+
data: extractErrorMessage.UNDEFINED,
|
|
1868
|
+
error: extractErrorMessage.UNDEFINED,
|
|
1869
|
+
isMutating: false
|
|
1870
|
+
}),
|
|
1871
|
+
_extractErrorMessage$5 = _slicedToArray(_extractErrorMessage$4, 3),
|
|
1872
|
+
stateRef = _extractErrorMessage$5[0],
|
|
1873
|
+
stateDependencies = _extractErrorMessage$5[1],
|
|
1874
|
+
setState = _extractErrorMessage$5[2];
|
|
1875
|
+
var currentState = stateRef.current;
|
|
1876
|
+
var trigger = extractErrorMessage.T( /*#__PURE__*/function () {
|
|
1877
|
+
var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(arg, opts) {
|
|
1878
|
+
var _extractErrorMessage$6, _extractErrorMessage$7, serializedKey, resolvedKey, options, mutationStartedAt, data;
|
|
1879
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1880
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1881
|
+
case 0:
|
|
1882
|
+
_extractErrorMessage$6 = extractErrorMessage.serialize(keyRef.current), _extractErrorMessage$7 = _slicedToArray(_extractErrorMessage$6, 2), serializedKey = _extractErrorMessage$7[0], resolvedKey = _extractErrorMessage$7[1];
|
|
1883
|
+
if (fetcherRef.current) {
|
|
1884
|
+
_context.next = 3;
|
|
1885
|
+
break;
|
|
1886
|
+
}
|
|
1887
|
+
throw new Error('Can’t trigger the mutation: missing fetcher.');
|
|
1888
|
+
case 3:
|
|
1889
|
+
if (serializedKey) {
|
|
1890
|
+
_context.next = 5;
|
|
1891
|
+
break;
|
|
1892
|
+
}
|
|
1893
|
+
throw new Error('Can’t trigger the mutation: missing key.');
|
|
1894
|
+
case 5:
|
|
1895
|
+
options = extractErrorMessage.mergeObjects(extractErrorMessage.mergeObjects({
|
|
1896
|
+
populateCache: false,
|
|
1897
|
+
throwOnError: true
|
|
1898
|
+
}, configRef.current), opts);
|
|
1899
|
+
mutationStartedAt = extractErrorMessage.getTimestamp();
|
|
1900
|
+
ditchMutationsUntilRef.current = mutationStartedAt;
|
|
1901
|
+
setState({
|
|
1902
|
+
isMutating: true
|
|
1903
|
+
});
|
|
1904
|
+
_context.prev = 9;
|
|
1905
|
+
_context.next = 12;
|
|
1906
|
+
return mutate(serializedKey, fetcherRef.current(resolvedKey, {
|
|
1907
|
+
arg: arg
|
|
1908
|
+
}), extractErrorMessage.mergeObjects(options, {
|
|
1909
|
+
throwOnError: true
|
|
1910
|
+
}));
|
|
1911
|
+
case 12:
|
|
1912
|
+
data = _context.sent;
|
|
1913
|
+
if (ditchMutationsUntilRef.current <= mutationStartedAt) {
|
|
1914
|
+
setState({
|
|
1915
|
+
data: data,
|
|
1916
|
+
isMutating: false,
|
|
1917
|
+
error: undefined
|
|
1918
|
+
});
|
|
1919
|
+
options.onSuccess == null ? void 0 : options.onSuccess(data, serializedKey, options);
|
|
1920
|
+
}
|
|
1921
|
+
return _context.abrupt("return", data);
|
|
1922
|
+
case 17:
|
|
1923
|
+
_context.prev = 17;
|
|
1924
|
+
_context.t0 = _context["catch"](9);
|
|
1925
|
+
if (!(ditchMutationsUntilRef.current <= mutationStartedAt)) {
|
|
1926
|
+
_context.next = 24;
|
|
1927
|
+
break;
|
|
1928
|
+
}
|
|
1929
|
+
setState({
|
|
1930
|
+
error: _context.t0,
|
|
1931
|
+
isMutating: false
|
|
1932
|
+
});
|
|
1933
|
+
options.onError == null ? void 0 : options.onError(_context.t0, serializedKey, options);
|
|
1934
|
+
if (!options.throwOnError) {
|
|
1935
|
+
_context.next = 24;
|
|
1936
|
+
break;
|
|
1937
|
+
}
|
|
1938
|
+
throw _context.t0;
|
|
1939
|
+
case 24:
|
|
1940
|
+
case "end":
|
|
1941
|
+
return _context.stop();
|
|
1942
|
+
}
|
|
1943
|
+
}, _callee, null, [[9, 17]]);
|
|
1944
|
+
}));
|
|
1945
|
+
return function (_x, _x2) {
|
|
1946
|
+
return _ref47.apply(this, arguments);
|
|
1947
|
+
};
|
|
1948
|
+
}(), []);
|
|
1949
|
+
var reset = extractErrorMessage.T(function () {
|
|
1950
|
+
ditchMutationsUntilRef.current = extractErrorMessage.getTimestamp();
|
|
1951
|
+
setState({
|
|
1952
|
+
data: extractErrorMessage.UNDEFINED,
|
|
1953
|
+
error: extractErrorMessage.UNDEFINED,
|
|
1954
|
+
isMutating: false
|
|
1955
|
+
});
|
|
1956
|
+
}, []);
|
|
1957
|
+
extractErrorMessage.useIsomorphicLayoutEffect(function () {
|
|
1958
|
+
keyRef.current = key;
|
|
1959
|
+
fetcherRef.current = fetcher;
|
|
1960
|
+
configRef.current = config;
|
|
1961
|
+
});
|
|
1962
|
+
return {
|
|
1963
|
+
trigger: trigger,
|
|
1964
|
+
reset: reset,
|
|
1965
|
+
get data() {
|
|
1966
|
+
stateDependencies.data = true;
|
|
1967
|
+
return currentState.data;
|
|
1968
|
+
},
|
|
1969
|
+
get error() {
|
|
1970
|
+
stateDependencies.error = true;
|
|
1971
|
+
return currentState.error;
|
|
1972
|
+
},
|
|
1973
|
+
get isMutating() {
|
|
1974
|
+
stateDependencies.isMutating = true;
|
|
1975
|
+
return currentState.isMutating;
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
};
|
|
1979
|
+
};
|
|
1980
|
+
var index = extractErrorMessage.withMiddleware(extractErrorMessage.useSWR, mutation);
|
|
1981
|
+
var KeyToStytchEventMap = {
|
|
1982
|
+
'stytch.magicLinks.authenticate': internal.StytchEventType.B2BMagicLinkAuthenticate,
|
|
1983
|
+
'stytch.sso.authenticate': internal.StytchEventType.B2BSSOAuthenticate,
|
|
1984
|
+
'stytch.magicLinks.discovery.authenticate': internal.StytchEventType.B2BMagicLinkDiscoveryAuthenticate,
|
|
1985
|
+
'stytch.discovery.organization.create': internal.StytchEventType.B2BDiscoveryOrganizationsCreate,
|
|
1986
|
+
'stytch.discovery.intermediateSessions.exchange': internal.StytchEventType.B2BDiscoveryIntermediateSessionExchange,
|
|
1987
|
+
'stytch.magicLinks.email.loginOrSignup': internal.StytchEventType.B2BMagicLinkEmailLoginOrSignup,
|
|
1988
|
+
'stytch.magicLinks.discovery.send': internal.StytchEventType.B2BMagicLinkEmailDiscoverySend,
|
|
1989
|
+
'stytch.oauth.authenticate': internal.StytchEventType.B2BOAuthAuthenticate,
|
|
1990
|
+
'stytch.oauth.discovery.authenticate': internal.StytchEventType.B2BOAuthDiscoveryAuthenticate,
|
|
1991
|
+
'stytch.otps.sms.send': internal.StytchEventType.B2BSMSOTPSend,
|
|
1992
|
+
'stytch.otps.sms.authenticate': internal.StytchEventType.B2BSMSOTPAuthenticate,
|
|
1993
|
+
'stytch.totp.create': internal.StytchEventType.B2BTOTPCreate,
|
|
1994
|
+
'stytch.totp.authenticate': internal.StytchEventType.B2BTOTPAuthenticate,
|
|
1995
|
+
'stytch.recoveryCodes.recover': internal.StytchEventType.B2BRecoveryCodesRecover
|
|
1996
|
+
};
|
|
1997
|
+
var useMutate = function useMutate(key, fetcher, options) {
|
|
1998
|
+
var onEvent = useEventCallback();
|
|
1999
|
+
var _onError = useErrorCallback();
|
|
2000
|
+
return index(key, fetcher, Object.assign(Object.assign({
|
|
2001
|
+
throwOnError: false
|
|
2002
|
+
}, options), {
|
|
2003
|
+
onSuccess: function onSuccess(data, key, config) {
|
|
2004
|
+
if (KeyToStytchEventMap[key]) {
|
|
2005
|
+
onEvent({
|
|
2006
|
+
type: KeyToStytchEventMap[key],
|
|
2007
|
+
data: data
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
(options === null || options === void 0 ? void 0 : options.onSuccess) && options.onSuccess(data, key, config);
|
|
2011
|
+
},
|
|
2012
|
+
onError: function onError(error, key, config) {
|
|
2013
|
+
_onError(error);
|
|
2014
|
+
(options === null || options === void 0 ? void 0 : options.onError) && options.onError(error, key, config);
|
|
2015
|
+
}
|
|
2016
|
+
}));
|
|
2017
|
+
};
|
|
2018
|
+
var useExtractSlug = function useExtractSlug() {
|
|
2019
|
+
var _useGlobalReducer7 = useGlobalReducer(),
|
|
2020
|
+
_useGlobalReducer8 = _slicedToArray(_useGlobalReducer7, 2),
|
|
2021
|
+
state = _useGlobalReducer8[0],
|
|
2022
|
+
dispatch = _useGlobalReducer8[1];
|
|
2023
|
+
var _extractErrorMessage$8 = extractErrorMessage.h(),
|
|
2024
|
+
_extractErrorMessage$9 = _slicedToArray(_extractErrorMessage$8, 2),
|
|
2025
|
+
pattern = _extractErrorMessage$9[0],
|
|
2026
|
+
setPattern = _extractErrorMessage$9[1];
|
|
2027
|
+
var stytchClient = useStytch();
|
|
2028
|
+
var slug = extractFromPattern(pattern || null);
|
|
2029
|
+
var _useMutate = useMutate('stytchClient.organization.getBySlug', function (_, _ref48) {
|
|
2030
|
+
var slug = _ref48.arg.slug;
|
|
2031
|
+
return stytchClient.organization.getBySlug({
|
|
2032
|
+
organization_slug: slug
|
|
2033
|
+
});
|
|
2034
|
+
}, {
|
|
2035
|
+
onSuccess: function onSuccess(_ref49) {
|
|
2036
|
+
var organization = _ref49.organization;
|
|
1694
2037
|
if (organization === null) {
|
|
1695
2038
|
dispatch({
|
|
1696
2039
|
type: 'set_error_message_and_transition',
|
|
@@ -1707,8 +2050,8 @@ var useExtractSlug = function useExtractSlug() {
|
|
|
1707
2050
|
trigger = _useMutate.trigger,
|
|
1708
2051
|
isSearching = _useMutate.isMutating;
|
|
1709
2052
|
extractErrorMessage.p(function () {
|
|
1710
|
-
internal.readB2BInternals(stytchClient).bootstrap.getAsync().then(function (
|
|
1711
|
-
var slugPattern =
|
|
2053
|
+
internal.readB2BInternals(stytchClient).bootstrap.getAsync().then(function (_ref50) {
|
|
2054
|
+
var slugPattern = _ref50.slugPattern;
|
|
1712
2055
|
setPattern(slugPattern);
|
|
1713
2056
|
});
|
|
1714
2057
|
}, [stytchClient]);
|
|
@@ -1745,11 +2088,19 @@ var onAuthenticateSuccess = function onAuthenticateSuccess(data, dispatch, confi
|
|
|
1745
2088
|
includedMfaMethods: config.mfaProductInclude
|
|
1746
2089
|
});
|
|
1747
2090
|
};
|
|
2091
|
+
var onDiscoveryAuthenticateSuccess = function onDiscoveryAuthenticateSuccess(data, dispatch) {
|
|
2092
|
+
dispatch({
|
|
2093
|
+
type: 'set_discovery_state',
|
|
2094
|
+
email: data.email_address,
|
|
2095
|
+
discoveredOrganizations: data.discovered_organizations,
|
|
2096
|
+
intermediateSessionToken: data.intermediate_session_token
|
|
2097
|
+
});
|
|
2098
|
+
};
|
|
1748
2099
|
var usePasswordInput = function usePasswordInput() {
|
|
1749
|
-
var
|
|
1750
|
-
|
|
1751
|
-
state =
|
|
1752
|
-
dispatch =
|
|
2100
|
+
var _useGlobalReducer9 = useGlobalReducer(),
|
|
2101
|
+
_useGlobalReducer10 = _slicedToArray(_useGlobalReducer9, 2),
|
|
2102
|
+
state = _useGlobalReducer10[0],
|
|
2103
|
+
dispatch = _useGlobalReducer10[1];
|
|
1753
2104
|
var config = useConfig();
|
|
1754
2105
|
var stytch = useStytch();
|
|
1755
2106
|
var onEvent = useEventCallback();
|
|
@@ -1793,6 +2144,34 @@ var usePasswordInput = function usePasswordInput() {
|
|
|
1793
2144
|
setErrorMessage('Invalid email or password. Please try again or use the link below to get help.');
|
|
1794
2145
|
});
|
|
1795
2146
|
};
|
|
2147
|
+
var submitDiscoveryPassword = function submitDiscoveryPassword() {
|
|
2148
|
+
setErrorMessage('');
|
|
2149
|
+
setIsSubmitting(true);
|
|
2150
|
+
stytch.passwords.discovery.authenticate({
|
|
2151
|
+
email_address: email,
|
|
2152
|
+
password: password
|
|
2153
|
+
}).then(function (data) {
|
|
2154
|
+
setIsSubmitting(false);
|
|
2155
|
+
onEvent({
|
|
2156
|
+
type: internal.StytchEventType.B2BPasswordDiscoveryAuthenticate,
|
|
2157
|
+
data: data
|
|
2158
|
+
});
|
|
2159
|
+
dispatch({
|
|
2160
|
+
type: 'transition',
|
|
2161
|
+
screen: AppScreens$1.Discovery
|
|
2162
|
+
});
|
|
2163
|
+
dispatch({
|
|
2164
|
+
type: 'set_discovery_state',
|
|
2165
|
+
email: data.email_address,
|
|
2166
|
+
discoveredOrganizations: data.discovered_organizations,
|
|
2167
|
+
intermediateSessionToken: data.intermediate_session_token
|
|
2168
|
+
});
|
|
2169
|
+
})["catch"](function (err) {
|
|
2170
|
+
setIsSubmitting(false);
|
|
2171
|
+
onError(err);
|
|
2172
|
+
setErrorMessage('Invalid email or password. Please try again or use the link below to get help.');
|
|
2173
|
+
});
|
|
2174
|
+
};
|
|
1796
2175
|
var emailEligibleForJITProvisioning = function emailEligibleForJITProvisioning(organization, email) {
|
|
1797
2176
|
var emailDomain = email.split('@').pop();
|
|
1798
2177
|
return organization.email_jit_provisioning == 'NOT_ALLOWED' || organization.email_jit_provisioning == 'RESTRICTED' && emailDomain && organization.email_allowed_domains.includes(emailDomain);
|
|
@@ -1845,6 +2224,7 @@ var usePasswordInput = function usePasswordInput() {
|
|
|
1845
2224
|
isSubmitting: isSubmitting,
|
|
1846
2225
|
setIsSubmitting: setIsSubmitting,
|
|
1847
2226
|
submitPassword: submitPassword,
|
|
2227
|
+
submitDiscoveryPassword: submitDiscoveryPassword,
|
|
1848
2228
|
handleNonMemberReset: handleNonMemberReset
|
|
1849
2229
|
};
|
|
1850
2230
|
};
|
|
@@ -1859,192 +2239,138 @@ var extractFromPattern = function extractFromPattern(pattern) {
|
|
|
1859
2239
|
}
|
|
1860
2240
|
return null;
|
|
1861
2241
|
};
|
|
1862
|
-
var
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
},
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
}
|
|
1882
|
-
Button.defaultProps = {
|
|
1883
|
-
variant: 'primary'
|
|
1884
|
-
};
|
|
1885
|
-
var circularRotateKeyframe = extractErrorMessage.Ue(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
|
|
1886
|
-
var circularDashKeyframe = extractErrorMessage.Ue(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"])));
|
|
1887
|
-
var AnimatedCircle = extractErrorMessage.He.circle(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n stroke-dasharray: 80px, 200px;\n stroke-dashoffset: 0;\n animation: ", " 1.4s ease-in-out infinite;\n stroke: ", ";\n fill: none;\n"])), circularDashKeyframe, function (props) {
|
|
1888
|
-
return props.theme.colors.primary;
|
|
1889
|
-
});
|
|
1890
|
-
var CircularProgressRoot = extractErrorMessage.He.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n animation: ", " 1.4s ease-in-out infinite;\n"])), function (props) {
|
|
1891
|
-
return props.size;
|
|
1892
|
-
}, function (props) {
|
|
1893
|
-
return props.size;
|
|
1894
|
-
}, circularRotateKeyframe);
|
|
1895
|
-
var CircularProgressSVG = extractErrorMessage.He.svg(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n display: block;\n"])));
|
|
1896
|
-
var CircularProgress = function CircularProgress(_ref43) {
|
|
1897
|
-
var size = _ref43.size,
|
|
1898
|
-
thickness = _ref43.thickness;
|
|
1899
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(CircularProgressRoot, {
|
|
1900
|
-
size: size
|
|
1901
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(CircularProgressSVG, {
|
|
1902
|
-
viewBox: "".concat(size / 2, " ").concat(size / 2, " ").concat(size, " ").concat(size)
|
|
1903
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(AnimatedCircle, {
|
|
1904
|
-
cx: size,
|
|
1905
|
-
cy: size,
|
|
1906
|
-
r: (size - thickness) / 2,
|
|
1907
|
-
fill: "none",
|
|
1908
|
-
strokeWidth: thickness
|
|
1909
|
-
})));
|
|
1910
|
-
};
|
|
1911
|
-
var SubmitButton = function SubmitButton(props) {
|
|
1912
|
-
var buttonDisabled = props.isSubmitting || props.disabled;
|
|
1913
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(Button, {
|
|
1914
|
-
id: 'submit',
|
|
1915
|
-
type: "submit",
|
|
1916
|
-
disabled: buttonDisabled,
|
|
1917
|
-
variant: props.variant
|
|
1918
|
-
}, props.isSubmitting ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
1919
|
-
justifyContent: "center"
|
|
1920
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(CircularProgress, {
|
|
1921
|
-
size: 18,
|
|
1922
|
-
thickness: 1,
|
|
1923
|
-
"data-testid": "loading-icon"
|
|
1924
|
-
}))) : props.text);
|
|
1925
|
-
};
|
|
1926
|
-
var Input = extractErrorMessage.He.input(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n background-color: ", ";\n height: 47px;\n padding: 0 8px;\n box-sizing: border-box;\n border: 1px solid ", ";\n border-radius: ", ";\n color: ", ";\n font-family: ", ";\n font-size: 18px;\n &::placeholder {\n color: ", ";\n }\n\n &:disabled {\n border: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n }\n"])), function (props) {
|
|
1927
|
-
return props.theme.inputs.backgroundColor;
|
|
1928
|
-
}, function (props) {
|
|
1929
|
-
return props.theme.inputs.borderColor;
|
|
1930
|
-
}, function (props) {
|
|
1931
|
-
return props.theme.inputs.borderRadius;
|
|
1932
|
-
}, function (props) {
|
|
1933
|
-
return props.theme.inputs.textColor;
|
|
1934
|
-
}, function (props) {
|
|
1935
|
-
return props.theme.typography.fontFamily;
|
|
1936
|
-
}, function (props) {
|
|
1937
|
-
return props.theme.inputs.placeholderColor;
|
|
1938
|
-
}, function (props) {
|
|
1939
|
-
return props.theme.colors.disabledText;
|
|
1940
|
-
}, function (props) {
|
|
1941
|
-
return props.theme.colors.disabledText;
|
|
1942
|
-
}, function (props) {
|
|
1943
|
-
return props.theme.colors.disabled;
|
|
1944
|
-
});
|
|
1945
|
-
var EmailInput = function EmailInput(_ref44) {
|
|
1946
|
-
var email = _ref44.email,
|
|
1947
|
-
setEmail = _ref44.setEmail,
|
|
1948
|
-
_ref44$disableInput = _ref44.disableInput,
|
|
1949
|
-
disableInput = _ref44$disableInput === void 0 ? false : _ref44$disableInput,
|
|
1950
|
-
_ref44$hasPasskeys = _ref44.hasPasskeys,
|
|
1951
|
-
hasPasskeys = _ref44$hasPasskeys === void 0 ? false : _ref44$hasPasskeys;
|
|
1952
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(Input, Object.assign({
|
|
1953
|
-
placeholder: "example@email.com",
|
|
1954
|
-
name: "email",
|
|
1955
|
-
type: "email",
|
|
1956
|
-
autoComplete: hasPasskeys ? 'email webauthn' : 'email',
|
|
1957
|
-
disabled: disableInput,
|
|
1958
|
-
id: "email-input",
|
|
1959
|
-
value: email,
|
|
1960
|
-
onChange: function onChange(e) {
|
|
1961
|
-
return setEmail(e.target.value);
|
|
1962
|
-
},
|
|
1963
|
-
required: true
|
|
1964
|
-
}, hasPasskeys ? extractErrorMessage.passwordManagerDisableAutofillProps : {}));
|
|
1965
|
-
};
|
|
1966
|
-
var DASHBOARD_REGEX = /https:\/\/stytch\.com\/[#a-zA-Z0-9/-]+/g;
|
|
1967
|
-
var mapURLsToLinks = function mapURLsToLinks(str) {
|
|
1968
|
-
var nonLinkChunks = str.split(DASHBOARD_REGEX);
|
|
1969
|
-
var linkChunks = Array.from(str.matchAll(DASHBOARD_REGEX)).map(function (el) {
|
|
1970
|
-
return el[0];
|
|
2242
|
+
var useEmailOtpDiscoverySend = function useEmailOtpDiscoverySend() {
|
|
2243
|
+
var _useGlobalReducer11 = useGlobalReducer(),
|
|
2244
|
+
_useGlobalReducer12 = _slicedToArray(_useGlobalReducer11, 2),
|
|
2245
|
+
dispatch = _useGlobalReducer12[1];
|
|
2246
|
+
var stytchClient = useStytch();
|
|
2247
|
+
var config = useConfig();
|
|
2248
|
+
return useMutate('stytch.otps.email.discovery.send', function (_key, _ref51) {
|
|
2249
|
+
var email = _ref51.arg.email;
|
|
2250
|
+
var _a;
|
|
2251
|
+
return stytchClient.otps.email.discovery.send({
|
|
2252
|
+
email_address: email,
|
|
2253
|
+
login_template_id: (_a = config.emailOtpOptions) === null || _a === void 0 ? void 0 : _a.loginTemplateId
|
|
2254
|
+
});
|
|
2255
|
+
}, {
|
|
2256
|
+
onSuccess: function onSuccess() {
|
|
2257
|
+
dispatch({
|
|
2258
|
+
type: 'send_email_otp',
|
|
2259
|
+
codeExpiration: getOtpCodeExpiration()
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
1971
2262
|
});
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2263
|
+
};
|
|
2264
|
+
var useEmailOtpLoginOrSignup = function useEmailOtpLoginOrSignup() {
|
|
2265
|
+
var _useGlobalReducer13 = useGlobalReducer(),
|
|
2266
|
+
_useGlobalReducer14 = _slicedToArray(_useGlobalReducer13, 2),
|
|
2267
|
+
dispatch = _useGlobalReducer14[1];
|
|
2268
|
+
var stytchClient = useStytch();
|
|
2269
|
+
var config = useConfig();
|
|
2270
|
+
return useMutate('stytch.otps.email.loginOrSignup', function (_key, _ref52) {
|
|
2271
|
+
var _ref52$arg = _ref52.arg,
|
|
2272
|
+
email = _ref52$arg.email,
|
|
2273
|
+
organization_id = _ref52$arg.organization_id;
|
|
2274
|
+
var _a, _b;
|
|
2275
|
+
return stytchClient.otps.email.loginOrSignup({
|
|
2276
|
+
email_address: email,
|
|
2277
|
+
organization_id: organization_id,
|
|
2278
|
+
login_template_id: (_a = config.emailOtpOptions) === null || _a === void 0 ? void 0 : _a.loginTemplateId,
|
|
2279
|
+
signup_template_id: (_b = config.emailOtpOptions) === null || _b === void 0 ? void 0 : _b.signupTemplateId
|
|
2280
|
+
});
|
|
2281
|
+
}, {
|
|
2282
|
+
onSuccess: function onSuccess() {
|
|
2283
|
+
dispatch({
|
|
2284
|
+
type: 'send_email_otp',
|
|
2285
|
+
codeExpiration: getOtpCodeExpiration()
|
|
2286
|
+
});
|
|
1976
2287
|
}
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2288
|
+
});
|
|
2289
|
+
};
|
|
2290
|
+
var useEmlDiscoverySend = function useEmlDiscoverySend() {
|
|
2291
|
+
var _useGlobalReducer15 = useGlobalReducer(),
|
|
2292
|
+
_useGlobalReducer16 = _slicedToArray(_useGlobalReducer15, 2),
|
|
2293
|
+
dispatch = _useGlobalReducer16[1];
|
|
2294
|
+
var stytchClient = useStytch();
|
|
2295
|
+
var config = useConfig();
|
|
2296
|
+
return useMutate('stytch.magicLinks.discovery.send', function (_, _ref53) {
|
|
2297
|
+
var email = _ref53.arg.email;
|
|
2298
|
+
var _a, _b;
|
|
2299
|
+
return stytchClient.magicLinks.email.discovery.send({
|
|
2300
|
+
email_address: email,
|
|
2301
|
+
discovery_redirect_url: (_a = config.emailMagicLinksOptions) === null || _a === void 0 ? void 0 : _a.discoveryRedirectURL,
|
|
2302
|
+
login_template_id: (_b = config.emailMagicLinksOptions) === null || _b === void 0 ? void 0 : _b.loginTemplateId
|
|
2303
|
+
});
|
|
2304
|
+
}, {
|
|
2305
|
+
onSuccess: function onSuccess() {
|
|
2306
|
+
dispatch({
|
|
2307
|
+
type: 'transition',
|
|
2308
|
+
screen: AppScreens$1.EmailConfirmation
|
|
2309
|
+
});
|
|
1985
2310
|
}
|
|
1986
|
-
}
|
|
1987
|
-
return chunkResults;
|
|
2311
|
+
});
|
|
1988
2312
|
};
|
|
1989
|
-
var
|
|
1990
|
-
var
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2313
|
+
var useEmlLoginOrSignup = function useEmlLoginOrSignup() {
|
|
2314
|
+
var _useGlobalReducer17 = useGlobalReducer(),
|
|
2315
|
+
_useGlobalReducer18 = _slicedToArray(_useGlobalReducer17, 2),
|
|
2316
|
+
dispatch = _useGlobalReducer18[1];
|
|
2317
|
+
var stytchClient = useStytch();
|
|
2318
|
+
var config = useConfig();
|
|
2319
|
+
return useMutate('stytch.magicLinks.email.loginOrSignup', function (_, _ref54) {
|
|
2320
|
+
var _ref54$arg = _ref54.arg,
|
|
2321
|
+
email = _ref54$arg.email,
|
|
2322
|
+
organization_id = _ref54$arg.organization_id;
|
|
2323
|
+
var _a, _b, _c, _d;
|
|
2324
|
+
return stytchClient.magicLinks.email.loginOrSignup({
|
|
2325
|
+
email_address: email,
|
|
2326
|
+
organization_id: organization_id,
|
|
2327
|
+
login_redirect_url: (_a = config.emailMagicLinksOptions) === null || _a === void 0 ? void 0 : _a.loginRedirectURL,
|
|
2328
|
+
signup_redirect_url: (_b = config.emailMagicLinksOptions) === null || _b === void 0 ? void 0 : _b.signupRedirectURL,
|
|
2329
|
+
login_template_id: (_c = config.emailMagicLinksOptions) === null || _c === void 0 ? void 0 : _c.loginTemplateId,
|
|
2330
|
+
signup_template_id: (_d = config.emailMagicLinksOptions) === null || _d === void 0 ? void 0 : _d.signupTemplateId
|
|
2331
|
+
});
|
|
2332
|
+
}, {
|
|
2333
|
+
onSuccess: function onSuccess() {
|
|
2334
|
+
dispatch({
|
|
2335
|
+
type: 'transition',
|
|
2336
|
+
screen: AppScreens$1.EmailConfirmation
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
});
|
|
1998
2340
|
};
|
|
1999
2341
|
var JIT_PROVISIONING_ERRORS = ['email_jit_provisioning_not_allowed', 'invalid_email_for_jit_provisioning'];
|
|
2000
|
-
var parseErrorMessage = function parseErrorMessage(error,
|
|
2001
|
-
var email =
|
|
2002
|
-
org =
|
|
2342
|
+
var parseErrorMessage = function parseErrorMessage(error, _ref55) {
|
|
2343
|
+
var email = _ref55.email,
|
|
2344
|
+
org = _ref55.org;
|
|
2003
2345
|
if (JIT_PROVISIONING_ERRORS.includes(error.error_type)) {
|
|
2004
2346
|
return "".concat(email, " does not have access to ").concat(org, ". If you think this is a mistake, contact your admin");
|
|
2005
2347
|
} else {
|
|
2006
2348
|
return error.error_message;
|
|
2007
2349
|
}
|
|
2008
2350
|
};
|
|
2009
|
-
var
|
|
2010
|
-
var
|
|
2011
|
-
|
|
2012
|
-
state =
|
|
2013
|
-
dispatch =
|
|
2014
|
-
var stytchClient = useStytch();
|
|
2015
|
-
var config = useConfig();
|
|
2351
|
+
var EmailForm = function EmailForm() {
|
|
2352
|
+
var _useGlobalReducer19 = useGlobalReducer(),
|
|
2353
|
+
_useGlobalReducer20 = _slicedToArray(_useGlobalReducer19, 2),
|
|
2354
|
+
state = _useGlobalReducer20[0],
|
|
2355
|
+
dispatch = _useGlobalReducer20[1];
|
|
2016
2356
|
var _extractErrorMessage$20 = extractErrorMessage.h(''),
|
|
2017
2357
|
_extractErrorMessage$21 = _slicedToArray(_extractErrorMessage$20, 2),
|
|
2018
2358
|
emailInput = _extractErrorMessage$21[0],
|
|
2019
2359
|
setEmailInput = _extractErrorMessage$21[1];
|
|
2360
|
+
var _useEffectiveAuthConf = useEffectiveAuthConfig(),
|
|
2361
|
+
products = _useEffectiveAuthConf.products;
|
|
2362
|
+
var enableEml = products.includes(internal.B2BProducts.emailMagicLinks);
|
|
2363
|
+
var enableOtp = products.includes(internal.B2BProducts.emailOtp);
|
|
2020
2364
|
var providedEmail = state.primary.email;
|
|
2021
2365
|
var email = providedEmail || emailInput;
|
|
2022
|
-
var
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
login_template_id: (_c = config.emailMagicLinksOptions) === null || _c === void 0 ? void 0 : _c.loginTemplateId,
|
|
2031
|
-
signup_template_id: (_d = config.emailMagicLinksOptions) === null || _d === void 0 ? void 0 : _d.signupTemplateId
|
|
2032
|
-
});
|
|
2033
|
-
}, {
|
|
2034
|
-
onSuccess: function onSuccess() {
|
|
2035
|
-
dispatch({
|
|
2036
|
-
type: 'set_magic_link_email',
|
|
2037
|
-
email: email
|
|
2038
|
-
});
|
|
2039
|
-
dispatch({
|
|
2040
|
-
type: 'transition',
|
|
2041
|
-
screen: AppScreens$1.EmailConfirmation
|
|
2042
|
-
});
|
|
2043
|
-
}
|
|
2044
|
-
}),
|
|
2045
|
-
stytchLoginOrSignup = _useMutate2.trigger,
|
|
2046
|
-
error = _useMutate2.error,
|
|
2047
|
-
isMutating = _useMutate2.isMutating;
|
|
2366
|
+
var _useEmlLoginOrSignup = useEmlLoginOrSignup(),
|
|
2367
|
+
stytchEmlLoginOrSignup = _useEmlLoginOrSignup.trigger,
|
|
2368
|
+
emlError = _useEmlLoginOrSignup.error,
|
|
2369
|
+
emlIsMutating = _useEmlLoginOrSignup.isMutating;
|
|
2370
|
+
var _useEmailOtpLoginOrSi = useEmailOtpLoginOrSignup(),
|
|
2371
|
+
stytchOtpLoginOrSignup = _useEmailOtpLoginOrSi.trigger,
|
|
2372
|
+
otpError = _useEmailOtpLoginOrSi.error,
|
|
2373
|
+
otpIsMutating = _useEmailOtpLoginOrSi.isMutating;
|
|
2048
2374
|
var organization = state.flowState.organization;
|
|
2049
2375
|
if (!organization) return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
2050
2376
|
var handleSubmit = function handleSubmit(e) {
|
|
@@ -2053,23 +2379,92 @@ var MagicLinkEmailForm = function MagicLinkEmailForm() {
|
|
|
2053
2379
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2054
2380
|
case 0:
|
|
2055
2381
|
e.preventDefault();
|
|
2056
|
-
|
|
2057
|
-
|
|
2382
|
+
dispatch({
|
|
2383
|
+
type: 'set_user_supplied_email',
|
|
2384
|
+
email: email
|
|
2058
2385
|
});
|
|
2059
|
-
|
|
2386
|
+
if (enableEml && enableOtp) {
|
|
2387
|
+
dispatch({
|
|
2388
|
+
type: 'transition',
|
|
2389
|
+
screen: AppScreens$1.EmailMethodSelection,
|
|
2390
|
+
history: 'push'
|
|
2391
|
+
});
|
|
2392
|
+
} else if (enableEml) {
|
|
2393
|
+
stytchEmlLoginOrSignup({
|
|
2394
|
+
email: email,
|
|
2395
|
+
organization_id: organization.organization_id
|
|
2396
|
+
});
|
|
2397
|
+
} else if (enableOtp) {
|
|
2398
|
+
stytchOtpLoginOrSignup({
|
|
2399
|
+
email: email,
|
|
2400
|
+
organization_id: organization.organization_id
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2403
|
+
case 3:
|
|
2060
2404
|
case "end":
|
|
2061
2405
|
return _context2.stop();
|
|
2062
2406
|
}
|
|
2063
2407
|
}, _callee2);
|
|
2064
2408
|
}));
|
|
2065
2409
|
};
|
|
2410
|
+
var isMutating = emlIsMutating || otpIsMutating;
|
|
2411
|
+
var error = emlError || otpError;
|
|
2412
|
+
var errorText = error && ( /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorText, {
|
|
2413
|
+
errorMessage: parseErrorMessage(error, {
|
|
2414
|
+
email: email,
|
|
2415
|
+
org: organization.organization_name
|
|
2416
|
+
})
|
|
2417
|
+
}));
|
|
2418
|
+
if (providedEmail) {
|
|
2419
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
2420
|
+
direction: "column",
|
|
2421
|
+
gap: 8
|
|
2422
|
+
}, products.filter(function (product) {
|
|
2423
|
+
return product === internal.B2BProducts.emailMagicLinks || product === internal.B2BProducts.emailOtp;
|
|
2424
|
+
}).map(function (product) {
|
|
2425
|
+
switch (product) {
|
|
2426
|
+
case internal.B2BProducts.emailMagicLinks:
|
|
2427
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingButton, {
|
|
2428
|
+
key: product,
|
|
2429
|
+
type: "button",
|
|
2430
|
+
onClick: function onClick() {
|
|
2431
|
+
dispatch({
|
|
2432
|
+
type: 'set_user_supplied_email',
|
|
2433
|
+
email: email
|
|
2434
|
+
});
|
|
2435
|
+
stytchEmlLoginOrSignup({
|
|
2436
|
+
email: email,
|
|
2437
|
+
organization_id: organization.organization_id
|
|
2438
|
+
});
|
|
2439
|
+
},
|
|
2440
|
+
isLoading: emlIsMutating,
|
|
2441
|
+
disabled: isMutating,
|
|
2442
|
+
variant: "text"
|
|
2443
|
+
}, "Email me a link");
|
|
2444
|
+
case internal.B2BProducts.emailOtp:
|
|
2445
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingButton, {
|
|
2446
|
+
key: product,
|
|
2447
|
+
type: "button",
|
|
2448
|
+
onClick: function onClick() {
|
|
2449
|
+
dispatch({
|
|
2450
|
+
type: 'set_user_supplied_email',
|
|
2451
|
+
email: email
|
|
2452
|
+
});
|
|
2453
|
+
stytchOtpLoginOrSignup({
|
|
2454
|
+
email: email,
|
|
2455
|
+
organization_id: organization.organization_id
|
|
2456
|
+
});
|
|
2457
|
+
},
|
|
2458
|
+
isLoading: otpIsMutating,
|
|
2459
|
+
disabled: isMutating,
|
|
2460
|
+
variant: "text"
|
|
2461
|
+
}, "Email me a code");
|
|
2462
|
+
}
|
|
2463
|
+
}));
|
|
2464
|
+
}
|
|
2066
2465
|
return /*#__PURE__*/extractErrorMessage.wn.createElement("form", {
|
|
2067
2466
|
onSubmit: handleSubmit
|
|
2068
|
-
},
|
|
2069
|
-
isSubmitting: isMutating,
|
|
2070
|
-
text: 'Email me a link',
|
|
2071
|
-
variant: "text"
|
|
2072
|
-
})) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
2467
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
2073
2468
|
direction: "column",
|
|
2074
2469
|
gap: 8
|
|
2075
2470
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
@@ -2078,62 +2473,65 @@ var MagicLinkEmailForm = function MagicLinkEmailForm() {
|
|
|
2078
2473
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailInput, {
|
|
2079
2474
|
email: email,
|
|
2080
2475
|
setEmail: setEmailInput
|
|
2081
|
-
}),
|
|
2082
|
-
errorMessage: parseErrorMessage(error, {
|
|
2083
|
-
email: email,
|
|
2084
|
-
org: organization.organization_name
|
|
2085
|
-
})
|
|
2086
|
-
}))), /*#__PURE__*/extractErrorMessage.wn.createElement(SubmitButton, {
|
|
2476
|
+
}), errorText), /*#__PURE__*/extractErrorMessage.wn.createElement(SubmitButton, {
|
|
2087
2477
|
isSubmitting: isMutating,
|
|
2088
2478
|
text: 'Continue with email'
|
|
2089
|
-
})))
|
|
2479
|
+
})));
|
|
2090
2480
|
};
|
|
2091
|
-
var
|
|
2092
|
-
var
|
|
2093
|
-
|
|
2094
|
-
dispatch =
|
|
2095
|
-
var stytchClient = useStytch();
|
|
2096
|
-
var config = useConfig();
|
|
2481
|
+
var EmailDiscoveryForm = function EmailDiscoveryForm() {
|
|
2482
|
+
var _useGlobalReducer21 = useGlobalReducer(),
|
|
2483
|
+
_useGlobalReducer22 = _slicedToArray(_useGlobalReducer21, 2),
|
|
2484
|
+
dispatch = _useGlobalReducer22[1];
|
|
2097
2485
|
var _extractErrorMessage$22 = extractErrorMessage.h(''),
|
|
2098
2486
|
_extractErrorMessage$23 = _slicedToArray(_extractErrorMessage$22, 2),
|
|
2099
2487
|
email = _extractErrorMessage$23[0],
|
|
2100
2488
|
setEmail = _extractErrorMessage$23[1];
|
|
2101
|
-
var
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
});
|
|
2114
|
-
dispatch({
|
|
2115
|
-
type: 'transition',
|
|
2116
|
-
screen: AppScreens$1.EmailConfirmation
|
|
2117
|
-
});
|
|
2118
|
-
}
|
|
2119
|
-
}),
|
|
2120
|
-
stytchDiscoverySend = _useMutate3.trigger,
|
|
2121
|
-
error = _useMutate3.error,
|
|
2122
|
-
isMutating = _useMutate3.isMutating;
|
|
2489
|
+
var _useEffectiveAuthConf2 = useEffectiveAuthConfig(),
|
|
2490
|
+
products = _useEffectiveAuthConf2.products;
|
|
2491
|
+
var enableEml = products.includes(internal.B2BProducts.emailMagicLinks);
|
|
2492
|
+
var enableOtp = products.includes(internal.B2BProducts.emailOtp);
|
|
2493
|
+
var _useEmlDiscoverySend = useEmlDiscoverySend(),
|
|
2494
|
+
stytchEmlDiscoverySend = _useEmlDiscoverySend.trigger,
|
|
2495
|
+
emlError = _useEmlDiscoverySend.error,
|
|
2496
|
+
emlIsMutating = _useEmlDiscoverySend.isMutating;
|
|
2497
|
+
var _useEmailOtpDiscovery = useEmailOtpDiscoverySend(),
|
|
2498
|
+
stytchOtpDiscoverySend = _useEmailOtpDiscovery.trigger,
|
|
2499
|
+
otpError = _useEmailOtpDiscovery.error,
|
|
2500
|
+
otpIsMutating = _useEmailOtpDiscovery.isMutating;
|
|
2123
2501
|
var handleSubmit = function handleSubmit(e) {
|
|
2124
2502
|
return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2125
2503
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2126
2504
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2127
2505
|
case 0:
|
|
2128
2506
|
e.preventDefault();
|
|
2129
|
-
|
|
2130
|
-
|
|
2507
|
+
dispatch({
|
|
2508
|
+
type: 'set_user_supplied_email',
|
|
2509
|
+
email: email
|
|
2510
|
+
});
|
|
2511
|
+
if (enableEml && enableOtp) {
|
|
2512
|
+
dispatch({
|
|
2513
|
+
type: 'transition',
|
|
2514
|
+
screen: AppScreens$1.EmailMethodSelection,
|
|
2515
|
+
history: 'push'
|
|
2516
|
+
});
|
|
2517
|
+
} else if (enableEml) {
|
|
2518
|
+
stytchEmlDiscoverySend({
|
|
2519
|
+
email: email
|
|
2520
|
+
});
|
|
2521
|
+
} else if (enableOtp) {
|
|
2522
|
+
stytchOtpDiscoverySend({
|
|
2523
|
+
email: email
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2526
|
+
case 3:
|
|
2131
2527
|
case "end":
|
|
2132
2528
|
return _context3.stop();
|
|
2133
2529
|
}
|
|
2134
2530
|
}, _callee3);
|
|
2135
2531
|
}));
|
|
2136
2532
|
};
|
|
2533
|
+
var isMutating = emlIsMutating || otpIsMutating;
|
|
2534
|
+
var error = emlError || otpError;
|
|
2137
2535
|
return /*#__PURE__*/extractErrorMessage.wn.createElement("form", {
|
|
2138
2536
|
onSubmit: handleSubmit
|
|
2139
2537
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
@@ -2152,9 +2550,9 @@ var MagicLinkEmailDiscoveryForm = function MagicLinkEmailDiscoveryForm() {
|
|
|
2152
2550
|
text: 'Continue with email'
|
|
2153
2551
|
})));
|
|
2154
2552
|
};
|
|
2155
|
-
var SSOButton = function SSOButton(
|
|
2156
|
-
var display_name =
|
|
2157
|
-
connection_id =
|
|
2553
|
+
var SSOButton = function SSOButton(_ref56) {
|
|
2554
|
+
var display_name = _ref56.display_name,
|
|
2555
|
+
connection_id = _ref56.connection_id;
|
|
2158
2556
|
var stytchClient = useStytch();
|
|
2159
2557
|
var config = useConfig();
|
|
2160
2558
|
var onButtonClick = function onButtonClick() {
|
|
@@ -2181,9 +2579,9 @@ var SSOButton = function SSOButton(_ref48) {
|
|
|
2181
2579
|
}, "Continue with ".concat(display_name))));
|
|
2182
2580
|
};
|
|
2183
2581
|
var SSOButtons = function SSOButtons() {
|
|
2184
|
-
var
|
|
2185
|
-
|
|
2186
|
-
state =
|
|
2582
|
+
var _useGlobalReducer23 = useGlobalReducer(),
|
|
2583
|
+
_useGlobalReducer24 = _slicedToArray(_useGlobalReducer23, 1),
|
|
2584
|
+
state = _useGlobalReducer24[0];
|
|
2187
2585
|
if (!state.flowState.organization) return /*#__PURE__*/extractErrorMessage.y(extractErrorMessage.g, null);
|
|
2188
2586
|
return /*#__PURE__*/extractErrorMessage.y(Flex, {
|
|
2189
2587
|
direction: "column",
|
|
@@ -2219,9 +2617,9 @@ var Divider = function Divider() {
|
|
|
2219
2617
|
"$placement": "right"
|
|
2220
2618
|
}));
|
|
2221
2619
|
};
|
|
2222
|
-
var PasswordIconSvg = function PasswordIconSvg(
|
|
2223
|
-
var
|
|
2224
|
-
enabled =
|
|
2620
|
+
var PasswordIconSvg = function PasswordIconSvg(_ref57) {
|
|
2621
|
+
var _ref57$enabled = _ref57.enabled,
|
|
2622
|
+
enabled = _ref57$enabled === void 0 ? false : _ref57$enabled;
|
|
2225
2623
|
return /*#__PURE__*/extractErrorMessage.wn.createElement("svg", {
|
|
2226
2624
|
width: "20",
|
|
2227
2625
|
height: "14",
|
|
@@ -2270,10 +2668,10 @@ var InputContainer = extractErrorMessage.He(Flex)(_templateObject31 || (_templat
|
|
|
2270
2668
|
return props.theme.inputs.placeholderColor;
|
|
2271
2669
|
});
|
|
2272
2670
|
var PasswordIconButton = extractErrorMessage.He.button(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n all: unset;\n cursor: pointer;\n"])));
|
|
2273
|
-
var PasswordIcon = function PasswordIcon(
|
|
2274
|
-
var onClick =
|
|
2275
|
-
enabled =
|
|
2276
|
-
visible =
|
|
2671
|
+
var PasswordIcon = function PasswordIcon(_ref58) {
|
|
2672
|
+
var onClick = _ref58.onClick,
|
|
2673
|
+
enabled = _ref58.enabled,
|
|
2674
|
+
visible = _ref58.visible;
|
|
2277
2675
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordIconButton, {
|
|
2278
2676
|
onClick: onClick,
|
|
2279
2677
|
type: "button"
|
|
@@ -2281,10 +2679,10 @@ var PasswordIcon = function PasswordIcon(_ref50) {
|
|
|
2281
2679
|
enabled: enabled
|
|
2282
2680
|
}));
|
|
2283
2681
|
};
|
|
2284
|
-
var PasswordInput = function PasswordInput(
|
|
2285
|
-
var password =
|
|
2286
|
-
setPassword =
|
|
2287
|
-
type =
|
|
2682
|
+
var PasswordInput = function PasswordInput(_ref59) {
|
|
2683
|
+
var password = _ref59.password,
|
|
2684
|
+
setPassword = _ref59.setPassword,
|
|
2685
|
+
type = _ref59.type;
|
|
2288
2686
|
var _extractErrorMessage$24 = extractErrorMessage.h(false),
|
|
2289
2687
|
_extractErrorMessage$25 = _slicedToArray(_extractErrorMessage$24, 2),
|
|
2290
2688
|
visible = _extractErrorMessage$25[0],
|
|
@@ -2314,8 +2712,8 @@ var PasswordInput = function PasswordInput(_ref51) {
|
|
|
2314
2712
|
}));
|
|
2315
2713
|
};
|
|
2316
2714
|
var BackButton = extractErrorMessage.He.button(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n all: unset;\n cursor: pointer;\n"])));
|
|
2317
|
-
var BackArrowSvg = function BackArrowSvg(
|
|
2318
|
-
var color =
|
|
2715
|
+
var BackArrowSvg = function BackArrowSvg(_ref60) {
|
|
2716
|
+
var color = _ref60.color;
|
|
2319
2717
|
return /*#__PURE__*/extractErrorMessage.wn.createElement("svg", {
|
|
2320
2718
|
width: "24",
|
|
2321
2719
|
height: "24",
|
|
@@ -2327,8 +2725,8 @@ var BackArrowSvg = function BackArrowSvg(_ref52) {
|
|
|
2327
2725
|
fill: color
|
|
2328
2726
|
}));
|
|
2329
2727
|
};
|
|
2330
|
-
var BackArrow = function BackArrow(
|
|
2331
|
-
var onClick =
|
|
2728
|
+
var BackArrow = function BackArrow(_ref61) {
|
|
2729
|
+
var onClick = _ref61.onClick;
|
|
2332
2730
|
var theme = extractErrorMessage.Ze();
|
|
2333
2731
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(BackButton, {
|
|
2334
2732
|
type: "button",
|
|
@@ -2340,9 +2738,9 @@ var BackArrow = function BackArrow(_ref53) {
|
|
|
2340
2738
|
};
|
|
2341
2739
|
var GetHelpText = extractErrorMessage.He(Text)(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n font-weight: bold !important;\n cursor: pointer;\n"])));
|
|
2342
2740
|
var PasswordsAuthenticate = function PasswordsAuthenticate() {
|
|
2343
|
-
var
|
|
2344
|
-
|
|
2345
|
-
dispatch =
|
|
2741
|
+
var _useGlobalReducer25 = useGlobalReducer(),
|
|
2742
|
+
_useGlobalReducer26 = _slicedToArray(_useGlobalReducer25, 2),
|
|
2743
|
+
dispatch = _useGlobalReducer26[1];
|
|
2346
2744
|
var config = useConfig();
|
|
2347
2745
|
var passwordOptions = config.passwordOptions;
|
|
2348
2746
|
var _usePasswordInput = usePasswordInput(),
|
|
@@ -2354,27 +2752,25 @@ var PasswordsAuthenticate = function PasswordsAuthenticate() {
|
|
|
2354
2752
|
errorMessage = _usePasswordInput.errorMessage,
|
|
2355
2753
|
setErrorMessage = _usePasswordInput.setErrorMessage,
|
|
2356
2754
|
isSubmitting = _usePasswordInput.isSubmitting,
|
|
2357
|
-
submitPassword = _usePasswordInput.submitPassword
|
|
2755
|
+
submitPassword = _usePasswordInput.submitPassword,
|
|
2756
|
+
submitDiscoveryPassword = _usePasswordInput.submitDiscoveryPassword;
|
|
2358
2757
|
if (!passwordOptions) return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
2359
|
-
if (!organization) return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
2360
2758
|
var handleSubmit = function handleSubmit(e) {
|
|
2361
2759
|
return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
2362
2760
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2363
2761
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2364
2762
|
case 0:
|
|
2365
2763
|
e.preventDefault();
|
|
2366
|
-
if (organization) {
|
|
2367
|
-
_context4.next = 3;
|
|
2368
|
-
break;
|
|
2369
|
-
}
|
|
2370
|
-
return _context4.abrupt("return");
|
|
2371
|
-
case 3:
|
|
2372
2764
|
if (!email.match(internal.EMAIL_REGEX)) {
|
|
2373
2765
|
setErrorMessage('Invalid email address');
|
|
2374
2766
|
} else {
|
|
2375
|
-
|
|
2767
|
+
if (!organization) {
|
|
2768
|
+
submitDiscoveryPassword();
|
|
2769
|
+
} else {
|
|
2770
|
+
submitPassword(organization.organization_id);
|
|
2771
|
+
}
|
|
2376
2772
|
}
|
|
2377
|
-
case
|
|
2773
|
+
case 2:
|
|
2378
2774
|
case "end":
|
|
2379
2775
|
return _context4.stop();
|
|
2380
2776
|
}
|
|
@@ -2432,19 +2828,24 @@ var PasswordsAuthenticate = function PasswordsAuthenticate() {
|
|
|
2432
2828
|
})), /*#__PURE__*/extractErrorMessage.wn.createElement(SubmitButton, {
|
|
2433
2829
|
isSubmitting: isSubmitting,
|
|
2434
2830
|
text: "Continue"
|
|
2435
|
-
}), /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
2831
|
+
}), organization != null ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
2436
2832
|
onClick: onGetHelp,
|
|
2437
2833
|
direction: "row"
|
|
2438
2834
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
2439
2835
|
color: "secondary"
|
|
2440
2836
|
}, "Having trouble signing in?"), "\xA0", /*#__PURE__*/extractErrorMessage.wn.createElement(GetHelpText, {
|
|
2441
2837
|
color: "secondary"
|
|
2442
|
-
}, "Get help")))
|
|
2838
|
+
}, "Get help"))) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
2839
|
+
onClick: onGetHelp,
|
|
2840
|
+
justifyContent: "center"
|
|
2841
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(GetHelpText, {
|
|
2842
|
+
color: "secondary"
|
|
2843
|
+
}, "Sign up or reset password"))))));
|
|
2443
2844
|
};
|
|
2444
2845
|
var PasswordsEmailForm = function PasswordsEmailForm() {
|
|
2445
|
-
var
|
|
2446
|
-
|
|
2447
|
-
dispatch =
|
|
2846
|
+
var _useGlobalReducer27 = useGlobalReducer(),
|
|
2847
|
+
_useGlobalReducer28 = _slicedToArray(_useGlobalReducer27, 2),
|
|
2848
|
+
dispatch = _useGlobalReducer28[1];
|
|
2448
2849
|
var config = useConfig();
|
|
2449
2850
|
var passwordOptions = config.passwordOptions;
|
|
2450
2851
|
var _usePasswordInput2 = usePasswordInput(),
|
|
@@ -2459,13 +2860,13 @@ var PasswordsEmailForm = function PasswordsEmailForm() {
|
|
|
2459
2860
|
isSubmitting = _usePasswordInput2.isSubmitting,
|
|
2460
2861
|
setIsSubmitting = _usePasswordInput2.setIsSubmitting,
|
|
2461
2862
|
submitPassword = _usePasswordInput2.submitPassword,
|
|
2863
|
+
submitDiscoveryPassword = _usePasswordInput2.submitDiscoveryPassword,
|
|
2462
2864
|
handleNonMemberReset = _usePasswordInput2.handleNonMemberReset;
|
|
2463
|
-
var _extractErrorMessage$26 = extractErrorMessage.h(!email),
|
|
2865
|
+
var _extractErrorMessage$26 = extractErrorMessage.h(!!organization && !email),
|
|
2464
2866
|
_extractErrorMessage$27 = _slicedToArray(_extractErrorMessage$26, 2),
|
|
2465
2867
|
hideInput = _extractErrorMessage$27[0],
|
|
2466
2868
|
setHideInput = _extractErrorMessage$27[1];
|
|
2467
2869
|
if (!passwordOptions) return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
2468
|
-
if (!organization) return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
2469
2870
|
var handleSubmit = function handleSubmit(e) {
|
|
2470
2871
|
return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
2471
2872
|
var organization_id;
|
|
@@ -2473,25 +2874,29 @@ var PasswordsEmailForm = function PasswordsEmailForm() {
|
|
|
2473
2874
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2474
2875
|
case 0:
|
|
2475
2876
|
e.preventDefault();
|
|
2877
|
+
if (!organization) {
|
|
2878
|
+
_context5.next = 14;
|
|
2879
|
+
break;
|
|
2880
|
+
}
|
|
2476
2881
|
organization_id = organization.organization_id;
|
|
2477
2882
|
if (hideInput) {
|
|
2478
|
-
_context5.next =
|
|
2883
|
+
_context5.next = 6;
|
|
2479
2884
|
break;
|
|
2480
2885
|
}
|
|
2481
2886
|
submitPassword(organization_id);
|
|
2482
2887
|
return _context5.abrupt("return");
|
|
2483
|
-
case
|
|
2888
|
+
case 6:
|
|
2484
2889
|
if (email.match(internal.EMAIL_REGEX)) {
|
|
2485
|
-
_context5.next =
|
|
2890
|
+
_context5.next = 9;
|
|
2486
2891
|
break;
|
|
2487
2892
|
}
|
|
2488
2893
|
setErrorMessage('Invalid email address');
|
|
2489
2894
|
return _context5.abrupt("return");
|
|
2490
|
-
case
|
|
2895
|
+
case 9:
|
|
2491
2896
|
setErrorMessage('');
|
|
2492
2897
|
setIsSubmitting(true);
|
|
2493
|
-
internal.readB2BInternals(stytch).searchManager.searchMember(email, organization.organization_id).then(function (
|
|
2494
|
-
var member =
|
|
2898
|
+
internal.readB2BInternals(stytch).searchManager.searchMember(email, organization.organization_id).then(function (_ref62) {
|
|
2899
|
+
var member = _ref62.member;
|
|
2495
2900
|
if (member === null || member === void 0 ? void 0 : member.member_password_id) {
|
|
2496
2901
|
setHideInput(false);
|
|
2497
2902
|
setIsSubmitting(false);
|
|
@@ -2510,7 +2915,11 @@ var PasswordsEmailForm = function PasswordsEmailForm() {
|
|
|
2510
2915
|
}
|
|
2511
2916
|
setErrorMessage(message);
|
|
2512
2917
|
});
|
|
2513
|
-
|
|
2918
|
+
_context5.next = 15;
|
|
2919
|
+
break;
|
|
2920
|
+
case 14:
|
|
2921
|
+
submitDiscoveryPassword();
|
|
2922
|
+
case 15:
|
|
2514
2923
|
case "end":
|
|
2515
2924
|
return _context5.stop();
|
|
2516
2925
|
}
|
|
@@ -2676,29 +3085,6 @@ var GithubIconSvg = function GithubIconSvg() {
|
|
|
2676
3085
|
}));
|
|
2677
3086
|
};
|
|
2678
3087
|
var GitHubIcon = CreateIcon(GithubIconSvg);
|
|
2679
|
-
var getParamsFromB2BOAuthProviderConfig = function getParamsFromB2BOAuthProviderConfig(provider) {
|
|
2680
|
-
var providerType = '';
|
|
2681
|
-
var oneTap = false;
|
|
2682
|
-
var customScopes = [];
|
|
2683
|
-
var providerParams = {};
|
|
2684
|
-
if (typeof provider === 'string') {
|
|
2685
|
-
providerType = provider;
|
|
2686
|
-
} else {
|
|
2687
|
-
providerType = provider.type;
|
|
2688
|
-
if (provider.type === internal.B2BOAuthProviders.Google && 'one_tap' in provider) {
|
|
2689
|
-
oneTap = provider.one_tap;
|
|
2690
|
-
}
|
|
2691
|
-
customScopes = provider.customScopes || [];
|
|
2692
|
-
providerParams = provider.providerParams || {};
|
|
2693
|
-
}
|
|
2694
|
-
var oauthProvider = providerType;
|
|
2695
|
-
return {
|
|
2696
|
-
type: oauthProvider,
|
|
2697
|
-
one_tap: oneTap,
|
|
2698
|
-
customScopes: customScopes,
|
|
2699
|
-
providerParams: providerParams
|
|
2700
|
-
};
|
|
2701
|
-
};
|
|
2702
3088
|
var useIsOnlyFloatingOneTap = function useIsOnlyFloatingOneTap() {
|
|
2703
3089
|
var config = useConfig();
|
|
2704
3090
|
var isOnlyFloatingOneTap = extractErrorMessage.F(function () {
|
|
@@ -2720,9 +3106,9 @@ var useIsUnmounted = function useIsUnmounted() {
|
|
|
2720
3106
|
};
|
|
2721
3107
|
var OAuthB2BButton = function OAuthB2BButton(props) {
|
|
2722
3108
|
var stytchClient = useStytch();
|
|
2723
|
-
var
|
|
2724
|
-
|
|
2725
|
-
state =
|
|
3109
|
+
var _useGlobalReducer29 = useGlobalReducer(),
|
|
3110
|
+
_useGlobalReducer30 = _slicedToArray(_useGlobalReducer29, 1),
|
|
3111
|
+
state = _useGlobalReducer30[0];
|
|
2726
3112
|
var onButtonClick = function onButtonClick() {
|
|
2727
3113
|
if (state.flowState.organization) {
|
|
2728
3114
|
return stytchClient.oauth[props.providerType].start({
|
|
@@ -2754,8 +3140,8 @@ var OAuthB2BButton = function OAuthB2BButton(props) {
|
|
|
2754
3140
|
}
|
|
2755
3141
|
}, "Continue with ", props.providerTypeTitle)));
|
|
2756
3142
|
};
|
|
2757
|
-
var OAuthErrorMessage = function OAuthErrorMessage(
|
|
2758
|
-
var children =
|
|
3143
|
+
var OAuthErrorMessage = function OAuthErrorMessage(_ref63) {
|
|
3144
|
+
var children = _ref63.children;
|
|
2759
3145
|
return /*#__PURE__*/extractErrorMessage.wn.createElement("div", {
|
|
2760
3146
|
key: "oauth-error-message"
|
|
2761
3147
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
@@ -2767,9 +3153,9 @@ var OneTapNoConfiguredClientsErrorMessage = function OneTapNoConfiguredClientsEr
|
|
|
2767
3153
|
href: "https://stytch.com/dashboard/oauth"
|
|
2768
3154
|
}, "dashboard."));
|
|
2769
3155
|
};
|
|
2770
|
-
var RedirectUrlsErrorMessage = function RedirectUrlsErrorMessage(
|
|
2771
|
-
var niceName =
|
|
2772
|
-
variableName =
|
|
3156
|
+
var RedirectUrlsErrorMessage = function RedirectUrlsErrorMessage(_ref64) {
|
|
3157
|
+
var niceName = _ref64.niceName,
|
|
3158
|
+
variableName = _ref64.variableName;
|
|
2773
3159
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(OAuthErrorMessage, null, "One Tap cannot render because there are no ", niceName, " set for this project so we are unable to verify the", ' ', /*#__PURE__*/extractErrorMessage.wn.createElement("code", null, variableName), "\xA0 provided in the configuration. To set ", niceName, " for this project please visit\xA0", /*#__PURE__*/extractErrorMessage.wn.createElement("a", {
|
|
2774
3160
|
href: "https://stytch.com/docs/javascript-sdk"
|
|
2775
3161
|
}, "the Stytch dashboard."), "\xA0 For more information on why this validation is necessary please visit\xA0", /*#__PURE__*/extractErrorMessage.wn.createElement("a", {
|
|
@@ -2829,10 +3215,10 @@ var B2BGoogleOneTap = function B2BGoogleOneTap() {
|
|
|
2829
3215
|
oneTapError = _extractErrorMessage$29[0],
|
|
2830
3216
|
setOneTapError = _extractErrorMessage$29[1];
|
|
2831
3217
|
var isUnmounted = useIsUnmounted();
|
|
2832
|
-
var
|
|
2833
|
-
|
|
2834
|
-
state =
|
|
2835
|
-
dispatch =
|
|
3218
|
+
var _useGlobalReducer31 = useGlobalReducer(),
|
|
3219
|
+
_useGlobalReducer32 = _slicedToArray(_useGlobalReducer31, 2),
|
|
3220
|
+
state = _useGlobalReducer32[0],
|
|
3221
|
+
dispatch = _useGlobalReducer32[1];
|
|
2836
3222
|
var attemptToLoadOneTap = extractErrorMessage.T(function () {
|
|
2837
3223
|
return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
2838
3224
|
var _g, _h, _j, _internal$readB2BInte, oneTap, clientResult, client, oneTapCallback, renderResult;
|
|
@@ -2947,145 +3333,10 @@ var B2BGoogleOneTap = function B2BGoogleOneTap() {
|
|
|
2947
3333
|
});
|
|
2948
3334
|
var _internal$readB2BInte2 = internal.readB2BInternals(stytch),
|
|
2949
3335
|
publicToken = _internal$readB2BInte2.publicToken;
|
|
2950
|
-
if (oneTapError !== OneTapErrors.None) {
|
|
2951
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, internal.isTestPublicToken(publicToken) ? ErrorMessages[oneTapError] : null, googleAuthButton);
|
|
2952
|
-
}
|
|
2953
|
-
return googleAuthButton;
|
|
2954
|
-
};
|
|
2955
|
-
var productsToAuthMethods = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, internal.B2BProducts.oauth, undefined), internal.B2BProducts.sso, 'sso'), internal.B2BProducts.emailMagicLinks, 'magic_link'), internal.B2BProducts.passwords, 'password');
|
|
2956
|
-
var oauthProvidersToAuthMethods = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, internal.B2BOAuthProviders.Google, 'google_oauth'), internal.B2BOAuthProviders.Microsoft, 'microsoft_oauth'), internal.B2BOAuthProviders.HubSpot, 'hubspot_oauth'), internal.B2BOAuthProviders.Slack, 'slack_oauth'), internal.B2BOAuthProviders.GitHub, 'github_oauth');
|
|
2957
|
-
var authMethodsToProducts = Object.entries(productsToAuthMethods).reduce(function (acc, _ref57) {
|
|
2958
|
-
var _ref58 = _slicedToArray(_ref57, 2),
|
|
2959
|
-
product = _ref58[0],
|
|
2960
|
-
method = _ref58[1];
|
|
2961
|
-
if (method) {
|
|
2962
|
-
acc[method] = product;
|
|
2963
|
-
}
|
|
2964
|
-
return acc;
|
|
2965
|
-
}, {});
|
|
2966
|
-
var oauthMethodsToOauthProviders = Object.entries(oauthProvidersToAuthMethods).reduce(function (acc, _ref59) {
|
|
2967
|
-
var _ref60 = _slicedToArray(_ref59, 2),
|
|
2968
|
-
provider = _ref60[0],
|
|
2969
|
-
method = _ref60[1];
|
|
2970
|
-
acc[method] = provider;
|
|
2971
|
-
return acc;
|
|
2972
|
-
}, {});
|
|
2973
|
-
var oauthProviderToAuthMethod = function oauthProviderToAuthMethod(provider) {
|
|
2974
|
-
return oauthProvidersToAuthMethods[provider];
|
|
2975
|
-
};
|
|
2976
|
-
var oauthMethodToOauthProvider = function oauthMethodToOauthProvider(authMethod) {
|
|
2977
|
-
return oauthMethodsToOauthProviders[authMethod];
|
|
2978
|
-
};
|
|
2979
|
-
var productToAuthMethod = function productToAuthMethod(product) {
|
|
2980
|
-
return productsToAuthMethods[product];
|
|
2981
|
-
};
|
|
2982
|
-
var authMethodToProduct = function authMethodToProduct(authMethod) {
|
|
2983
|
-
if (authMethod in oauthMethodsToOauthProviders) {
|
|
2984
|
-
return internal.B2BProducts.oauth;
|
|
2985
|
-
}
|
|
2986
|
-
return authMethodsToProducts[authMethod];
|
|
2987
|
-
};
|
|
2988
|
-
var allProducts = Object.keys(productsToAuthMethods);
|
|
2989
|
-
var allOauthProviders = Object.values(internal.B2BOAuthProviders);
|
|
2990
|
-
var flattenConfigToAuthMethods = function flattenConfigToAuthMethods(products, oauthProviders) {
|
|
2991
|
-
return products.reduce(function (acc, product) {
|
|
2992
|
-
if (product === internal.B2BProducts.oauth) {
|
|
2993
|
-
oauthProviders.forEach(function (provider) {
|
|
2994
|
-
var authMethod = oauthProviderToAuthMethod(typeof provider === 'string' ? provider : provider.type);
|
|
2995
|
-
if (authMethod) {
|
|
2996
|
-
acc.push(authMethod);
|
|
2997
|
-
}
|
|
2998
|
-
});
|
|
2999
|
-
} else {
|
|
3000
|
-
var authMethod = productToAuthMethod(product);
|
|
3001
|
-
if (authMethod) {
|
|
3002
|
-
acc.push(authMethod);
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
return acc;
|
|
3006
|
-
}, []);
|
|
3007
|
-
};
|
|
3008
|
-
var useOAuthProviderConfigs = function useOAuthProviderConfigs() {
|
|
3009
|
-
var _a;
|
|
3010
|
-
var config = useConfig();
|
|
3011
|
-
return extractErrorMessage.F(function () {
|
|
3012
|
-
var _a;
|
|
3013
|
-
if (!((_a = config.oauthOptions) === null || _a === void 0 ? void 0 : _a.providers)) {
|
|
3014
|
-
return [];
|
|
3015
|
-
}
|
|
3016
|
-
return config.oauthOptions.providers.map(getParamsFromB2BOAuthProviderConfig);
|
|
3017
|
-
}, [(_a = config.oauthOptions) === null || _a === void 0 ? void 0 : _a.providers]);
|
|
3018
|
-
};
|
|
3019
|
-
var useRestrictedAuthMethods = function useRestrictedAuthMethods() {
|
|
3020
|
-
var _a, _b;
|
|
3021
|
-
var _useGlobalReducer21 = useGlobalReducer(),
|
|
3022
|
-
_useGlobalReducer22 = _slicedToArray(_useGlobalReducer21, 1),
|
|
3023
|
-
state = _useGlobalReducer22[0];
|
|
3024
|
-
var primaryAuthMethods = state.primary.primaryAuthMethods;
|
|
3025
|
-
var hasPrimaryAuthMethods = !!primaryAuthMethods;
|
|
3026
|
-
var restrictedAuthMethods = extractErrorMessage.F(function () {
|
|
3027
|
-
var _a, _b, _c;
|
|
3028
|
-
if (state.primary.primaryAuthMethods) {
|
|
3029
|
-
return new Set(state.primary.primaryAuthMethods);
|
|
3030
|
-
}
|
|
3031
|
-
if (((_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods) === 'RESTRICTED') {
|
|
3032
|
-
return new Set((_c = (_b = state.flowState.organization) === null || _b === void 0 ? void 0 : _b.allowed_auth_methods) !== null && _c !== void 0 ? _c : []);
|
|
3033
|
-
}
|
|
3034
|
-
}, [(_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.allowed_auth_methods, (_b = state.flowState.organization) === null || _b === void 0 ? void 0 : _b.auth_methods, state.primary.primaryAuthMethods]);
|
|
3035
|
-
return {
|
|
3036
|
-
restrictedAuthMethods: restrictedAuthMethods,
|
|
3037
|
-
hasPrimaryAuthMethods: hasPrimaryAuthMethods
|
|
3038
|
-
};
|
|
3039
|
-
};
|
|
3040
|
-
var useEffectiveAuthConfig = function useEffectiveAuthConfig() {
|
|
3041
|
-
var _a;
|
|
3042
|
-
var _useGlobalReducer23 = useGlobalReducer(),
|
|
3043
|
-
_useGlobalReducer24 = _slicedToArray(_useGlobalReducer23, 1),
|
|
3044
|
-
state = _useGlobalReducer24[0];
|
|
3045
|
-
var config = useConfig();
|
|
3046
|
-
var _useRestrictedAuthMet = useRestrictedAuthMethods(),
|
|
3047
|
-
restrictedAuthMethods = _useRestrictedAuthMet.restrictedAuthMethods,
|
|
3048
|
-
hasPrimaryAuthMethods = _useRestrictedAuthMet.hasPrimaryAuthMethods;
|
|
3049
|
-
var oauthProviderConfigs = useOAuthProviderConfigs();
|
|
3050
|
-
var flattenedConfiguredAuthMethods = extractErrorMessage.F(function () {
|
|
3051
|
-
return flattenConfigToAuthMethods(config.products, oauthProviderConfigs);
|
|
3052
|
-
}, [config.products, oauthProviderConfigs]);
|
|
3053
|
-
var authMethodsToShow = extractErrorMessage.F(function () {
|
|
3054
|
-
var _a;
|
|
3055
|
-
if (!restrictedAuthMethods) {
|
|
3056
|
-
return flattenedConfiguredAuthMethods;
|
|
3057
|
-
}
|
|
3058
|
-
var restrictedAuthMethodsInUiConfig = flattenedConfiguredAuthMethods.filter(function (authMethod) {
|
|
3059
|
-
return restrictedAuthMethods.has(authMethod);
|
|
3060
|
-
});
|
|
3061
|
-
if (restrictedAuthMethodsInUiConfig.length > 0 || !hasPrimaryAuthMethods) {
|
|
3062
|
-
return restrictedAuthMethodsInUiConfig;
|
|
3063
|
-
}
|
|
3064
|
-
if (((_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods) === 'RESTRICTED') {
|
|
3065
|
-
return flattenConfigToAuthMethods(allProducts, allOauthProviders).filter(function (authMethod) {
|
|
3066
|
-
return restrictedAuthMethods.has(authMethod);
|
|
3067
|
-
});
|
|
3068
|
-
}
|
|
3069
|
-
return ['magic_link'];
|
|
3070
|
-
}, [flattenedConfiguredAuthMethods, hasPrimaryAuthMethods, restrictedAuthMethods, (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods]);
|
|
3071
|
-
var products = extractErrorMessage.F(function () {
|
|
3072
|
-
return _toConsumableArray(new Set(authMethodsToShow.map(authMethodToProduct).filter(extractErrorMessage.isTruthy)));
|
|
3073
|
-
}, [authMethodsToShow]);
|
|
3074
|
-
var oauthProviderSettings = extractErrorMessage.F(function () {
|
|
3075
|
-
return authMethodsToShow.map(function (authMethod) {
|
|
3076
|
-
var _a;
|
|
3077
|
-
var provider = oauthMethodToOauthProvider(authMethod);
|
|
3078
|
-
if (provider) {
|
|
3079
|
-
return (_a = oauthProviderConfigs.find(function (oauthProvider) {
|
|
3080
|
-
return oauthProvider.type === provider;
|
|
3081
|
-
})) !== null && _a !== void 0 ? _a : getParamsFromB2BOAuthProviderConfig(provider);
|
|
3082
|
-
}
|
|
3083
|
-
}).filter(extractErrorMessage.isTruthy);
|
|
3084
|
-
}, [authMethodsToShow, oauthProviderConfigs]);
|
|
3085
|
-
return {
|
|
3086
|
-
products: products,
|
|
3087
|
-
oauthProviderSettings: oauthProviderSettings
|
|
3088
|
-
};
|
|
3336
|
+
if (oneTapError !== OneTapErrors.None) {
|
|
3337
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, internal.isTestPublicToken(publicToken) ? ErrorMessages[oneTapError] : null, googleAuthButton);
|
|
3338
|
+
}
|
|
3339
|
+
return googleAuthButton;
|
|
3089
3340
|
};
|
|
3090
3341
|
var getProviderInfo = function getProviderInfo(provider) {
|
|
3091
3342
|
switch (provider) {
|
|
@@ -3142,18 +3393,18 @@ var getProviderParamsForProvider = function getProviderParamsForProvider(oauthPr
|
|
|
3142
3393
|
};
|
|
3143
3394
|
var OAuthButtons = function OAuthButtons() {
|
|
3144
3395
|
var _a;
|
|
3145
|
-
var
|
|
3146
|
-
|
|
3147
|
-
state =
|
|
3148
|
-
var
|
|
3149
|
-
oauthProviderSettings =
|
|
3396
|
+
var _useGlobalReducer33 = useGlobalReducer(),
|
|
3397
|
+
_useGlobalReducer34 = _slicedToArray(_useGlobalReducer33, 1),
|
|
3398
|
+
state = _useGlobalReducer34[0];
|
|
3399
|
+
var _useEffectiveAuthConf3 = useEffectiveAuthConfig(),
|
|
3400
|
+
oauthProviderSettings = _useEffectiveAuthConf3.oauthProviderSettings;
|
|
3150
3401
|
var config = useConfig();
|
|
3151
|
-
var
|
|
3152
|
-
loginRedirectURL =
|
|
3153
|
-
signupRedirectURL =
|
|
3154
|
-
discoveryRedirectURL =
|
|
3155
|
-
customScopes =
|
|
3156
|
-
providerParams =
|
|
3402
|
+
var _ref65 = (_a = config.oauthOptions) !== null && _a !== void 0 ? _a : {},
|
|
3403
|
+
loginRedirectURL = _ref65.loginRedirectURL,
|
|
3404
|
+
signupRedirectURL = _ref65.signupRedirectURL,
|
|
3405
|
+
discoveryRedirectURL = _ref65.discoveryRedirectURL,
|
|
3406
|
+
customScopes = _ref65.customScopes,
|
|
3407
|
+
providerParams = _ref65.providerParams;
|
|
3157
3408
|
var mappedProviders = oauthProviderSettings.map(function (oauthProvider) {
|
|
3158
3409
|
var _getProviderInfo = getProviderInfo(oauthProvider.type),
|
|
3159
3410
|
icon = _getProviderInfo.icon,
|
|
@@ -3183,9 +3434,9 @@ var OAuthButtons = function OAuthButtons() {
|
|
|
3183
3434
|
};
|
|
3184
3435
|
var UsePasswordText = extractErrorMessage.He(Text)(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n font-weight: bold !important;\n cursor: pointer;\n"])));
|
|
3185
3436
|
var PasswordUseButton = function PasswordUseButton() {
|
|
3186
|
-
var
|
|
3187
|
-
|
|
3188
|
-
dispatch =
|
|
3437
|
+
var _useGlobalReducer35 = useGlobalReducer(),
|
|
3438
|
+
_useGlobalReducer36 = _slicedToArray(_useGlobalReducer35, 2),
|
|
3439
|
+
dispatch = _useGlobalReducer36[1];
|
|
3189
3440
|
var handleUsePassword = function handleUsePassword() {
|
|
3190
3441
|
dispatch({
|
|
3191
3442
|
type: 'transition',
|
|
@@ -3200,56 +3451,68 @@ var PasswordUseButton = function PasswordUseButton() {
|
|
|
3200
3451
|
};
|
|
3201
3452
|
var Component;
|
|
3202
3453
|
(function (Component) {
|
|
3203
|
-
Component["
|
|
3204
|
-
Component["
|
|
3454
|
+
Component["EmailForm"] = "EmailForm";
|
|
3455
|
+
Component["EmailDiscoveryForm"] = "EmailDiscoveryForm";
|
|
3205
3456
|
Component["OAuthButtons"] = "OAuthButtons";
|
|
3206
3457
|
Component["SSOButtons"] = "SSOButtons";
|
|
3207
3458
|
Component["PasswordsEmailForm"] = "PasswordsEmailForm";
|
|
3208
|
-
Component["
|
|
3459
|
+
Component["PasswordEmailCombined"] = "PasswordEmailCombined";
|
|
3460
|
+
Component["PasswordEmailCombinedDiscovery"] = "PasswordEmailCombinedDiscovery";
|
|
3209
3461
|
Component["Divider"] = "Divider";
|
|
3210
3462
|
})(Component || (Component = {}));
|
|
3211
3463
|
var generateProductComponentsOrdering = function generateProductComponentsOrdering(products, flowState) {
|
|
3212
3464
|
var flowStateType = flowState.type;
|
|
3213
|
-
var
|
|
3214
|
-
var
|
|
3465
|
+
var productsSet = new Set(products);
|
|
3466
|
+
var displayEmailAndPasswordsTogether = (productsSet.has(internal.B2BProducts.emailMagicLinks) || productsSet.has(internal.B2BProducts.emailOtp)) && productsSet.has(internal.B2BProducts.passwords);
|
|
3467
|
+
var productComponentsSet = products.reduce(function (components, product) {
|
|
3215
3468
|
var _a, _b, _c;
|
|
3216
3469
|
switch (product) {
|
|
3217
3470
|
case internal.B2BProducts.emailMagicLinks:
|
|
3218
|
-
|
|
3219
|
-
|
|
3471
|
+
case internal.B2BProducts.emailOtp:
|
|
3472
|
+
if (!displayEmailAndPasswordsTogether) {
|
|
3473
|
+
components.add(flowStateType === internal.AuthFlowType.Organization ? Component.EmailForm : Component.EmailDiscoveryForm);
|
|
3474
|
+
}
|
|
3475
|
+
break;
|
|
3220
3476
|
case internal.B2BProducts.oauth:
|
|
3221
|
-
|
|
3477
|
+
components.add(Component.OAuthButtons);
|
|
3478
|
+
break;
|
|
3222
3479
|
case internal.B2BProducts.sso:
|
|
3223
3480
|
var isSsoValid = ((_c = (_b = (_a = flowState.organization) === null || _a === void 0 ? void 0 : _a.sso_active_connections) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0;
|
|
3224
|
-
|
|
3481
|
+
if (flowStateType === internal.AuthFlowType.Organization && isSsoValid) {
|
|
3482
|
+
components.add(Component.SSOButtons);
|
|
3483
|
+
}
|
|
3484
|
+
break;
|
|
3225
3485
|
case internal.B2BProducts.passwords:
|
|
3226
|
-
if (
|
|
3227
|
-
|
|
3486
|
+
if (!displayEmailAndPasswordsTogether) {
|
|
3487
|
+
components.add(Component.PasswordsEmailForm);
|
|
3488
|
+
}
|
|
3489
|
+
break;
|
|
3228
3490
|
}
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
if (
|
|
3491
|
+
return components;
|
|
3492
|
+
}, new Set());
|
|
3493
|
+
var productComponents = Array.from(productComponentsSet);
|
|
3494
|
+
if (displayEmailAndPasswordsTogether) {
|
|
3233
3495
|
var passwordIndex = products.indexOf(internal.B2BProducts.passwords);
|
|
3234
3496
|
var emlIndex = products.indexOf(internal.B2BProducts.emailMagicLinks);
|
|
3235
|
-
var
|
|
3236
|
-
var
|
|
3237
|
-
|
|
3497
|
+
var otpIndex = products.indexOf(internal.B2BProducts.emailOtp);
|
|
3498
|
+
var firstProductIndex = Math.min(passwordIndex, emlIndex, otpIndex);
|
|
3499
|
+
var combinedComponent = flowStateType === internal.AuthFlowType.Organization ? Component.PasswordEmailCombined : Component.PasswordEmailCombinedDiscovery;
|
|
3500
|
+
productComponents.splice(firstProductIndex, 0, combinedComponent);
|
|
3238
3501
|
}
|
|
3239
|
-
var hasButtons =
|
|
3240
|
-
var hasInput =
|
|
3502
|
+
var hasButtons = productComponentsSet.has(Component.OAuthButtons) || productComponentsSet.has(Component.SSOButtons);
|
|
3503
|
+
var hasInput = productsSet.has(internal.B2BProducts.emailMagicLinks) || productsSet.has(internal.B2BProducts.passwords);
|
|
3241
3504
|
var showDivider = hasButtons && hasInput;
|
|
3242
|
-
if (
|
|
3243
|
-
|
|
3505
|
+
if (productComponents.length > 1 && showDivider) {
|
|
3506
|
+
productComponents.splice(productComponents.length - 1, 0, Component.Divider);
|
|
3244
3507
|
}
|
|
3245
|
-
return
|
|
3508
|
+
return productComponents;
|
|
3246
3509
|
};
|
|
3247
3510
|
var Container$1 = extractErrorMessage.He(Flex)(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n > * + * {\n margin-top: 24px;\n }\n"])));
|
|
3248
3511
|
var LogoImage$1 = extractErrorMessage.He.img(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n max-height: 50px;\n max-width: 100px;\n"])));
|
|
3249
3512
|
var Header = extractErrorMessage.He(Text)(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["\n text-align: center;\n"])));
|
|
3250
|
-
var Logo$1 = function Logo$1(
|
|
3251
|
-
var orgLogo =
|
|
3252
|
-
appLogo =
|
|
3513
|
+
var Logo$1 = function Logo$1(_ref66) {
|
|
3514
|
+
var orgLogo = _ref66.orgLogo,
|
|
3515
|
+
appLogo = _ref66.appLogo;
|
|
3253
3516
|
if (orgLogo !== '' && appLogo !== '') return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
3254
3517
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
3255
3518
|
justifyContent: "center",
|
|
@@ -3260,16 +3523,16 @@ var Logo$1 = function Logo$1(_ref62) {
|
|
|
3260
3523
|
src: appLogo
|
|
3261
3524
|
}));
|
|
3262
3525
|
};
|
|
3263
|
-
var ProductComponents = function ProductComponents(
|
|
3264
|
-
var components =
|
|
3526
|
+
var ProductComponents = function ProductComponents(_ref67) {
|
|
3527
|
+
var components = _ref67.components;
|
|
3265
3528
|
var renderedComponents = components.map(function (component) {
|
|
3266
3529
|
switch (component) {
|
|
3267
|
-
case Component.
|
|
3268
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(
|
|
3530
|
+
case Component.EmailForm:
|
|
3531
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(EmailForm, {
|
|
3269
3532
|
key: component
|
|
3270
3533
|
});
|
|
3271
|
-
case Component.
|
|
3272
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(
|
|
3534
|
+
case Component.EmailDiscoveryForm:
|
|
3535
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(EmailDiscoveryForm, {
|
|
3273
3536
|
key: component
|
|
3274
3537
|
});
|
|
3275
3538
|
case Component.OAuthButtons:
|
|
@@ -3284,13 +3547,23 @@ var ProductComponents = function ProductComponents(_ref63) {
|
|
|
3284
3547
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordsEmailForm, {
|
|
3285
3548
|
key: component
|
|
3286
3549
|
});
|
|
3287
|
-
case Component.
|
|
3550
|
+
case Component.PasswordEmailCombined:
|
|
3551
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
3552
|
+
key: "email_password",
|
|
3553
|
+
direction: "column",
|
|
3554
|
+
gap: 12
|
|
3555
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailForm, {
|
|
3556
|
+
key: "email"
|
|
3557
|
+
}), /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordUseButton, {
|
|
3558
|
+
key: "password"
|
|
3559
|
+
}));
|
|
3560
|
+
case Component.PasswordEmailCombinedDiscovery:
|
|
3288
3561
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
3289
|
-
key: "
|
|
3562
|
+
key: "email_password_discovery",
|
|
3290
3563
|
direction: "column",
|
|
3291
3564
|
gap: 12
|
|
3292
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(
|
|
3293
|
-
key: "
|
|
3565
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailDiscoveryForm, {
|
|
3566
|
+
key: "email"
|
|
3294
3567
|
}), /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordUseButton, {
|
|
3295
3568
|
key: "password"
|
|
3296
3569
|
}));
|
|
@@ -3307,15 +3580,15 @@ var MainScreen = function MainScreen() {
|
|
|
3307
3580
|
var _extractErrorMessage$30 = extractErrorMessage.Ze(),
|
|
3308
3581
|
displayHeader = _extractErrorMessage$30.displayHeader,
|
|
3309
3582
|
logo = _extractErrorMessage$30.logo;
|
|
3310
|
-
var
|
|
3311
|
-
|
|
3312
|
-
state =
|
|
3583
|
+
var _useGlobalReducer37 = useGlobalReducer(),
|
|
3584
|
+
_useGlobalReducer38 = _slicedToArray(_useGlobalReducer37, 1),
|
|
3585
|
+
state = _useGlobalReducer38[0];
|
|
3313
3586
|
var _state$primary = state.primary,
|
|
3314
3587
|
primaryAuthMethods = _state$primary.primaryAuthMethods,
|
|
3315
3588
|
email = _state$primary.email,
|
|
3316
3589
|
emailVerified = _state$primary.emailVerified;
|
|
3317
|
-
var
|
|
3318
|
-
products =
|
|
3590
|
+
var _useEffectiveAuthConf4 = useEffectiveAuthConfig(),
|
|
3591
|
+
products = _useEffectiveAuthConf4.products;
|
|
3319
3592
|
var ProductComponentsOrdering = generateProductComponentsOrdering(products, state.flowState);
|
|
3320
3593
|
var title;
|
|
3321
3594
|
switch (state.flowState.type) {
|
|
@@ -3452,10 +3725,10 @@ var inboxLinks$1 = function inboxLinks$1(emailDomain) {
|
|
|
3452
3725
|
var Link$1 = extractErrorMessage.He.a(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["\n all: unset;\n cursor: pointer;\n\n &:hover {\n text-decoration: underline;\n text-decoration-color: ", ";\n }\n"])), function (props) {
|
|
3453
3726
|
return props.theme.colors.primary;
|
|
3454
3727
|
});
|
|
3455
|
-
var EmailProviderLink$1 = function EmailProviderLink$1(
|
|
3456
|
-
var label =
|
|
3457
|
-
href =
|
|
3458
|
-
Icon =
|
|
3728
|
+
var EmailProviderLink$1 = function EmailProviderLink$1(_ref68) {
|
|
3729
|
+
var label = _ref68.label,
|
|
3730
|
+
href = _ref68.href,
|
|
3731
|
+
Icon = _ref68.Icon;
|
|
3459
3732
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
3460
3733
|
gap: 4
|
|
3461
3734
|
}, Icon, /*#__PURE__*/extractErrorMessage.wn.createElement(Link$1, {
|
|
@@ -3464,10 +3737,10 @@ var EmailProviderLink$1 = function EmailProviderLink$1(_ref64) {
|
|
|
3464
3737
|
rel: "noopener noreferrer"
|
|
3465
3738
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Open in ", label)));
|
|
3466
3739
|
};
|
|
3467
|
-
var EmailConfirmation$1 = function EmailConfirmation$1(
|
|
3468
|
-
var emailDomain =
|
|
3469
|
-
reset =
|
|
3470
|
-
email =
|
|
3740
|
+
var EmailConfirmation$1 = function EmailConfirmation$1(_ref69) {
|
|
3741
|
+
var emailDomain = _ref69.emailDomain,
|
|
3742
|
+
reset = _ref69.reset,
|
|
3743
|
+
email = _ref69.email;
|
|
3471
3744
|
var _inboxLinks$ = inboxLinks$1(emailDomain),
|
|
3472
3745
|
GMAIL = _inboxLinks$.GMAIL,
|
|
3473
3746
|
YAHOO = _inboxLinks$.YAHOO,
|
|
@@ -3513,8 +3786,8 @@ var useEmailDomain$1 = function useEmailDomain$1() {
|
|
|
3513
3786
|
emailDomains = _extractErrorMessage$32[0],
|
|
3514
3787
|
setEmailDomains = _extractErrorMessage$32[1];
|
|
3515
3788
|
extractErrorMessage.p(function () {
|
|
3516
|
-
internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (
|
|
3517
|
-
var emailDomains =
|
|
3789
|
+
internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref70) {
|
|
3790
|
+
var emailDomains = _ref70.emailDomains;
|
|
3518
3791
|
setEmailDomains(emailDomains);
|
|
3519
3792
|
});
|
|
3520
3793
|
}, [stytch]);
|
|
@@ -3527,14 +3800,14 @@ var useEmailDomain$1 = function useEmailDomain$1() {
|
|
|
3527
3800
|
return null;
|
|
3528
3801
|
};
|
|
3529
3802
|
var EmailConfirmation = function EmailConfirmation() {
|
|
3530
|
-
var
|
|
3531
|
-
|
|
3532
|
-
state =
|
|
3533
|
-
dispatch =
|
|
3803
|
+
var _useGlobalReducer39 = useGlobalReducer(),
|
|
3804
|
+
_useGlobalReducer40 = _slicedToArray(_useGlobalReducer39, 2),
|
|
3805
|
+
state = _useGlobalReducer40[0],
|
|
3806
|
+
dispatch = _useGlobalReducer40[1];
|
|
3534
3807
|
var emailDomain = useEmailDomain$1();
|
|
3535
3808
|
var reset = function reset() {
|
|
3536
3809
|
dispatch({
|
|
3537
|
-
type: '
|
|
3810
|
+
type: 'set_user_supplied_email',
|
|
3538
3811
|
email: ''
|
|
3539
3812
|
});
|
|
3540
3813
|
dispatch({
|
|
@@ -3545,7 +3818,7 @@ var EmailConfirmation = function EmailConfirmation() {
|
|
|
3545
3818
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(EmailConfirmation$1, {
|
|
3546
3819
|
emailDomain: emailDomain,
|
|
3547
3820
|
reset: reset,
|
|
3548
|
-
email: state.formState.
|
|
3821
|
+
email: state.formState.emailState.userSuppliedEmail
|
|
3549
3822
|
});
|
|
3550
3823
|
};
|
|
3551
3824
|
var LoggingInScreen = function LoggingInScreen() {
|
|
@@ -3573,23 +3846,23 @@ var LoadingScreen = function LoadingScreen() {
|
|
|
3573
3846
|
var isJoinViaJitType = function isJoinViaJitType(type) {
|
|
3574
3847
|
return type === 'eligible_to_join_by_email_domain' || type === 'eligible_to_join_by_oauth_tenant';
|
|
3575
3848
|
};
|
|
3576
|
-
var OrganizationsContainer = extractErrorMessage.He(Flex)(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n border: ", ";\n border-radius: ", ";\n > div + div {\n border-top: ", ";\n }\n"])), function (
|
|
3577
|
-
var theme =
|
|
3849
|
+
var OrganizationsContainer = extractErrorMessage.He(Flex)(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n border: ", ";\n border-radius: ", ";\n > div + div {\n border-top: ", ";\n }\n"])), function (_ref71) {
|
|
3850
|
+
var theme = _ref71.theme;
|
|
3578
3851
|
return theme.container.border;
|
|
3579
|
-
}, function (
|
|
3580
|
-
var theme =
|
|
3852
|
+
}, function (_ref72) {
|
|
3853
|
+
var theme = _ref72.theme;
|
|
3581
3854
|
return theme.container.borderRadius;
|
|
3582
|
-
}, function (
|
|
3583
|
-
var theme =
|
|
3855
|
+
}, function (_ref73) {
|
|
3856
|
+
var theme = _ref73.theme;
|
|
3584
3857
|
return theme.container.border;
|
|
3585
3858
|
});
|
|
3586
3859
|
var OrganizationsRow = extractErrorMessage.He(Flex)(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n cursor: pointer;\n gap: 8px;\n"])));
|
|
3587
3860
|
var LogoImage = extractErrorMessage.He.img(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n height: 40px;\n width: 40px;\n flex-shrink: 0;\n border-radius: 4px;\n"])));
|
|
3588
|
-
var LogoText = extractErrorMessage.He(Flex)(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n height: 40px;\n width: 40px;\n flex-shrink: 0;\n background-color: ", ";\n color: ", ";\n border-radius: 4px;\n\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 25px;\n"])), function (
|
|
3589
|
-
var theme =
|
|
3861
|
+
var LogoText = extractErrorMessage.He(Flex)(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n height: 40px;\n width: 40px;\n flex-shrink: 0;\n background-color: ", ";\n color: ", ";\n border-radius: 4px;\n\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 25px;\n"])), function (_ref74) {
|
|
3862
|
+
var theme = _ref74.theme;
|
|
3590
3863
|
return theme.buttons.primary.backgroundColor;
|
|
3591
|
-
}, function (
|
|
3592
|
-
var theme =
|
|
3864
|
+
}, function (_ref75) {
|
|
3865
|
+
var theme = _ref75.theme;
|
|
3593
3866
|
return theme.buttons.primary.textColor;
|
|
3594
3867
|
});
|
|
3595
3868
|
var SvgNoShrink = extractErrorMessage.He.svg(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n"])));
|
|
@@ -3605,9 +3878,9 @@ var RightArrowSVG = function RightArrowSVG() {
|
|
|
3605
3878
|
fill: "#19303D"
|
|
3606
3879
|
}));
|
|
3607
3880
|
};
|
|
3608
|
-
var Logo = function Logo(
|
|
3609
|
-
var name =
|
|
3610
|
-
logo =
|
|
3881
|
+
var Logo = function Logo(_ref76) {
|
|
3882
|
+
var name = _ref76.name,
|
|
3883
|
+
logo = _ref76.logo;
|
|
3611
3884
|
if (logo !== '') {
|
|
3612
3885
|
return /*#__PURE__*/extractErrorMessage.y(LogoImage, {
|
|
3613
3886
|
src: logo
|
|
@@ -3618,8 +3891,8 @@ var Logo = function Logo(_ref72) {
|
|
|
3618
3891
|
justifyContent: "center"
|
|
3619
3892
|
}, name[0]);
|
|
3620
3893
|
};
|
|
3621
|
-
var ArrowText = function ArrowText(
|
|
3622
|
-
var type =
|
|
3894
|
+
var ArrowText = function ArrowText(_ref77) {
|
|
3895
|
+
var type = _ref77.type;
|
|
3623
3896
|
if (isJoinViaJitType(type) || type === 'pending_member') return /*#__PURE__*/extractErrorMessage.y(Text, {
|
|
3624
3897
|
align: "right"
|
|
3625
3898
|
}, "Join");
|
|
@@ -3629,10 +3902,10 @@ var ArrowText = function ArrowText(_ref73) {
|
|
|
3629
3902
|
return /*#__PURE__*/extractErrorMessage.y(extractErrorMessage.g, null);
|
|
3630
3903
|
};
|
|
3631
3904
|
var DiscoverNoOrganizations = function DiscoverNoOrganizations() {
|
|
3632
|
-
var
|
|
3633
|
-
|
|
3634
|
-
state =
|
|
3635
|
-
dispatch =
|
|
3905
|
+
var _useGlobalReducer41 = useGlobalReducer(),
|
|
3906
|
+
_useGlobalReducer42 = _slicedToArray(_useGlobalReducer41, 2),
|
|
3907
|
+
state = _useGlobalReducer42[0],
|
|
3908
|
+
dispatch = _useGlobalReducer42[1];
|
|
3636
3909
|
var stytchClient = useStytch();
|
|
3637
3910
|
var config = useConfig();
|
|
3638
3911
|
var _useBootstrap = useBootstrap(),
|
|
@@ -3643,7 +3916,7 @@ var DiscoverNoOrganizations = function DiscoverNoOrganizations() {
|
|
|
3643
3916
|
screen: AppScreens$1.Main
|
|
3644
3917
|
});
|
|
3645
3918
|
};
|
|
3646
|
-
var
|
|
3919
|
+
var _useMutate2 = useMutate("stytch.discovery.organization.create", function () {
|
|
3647
3920
|
return stytchClient.discovery.organizations.create({
|
|
3648
3921
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
3649
3922
|
});
|
|
@@ -3658,8 +3931,8 @@ var DiscoverNoOrganizations = function DiscoverNoOrganizations() {
|
|
|
3658
3931
|
});
|
|
3659
3932
|
}
|
|
3660
3933
|
}),
|
|
3661
|
-
stytchCreateOrganization =
|
|
3662
|
-
isCreateLoading =
|
|
3934
|
+
stytchCreateOrganization = _useMutate2.trigger,
|
|
3935
|
+
isCreateLoading = _useMutate2.isMutating;
|
|
3663
3936
|
if (isCreateLoading) {
|
|
3664
3937
|
return /*#__PURE__*/extractErrorMessage.y(LoadingScreen, null);
|
|
3665
3938
|
}
|
|
@@ -3705,10 +3978,10 @@ var shouldAllowDirectLoginToOrganization = function shouldAllowDirectLoginToOrga
|
|
|
3705
3978
|
};
|
|
3706
3979
|
var Discovery = function Discovery() {
|
|
3707
3980
|
var _a;
|
|
3708
|
-
var
|
|
3709
|
-
|
|
3710
|
-
state =
|
|
3711
|
-
dispatch =
|
|
3981
|
+
var _useGlobalReducer43 = useGlobalReducer(),
|
|
3982
|
+
_useGlobalReducer44 = _slicedToArray(_useGlobalReducer43, 2),
|
|
3983
|
+
state = _useGlobalReducer44[0],
|
|
3984
|
+
dispatch = _useGlobalReducer44[1];
|
|
3712
3985
|
var stytchClient = useStytch();
|
|
3713
3986
|
var config = useConfig();
|
|
3714
3987
|
var shouldDirectLoginConfigEnabled = !!((_a = config.directLoginForSingleMembership) === null || _a === void 0 ? void 0 : _a.status);
|
|
@@ -3743,8 +4016,8 @@ var Discovery = function Discovery() {
|
|
|
3743
4016
|
connection_id: connectionId
|
|
3744
4017
|
});
|
|
3745
4018
|
}, [stytchClient]);
|
|
3746
|
-
var
|
|
3747
|
-
var organizationId =
|
|
4019
|
+
var _useMutate3 = useMutate("stytch.discovery.intermediateSessions.exchange", function (_, _ref78) {
|
|
4020
|
+
var organizationId = _ref78.arg.organizationId;
|
|
3748
4021
|
return stytchClient.discovery.intermediateSessions.exchange({
|
|
3749
4022
|
organization_id: organizationId,
|
|
3750
4023
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
@@ -3754,9 +4027,9 @@ var Discovery = function Discovery() {
|
|
|
3754
4027
|
onAuthenticateSuccess(data, dispatch, config);
|
|
3755
4028
|
}
|
|
3756
4029
|
}),
|
|
3757
|
-
stytchDiscoveryExchange =
|
|
3758
|
-
isExchangeLoading =
|
|
3759
|
-
var
|
|
4030
|
+
stytchDiscoveryExchange = _useMutate3.trigger,
|
|
4031
|
+
isExchangeLoading = _useMutate3.isMutating;
|
|
4032
|
+
var _useMutate4 = useMutate("stytch.discovery.organization.create", function () {
|
|
3760
4033
|
return stytchClient.discovery.organizations.create({
|
|
3761
4034
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
3762
4035
|
});
|
|
@@ -3771,8 +4044,8 @@ var Discovery = function Discovery() {
|
|
|
3771
4044
|
});
|
|
3772
4045
|
}
|
|
3773
4046
|
}),
|
|
3774
|
-
stytchCreateOrganization =
|
|
3775
|
-
isCreateLoading =
|
|
4047
|
+
stytchCreateOrganization = _useMutate4.trigger,
|
|
4048
|
+
isCreateLoading = _useMutate4.isMutating;
|
|
3776
4049
|
if (isExchangeLoading) {
|
|
3777
4050
|
return /*#__PURE__*/extractErrorMessage.y(LoggingInScreen, null);
|
|
3778
4051
|
}
|
|
@@ -3925,59 +4198,521 @@ var ConfirmationSVG = function ConfirmationSVG() {
|
|
|
3925
4198
|
stopOpacity: "0.26"
|
|
3926
4199
|
}))));
|
|
3927
4200
|
};
|
|
3928
|
-
var Confirmation = function Confirmation() {
|
|
3929
|
-
return /*#__PURE__*/extractErrorMessage.y(Flex, {
|
|
4201
|
+
var Confirmation = function Confirmation() {
|
|
4202
|
+
return /*#__PURE__*/extractErrorMessage.y(Flex, {
|
|
4203
|
+
direction: "column",
|
|
4204
|
+
gap: 24,
|
|
4205
|
+
alignItems: "center"
|
|
4206
|
+
}, /*#__PURE__*/extractErrorMessage.y(Text, {
|
|
4207
|
+
size: "header"
|
|
4208
|
+
}, "Success!"), /*#__PURE__*/extractErrorMessage.y(Text, null, "You have successfully logged in."), /*#__PURE__*/extractErrorMessage.y(ConfirmationSVG, null));
|
|
4209
|
+
};
|
|
4210
|
+
var useMountEffect = function useMountEffect(effect) {
|
|
4211
|
+
var effectRef = extractErrorMessage._(effect);
|
|
4212
|
+
extractErrorMessage.p(function () {
|
|
4213
|
+
return effectRef.current();
|
|
4214
|
+
}, []);
|
|
4215
|
+
};
|
|
4216
|
+
var ConfirmationScreen = function ConfirmationScreen() {
|
|
4217
|
+
var onEvent = useEventCallback();
|
|
4218
|
+
useMountEffect(function () {
|
|
4219
|
+
onEvent({
|
|
4220
|
+
type: internal.StytchEventType.AuthenticateFlowComplete,
|
|
4221
|
+
data: {}
|
|
4222
|
+
});
|
|
4223
|
+
});
|
|
4224
|
+
return /*#__PURE__*/extractErrorMessage.y(Confirmation, null);
|
|
4225
|
+
};
|
|
4226
|
+
var assertUnreachable = function assertUnreachable() {
|
|
4227
|
+
throw new Error('Assertion failure');
|
|
4228
|
+
};
|
|
4229
|
+
var Chevron = function Chevron() {
|
|
4230
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement("svg", {
|
|
4231
|
+
viewBox: "0 0 25 25",
|
|
4232
|
+
fill: "none",
|
|
4233
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4234
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
|
|
4235
|
+
d: "M9.09 7.91L13.67 12.5L9.09 17.09L10.5 18.5L16.5 12.5L10.5 6.5L9.09 7.91Z",
|
|
4236
|
+
fill: "currentColor"
|
|
4237
|
+
}));
|
|
4238
|
+
};
|
|
4239
|
+
var Chevron$1 = CreateIcon(Chevron);
|
|
4240
|
+
var StyledButton = extractErrorMessage.He.button(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n all: unset;\n color: ", ";\n cursor: pointer;\n padding: 20px 0;\n border-bottom: 1px solid #e5e8eb;\n font-weight: 500;\n display: flex;\n align-items: center;\n justify-content: space-between;\n"])), function (props) {
|
|
4241
|
+
return props.theme.colors.primary;
|
|
4242
|
+
});
|
|
4243
|
+
var MenuText = extractErrorMessage.He.div(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n"])));
|
|
4244
|
+
var ChevronContainer = extractErrorMessage.He.span(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
|
|
4245
|
+
var MenuButton = function MenuButton(_ref79) {
|
|
4246
|
+
var children = _ref79.children,
|
|
4247
|
+
disabled = _ref79.disabled,
|
|
4248
|
+
onClick = _ref79.onClick;
|
|
4249
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(StyledButton, {
|
|
4250
|
+
type: "button",
|
|
4251
|
+
onClick: onClick,
|
|
4252
|
+
disabled: disabled
|
|
4253
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(MenuText, null, children), /*#__PURE__*/extractErrorMessage.wn.createElement(ChevronContainer, {
|
|
4254
|
+
"aria-hidden": true
|
|
4255
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Chevron$1, null)));
|
|
4256
|
+
};
|
|
4257
|
+
var options = _defineProperty(_defineProperty({}, internal.B2BProducts.emailMagicLinks, {
|
|
4258
|
+
label: 'Email me a log in link'
|
|
4259
|
+
}), internal.B2BProducts.emailOtp, {
|
|
4260
|
+
label: 'Email me a log in code'
|
|
4261
|
+
});
|
|
4262
|
+
var EmailMethodSelectionScreen = function EmailMethodSelectionScreen() {
|
|
4263
|
+
var _useEffectiveAuthConf5 = useEffectiveAuthConfig(),
|
|
4264
|
+
products = _useEffectiveAuthConf5.products;
|
|
4265
|
+
var _useGlobalReducer45 = useGlobalReducer(),
|
|
4266
|
+
_useGlobalReducer46 = _slicedToArray(_useGlobalReducer45, 2),
|
|
4267
|
+
state = _useGlobalReducer46[0],
|
|
4268
|
+
dispatch = _useGlobalReducer46[1];
|
|
4269
|
+
var _useEmlDiscoverySend2 = useEmlDiscoverySend(),
|
|
4270
|
+
sendDiscoveryEml = _useEmlDiscoverySend2.trigger,
|
|
4271
|
+
isSendingDiscoveryEml = _useEmlDiscoverySend2.isMutating,
|
|
4272
|
+
sendDiscoveryEmlError = _useEmlDiscoverySend2.error,
|
|
4273
|
+
resetSendDiscoveryEml = _useEmlDiscoverySend2.reset;
|
|
4274
|
+
var _useEmailOtpDiscovery2 = useEmailOtpDiscoverySend(),
|
|
4275
|
+
sendDiscoveryOtp = _useEmailOtpDiscovery2.trigger,
|
|
4276
|
+
isSendingDiscoveryOtp = _useEmailOtpDiscovery2.isMutating,
|
|
4277
|
+
sendDiscoveryOtpError = _useEmailOtpDiscovery2.error,
|
|
4278
|
+
resetSendDiscoveryOtp = _useEmailOtpDiscovery2.reset;
|
|
4279
|
+
var _useEmlLoginOrSignup2 = useEmlLoginOrSignup(),
|
|
4280
|
+
sendLoginOrSignupEml = _useEmlLoginOrSignup2.trigger,
|
|
4281
|
+
isSendingLoginOrSignupEml = _useEmlLoginOrSignup2.isMutating,
|
|
4282
|
+
sendLoginOrSignupEmlError = _useEmlLoginOrSignup2.error,
|
|
4283
|
+
resetSendLoginOrSignupEml = _useEmlLoginOrSignup2.reset;
|
|
4284
|
+
var _useEmailOtpLoginOrSi2 = useEmailOtpLoginOrSignup(),
|
|
4285
|
+
sendLoginOrSignupOtp = _useEmailOtpLoginOrSi2.trigger,
|
|
4286
|
+
isSendingLoginOrSignupOtp = _useEmailOtpLoginOrSi2.isMutating,
|
|
4287
|
+
sendLoginOrSignupOtpError = _useEmailOtpLoginOrSi2.error,
|
|
4288
|
+
resetSendLoginOrSignupOtp = _useEmailOtpLoginOrSi2.reset;
|
|
4289
|
+
var isSending = isSendingDiscoveryEml || isSendingDiscoveryOtp || isSendingLoginOrSignupEml || isSendingLoginOrSignupOtp;
|
|
4290
|
+
var error = sendDiscoveryEmlError || sendDiscoveryOtpError || sendLoginOrSignupEmlError || sendLoginOrSignupOtpError;
|
|
4291
|
+
var errorMessage = extractErrorMessage.extractErrorMessage(error);
|
|
4292
|
+
var handleChooseMethod = function handleChooseMethod(method) {
|
|
4293
|
+
resetSendDiscoveryEml();
|
|
4294
|
+
resetSendDiscoveryOtp();
|
|
4295
|
+
resetSendLoginOrSignupEml();
|
|
4296
|
+
resetSendLoginOrSignupOtp();
|
|
4297
|
+
switch (method) {
|
|
4298
|
+
case internal.B2BProducts.emailMagicLinks:
|
|
4299
|
+
if (state.flowState.type === internal.AuthFlowType.Discovery) {
|
|
4300
|
+
sendDiscoveryEml({
|
|
4301
|
+
email: state.formState.emailState.userSuppliedEmail
|
|
4302
|
+
});
|
|
4303
|
+
} else if (state.flowState.type === internal.AuthFlowType.Organization && state.flowState.organization) {
|
|
4304
|
+
sendLoginOrSignupEml({
|
|
4305
|
+
email: state.formState.emailState.userSuppliedEmail,
|
|
4306
|
+
organization_id: state.flowState.organization.organization_id
|
|
4307
|
+
});
|
|
4308
|
+
}
|
|
4309
|
+
break;
|
|
4310
|
+
case internal.B2BProducts.emailOtp:
|
|
4311
|
+
if (state.flowState.type === internal.AuthFlowType.Discovery) {
|
|
4312
|
+
sendDiscoveryOtp({
|
|
4313
|
+
email: state.formState.emailState.userSuppliedEmail
|
|
4314
|
+
});
|
|
4315
|
+
} else if (state.flowState.type === internal.AuthFlowType.Organization && state.flowState.organization) {
|
|
4316
|
+
sendLoginOrSignupOtp({
|
|
4317
|
+
email: state.formState.emailState.userSuppliedEmail,
|
|
4318
|
+
organization_id: state.flowState.organization.organization_id
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
break;
|
|
4322
|
+
}
|
|
4323
|
+
};
|
|
4324
|
+
var displayOptions = extractErrorMessage.F(function () {
|
|
4325
|
+
return products.filter(function (product) {
|
|
4326
|
+
return product in options;
|
|
4327
|
+
}).map(function (product) {
|
|
4328
|
+
var option = options[product];
|
|
4329
|
+
return {
|
|
4330
|
+
option: product,
|
|
4331
|
+
label: option.label
|
|
4332
|
+
};
|
|
4333
|
+
});
|
|
4334
|
+
}, [products]);
|
|
4335
|
+
var handleBack = function handleBack() {
|
|
4336
|
+
dispatch({
|
|
4337
|
+
type: 'navigate_back'
|
|
4338
|
+
});
|
|
4339
|
+
};
|
|
4340
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4341
|
+
direction: "column",
|
|
4342
|
+
gap: 24
|
|
4343
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(BackArrow, {
|
|
4344
|
+
onClick: handleBack
|
|
4345
|
+
}), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
4346
|
+
size: "header"
|
|
4347
|
+
}, "Select how you\u2019d like to continue."), /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4348
|
+
direction: "column"
|
|
4349
|
+
}, displayOptions.map(function (_ref80) {
|
|
4350
|
+
var option = _ref80.option,
|
|
4351
|
+
label = _ref80.label;
|
|
4352
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(MenuButton, {
|
|
4353
|
+
key: option,
|
|
4354
|
+
disabled: isSending,
|
|
4355
|
+
onClick: function onClick() {
|
|
4356
|
+
handleChooseMethod(option);
|
|
4357
|
+
}
|
|
4358
|
+
}, label);
|
|
4359
|
+
})), errorMessage && /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorText, {
|
|
4360
|
+
errorMessage: errorMessage
|
|
4361
|
+
}));
|
|
4362
|
+
};
|
|
4363
|
+
var InlineButton = function InlineButton(_ref81) {
|
|
4364
|
+
var onClick = _ref81.onClick,
|
|
4365
|
+
children = _ref81.children;
|
|
4366
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement("button", {
|
|
4367
|
+
onClick: onClick,
|
|
4368
|
+
style: {
|
|
4369
|
+
all: 'unset'
|
|
4370
|
+
}
|
|
4371
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement("b", {
|
|
4372
|
+
style: {
|
|
4373
|
+
cursor: 'pointer'
|
|
4374
|
+
}
|
|
4375
|
+
}, children));
|
|
4376
|
+
};
|
|
4377
|
+
var Wrapper = extractErrorMessage.He.div(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-rows: ", ";\n transition: grid-template-rows 0.15s ease-out;\n"])), function (_ref82) {
|
|
4378
|
+
var isOpen = _ref82.isOpen;
|
|
4379
|
+
return isOpen ? '1fr' : '0fr';
|
|
4380
|
+
});
|
|
4381
|
+
var Inner = extractErrorMessage.He.div(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n overflow: hidden;\n"])));
|
|
4382
|
+
var AnimatedContainer = function AnimatedContainer(_ref83) {
|
|
4383
|
+
var isOpen = _ref83.isOpen,
|
|
4384
|
+
children = _ref83.children;
|
|
4385
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Wrapper, {
|
|
4386
|
+
isOpen: isOpen
|
|
4387
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Inner, null, children));
|
|
4388
|
+
};
|
|
4389
|
+
var Container = extractErrorMessage.He.div(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n border-radius: 3px;\n overflow: hidden;\n"])), function (_ref84) {
|
|
4390
|
+
var theme = _ref84.theme;
|
|
4391
|
+
return theme.colors.disabled;
|
|
4392
|
+
});
|
|
4393
|
+
var loading = extractErrorMessage.Ue(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(-1%);\n }\n"])));
|
|
4394
|
+
var Progress = extractErrorMessage.He.div(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n height: 100%;\n width: 100%;\n background-color: ", ";\n animation: ", " 10s cubic-bezier(0.22, 1, 0.36, 1);\n"])), function (_ref85) {
|
|
4395
|
+
var theme = _ref85.theme;
|
|
4396
|
+
return theme.colors.primary;
|
|
4397
|
+
}, loading);
|
|
4398
|
+
var LoadingBar = function LoadingBar(_ref86) {
|
|
4399
|
+
var isLoading = _ref86.isLoading;
|
|
4400
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Container, null, isLoading && /*#__PURE__*/extractErrorMessage.wn.createElement(Progress, null));
|
|
4401
|
+
};
|
|
4402
|
+
var GAP = '8px';
|
|
4403
|
+
var WIDTH = '46px';
|
|
4404
|
+
var INPUT_HEIGHT = '46px';
|
|
4405
|
+
var Digit = extractErrorMessage.He.div(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: 4px;\n align-items: center;\n display: flex;\n font-size: 18px;\n justify-content: center;\n height: ", ";\n width: ", ";\n background: ", ";\n color: ", ";\n"])), function (_ref87) {
|
|
4406
|
+
var disabled = _ref87.disabled,
|
|
4407
|
+
theme = _ref87.theme;
|
|
4408
|
+
return disabled ? theme.colors.disabled : '#ADBCC5';
|
|
4409
|
+
}, INPUT_HEIGHT, WIDTH, function (_ref88) {
|
|
4410
|
+
var disabled = _ref88.disabled,
|
|
4411
|
+
theme = _ref88.theme;
|
|
4412
|
+
return disabled ? theme.colors.disabled : theme.inputs.backgroundColor;
|
|
4413
|
+
}, function (_ref89) {
|
|
4414
|
+
var disabled = _ref89.disabled,
|
|
4415
|
+
theme = _ref89.theme;
|
|
4416
|
+
return disabled ? theme.colors.disabledText : theme.inputs.textColor;
|
|
4417
|
+
});
|
|
4418
|
+
var digitsContainerStyles = {
|
|
4419
|
+
display: 'flex',
|
|
4420
|
+
justifyContent: 'space-between',
|
|
4421
|
+
gap: GAP,
|
|
4422
|
+
position: 'relative',
|
|
4423
|
+
zIndex: -1
|
|
4424
|
+
};
|
|
4425
|
+
var otpContainerStyles = {
|
|
4426
|
+
overflow: 'hidden',
|
|
4427
|
+
position: 'relative',
|
|
4428
|
+
textAlign: 'initial',
|
|
4429
|
+
zIndex: 1
|
|
4430
|
+
};
|
|
4431
|
+
var invisibleInputStyles = {
|
|
4432
|
+
background: 'transparent',
|
|
4433
|
+
border: 'none',
|
|
4434
|
+
color: 'transparent',
|
|
4435
|
+
height: INPUT_HEIGHT,
|
|
4436
|
+
margin: 0,
|
|
4437
|
+
outline: 'none',
|
|
4438
|
+
position: 'absolute',
|
|
4439
|
+
width: "calc(100% - (0.5 * ".concat(WIDTH, "))"),
|
|
4440
|
+
caretColor: '#ADBCC5',
|
|
4441
|
+
letterSpacing: "calc(".concat(WIDTH, " - 1ch + ").concat(GAP, ")"),
|
|
4442
|
+
paddingLeft: "calc(0.5 * ".concat(WIDTH, ")"),
|
|
4443
|
+
zIndex: 10
|
|
4444
|
+
};
|
|
4445
|
+
var DigitAtIndex = function DigitAtIndex(_ref90) {
|
|
4446
|
+
var index = _ref90.index,
|
|
4447
|
+
disabled = _ref90.disabled,
|
|
4448
|
+
otp = _ref90.otp;
|
|
4449
|
+
var fill = otp ? otp[index] : '';
|
|
4450
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Digit, {
|
|
4451
|
+
disabled: disabled,
|
|
4452
|
+
"data-testid": "otp-".concat(index)
|
|
4453
|
+
}, fill);
|
|
4454
|
+
};
|
|
4455
|
+
var OTPInput = function OTPInput(_ref91) {
|
|
4456
|
+
var otp = _ref91.otp,
|
|
4457
|
+
setOtp = _ref91.setOtp,
|
|
4458
|
+
disabled = _ref91.disabled;
|
|
4459
|
+
var onPasscodeChange = function onPasscodeChange(e) {
|
|
4460
|
+
if (!/^\d*$/.test(e.target.value)) {
|
|
4461
|
+
return;
|
|
4462
|
+
}
|
|
4463
|
+
setOtp(e.target.value);
|
|
4464
|
+
};
|
|
4465
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement("div", {
|
|
4466
|
+
style: otpContainerStyles
|
|
4467
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement("input", Object.assign({
|
|
4468
|
+
"aria-label": "One-time passcode",
|
|
4469
|
+
autoComplete: "one-time-code",
|
|
4470
|
+
autoFocus: true,
|
|
4471
|
+
disabled: disabled,
|
|
4472
|
+
style: invisibleInputStyles,
|
|
4473
|
+
maxLength: 6,
|
|
4474
|
+
onChange: onPasscodeChange,
|
|
4475
|
+
type: "text",
|
|
4476
|
+
inputMode: "numeric",
|
|
4477
|
+
value: otp
|
|
4478
|
+
}, extractErrorMessage.passwordManagerDisableAutofillProps)), /*#__PURE__*/extractErrorMessage.wn.createElement("div", {
|
|
4479
|
+
style: digitsContainerStyles
|
|
4480
|
+
}, _toConsumableArray(Array(6).keys()).map(function (i) {
|
|
4481
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(DigitAtIndex, {
|
|
4482
|
+
key: "digit-".concat(i),
|
|
4483
|
+
index: i,
|
|
4484
|
+
otp: otp,
|
|
4485
|
+
disabled: !!disabled
|
|
4486
|
+
});
|
|
4487
|
+
})));
|
|
4488
|
+
};
|
|
4489
|
+
var OTP_CODE_LENGTH = 6;
|
|
4490
|
+
var OTPControl = function OTPControl(_ref92) {
|
|
4491
|
+
var isSubmitting = _ref92.isSubmitting,
|
|
4492
|
+
onSubmit = _ref92.onSubmit,
|
|
4493
|
+
errorMessage = _ref92.errorMessage;
|
|
4494
|
+
var _extractErrorMessage$33 = extractErrorMessage.h(''),
|
|
4495
|
+
_extractErrorMessage$34 = _slicedToArray(_extractErrorMessage$33, 2),
|
|
4496
|
+
otp = _extractErrorMessage$34[0],
|
|
4497
|
+
setOtp = _extractErrorMessage$34[1];
|
|
4498
|
+
var handleOtpChange = function handleOtpChange(otp) {
|
|
4499
|
+
setOtp(otp);
|
|
4500
|
+
if (otp.length === OTP_CODE_LENGTH) {
|
|
4501
|
+
onSubmit(otp);
|
|
4502
|
+
}
|
|
4503
|
+
};
|
|
4504
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4505
|
+
direction: "column",
|
|
4506
|
+
maxWidth: 316
|
|
4507
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(OTPInput, {
|
|
4508
|
+
otp: otp,
|
|
4509
|
+
setOtp: handleOtpChange,
|
|
4510
|
+
disabled: isSubmitting
|
|
4511
|
+
}), /*#__PURE__*/extractErrorMessage.wn.createElement(AnimatedContainer, {
|
|
4512
|
+
isOpen: isSubmitting
|
|
4513
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4514
|
+
direction: "column",
|
|
4515
|
+
gap: 8,
|
|
4516
|
+
marginTop: 8
|
|
4517
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
4518
|
+
color: "secondary",
|
|
4519
|
+
size: "helper"
|
|
4520
|
+
}, "Verifying passcode..."), /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingBar, {
|
|
4521
|
+
isLoading: isSubmitting
|
|
4522
|
+
}))), !isSubmitting && /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorText, {
|
|
4523
|
+
errorMessage: errorMessage !== null && errorMessage !== void 0 ? errorMessage : ''
|
|
4524
|
+
}));
|
|
4525
|
+
};
|
|
4526
|
+
var OTPEntry = function OTPEntry(_ref93) {
|
|
4527
|
+
var header = _ref93.header,
|
|
4528
|
+
helperContent = _ref93.helperContent,
|
|
4529
|
+
instruction = _ref93.instruction,
|
|
4530
|
+
isSubmitting = _ref93.isSubmitting,
|
|
4531
|
+
onSubmit = _ref93.onSubmit,
|
|
4532
|
+
errorMessage = _ref93.errorMessage;
|
|
4533
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
3930
4534
|
direction: "column",
|
|
3931
|
-
gap: 24
|
|
3932
|
-
|
|
3933
|
-
}, /*#__PURE__*/extractErrorMessage.y(Text, {
|
|
4535
|
+
gap: 24
|
|
4536
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
3934
4537
|
size: "header"
|
|
3935
|
-
},
|
|
4538
|
+
}, header), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, instruction), /*#__PURE__*/extractErrorMessage.wn.createElement(OTPControl, {
|
|
4539
|
+
isSubmitting: isSubmitting,
|
|
4540
|
+
onSubmit: onSubmit,
|
|
4541
|
+
errorMessage: errorMessage
|
|
4542
|
+
}), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
4543
|
+
size: "helper",
|
|
4544
|
+
color: "secondary"
|
|
4545
|
+
}, helperContent));
|
|
3936
4546
|
};
|
|
3937
|
-
var
|
|
3938
|
-
var
|
|
4547
|
+
var getSecondsRemaining = function getSecondsRemaining(expiration) {
|
|
4548
|
+
var now = new Date();
|
|
4549
|
+
return Math.ceil((expiration.getTime() - now.getTime()) / 1000);
|
|
4550
|
+
};
|
|
4551
|
+
var ExpirationMessage = function ExpirationMessage(_ref94) {
|
|
4552
|
+
var expiration = _ref94.expiration,
|
|
4553
|
+
resendOTP = _ref94.resendOTP;
|
|
4554
|
+
var _extractErrorMessage$35 = extractErrorMessage.h(function () {
|
|
4555
|
+
return getSecondsRemaining(expiration);
|
|
4556
|
+
}),
|
|
4557
|
+
_extractErrorMessage$36 = _slicedToArray(_extractErrorMessage$35, 2),
|
|
4558
|
+
seconds = _extractErrorMessage$36[0],
|
|
4559
|
+
setSeconds = _extractErrorMessage$36[1];
|
|
4560
|
+
var codeExpired = seconds <= 0;
|
|
3939
4561
|
extractErrorMessage.p(function () {
|
|
3940
|
-
|
|
3941
|
-
|
|
4562
|
+
if (!codeExpired) {
|
|
4563
|
+
var updateSeconds = function updateSeconds() {
|
|
4564
|
+
return setSeconds(getSecondsRemaining(expiration));
|
|
4565
|
+
};
|
|
4566
|
+
var interval = setInterval(updateSeconds, 1000);
|
|
4567
|
+
updateSeconds();
|
|
4568
|
+
return function () {
|
|
4569
|
+
return clearInterval(interval);
|
|
4570
|
+
};
|
|
4571
|
+
}
|
|
4572
|
+
}, [codeExpired, expiration]);
|
|
4573
|
+
var displayMinutes = Math.floor(Number(seconds / 60));
|
|
4574
|
+
var displaySeconds = seconds - displayMinutes * 60;
|
|
4575
|
+
var formattedTime = "".concat(displayMinutes, ":").concat(displaySeconds < 10 ? "0".concat(displaySeconds) : displaySeconds);
|
|
4576
|
+
var formattedText = seconds > 0 ? "Your code expires in ".concat(formattedTime, ". Didn't get it? ") : 'Your code has expired. ';
|
|
4577
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, formattedText, /*#__PURE__*/extractErrorMessage.wn.createElement(InlineButton, {
|
|
4578
|
+
onClick: resendOTP
|
|
4579
|
+
}, "Resend code"));
|
|
3942
4580
|
};
|
|
3943
|
-
var
|
|
3944
|
-
var
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4581
|
+
var SentOTPEntry = function SentOTPEntry(_ref95) {
|
|
4582
|
+
var expiration = _ref95.expiration,
|
|
4583
|
+
formattedDestination = _ref95.formattedDestination,
|
|
4584
|
+
isSubmitting = _ref95.isSubmitting,
|
|
4585
|
+
onSubmit = _ref95.onSubmit,
|
|
4586
|
+
errorMessage = _ref95.errorMessage,
|
|
4587
|
+
resendOTP = _ref95.resendOTP;
|
|
4588
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(OTPEntry, {
|
|
4589
|
+
header: "Enter passcode",
|
|
4590
|
+
helperContent: /*#__PURE__*/extractErrorMessage.wn.createElement(ExpirationMessage, {
|
|
4591
|
+
expiration: expiration,
|
|
4592
|
+
resendOTP: resendOTP
|
|
4593
|
+
}),
|
|
4594
|
+
instruction: /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, "A 6-digit passcode was sent to you at ", /*#__PURE__*/extractErrorMessage.wn.createElement("b", null, formattedDestination), "."),
|
|
4595
|
+
isSubmitting: isSubmitting,
|
|
4596
|
+
onSubmit: onSubmit,
|
|
4597
|
+
errorMessage: errorMessage
|
|
3950
4598
|
});
|
|
3951
|
-
return /*#__PURE__*/extractErrorMessage.y(Confirmation, null);
|
|
3952
|
-
};
|
|
3953
|
-
var assertUnreachable = function assertUnreachable() {
|
|
3954
|
-
throw new Error('Assertion failure');
|
|
3955
4599
|
};
|
|
3956
|
-
var
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
4600
|
+
var EmailOTPEntryScreen = function EmailOTPEntryScreen() {
|
|
4601
|
+
var stytchClient = useStytch();
|
|
4602
|
+
var config = useConfig();
|
|
4603
|
+
var _useGlobalReducer47 = useGlobalReducer(),
|
|
4604
|
+
_useGlobalReducer48 = _slicedToArray(_useGlobalReducer47, 2),
|
|
4605
|
+
state = _useGlobalReducer48[0],
|
|
4606
|
+
dispatch = _useGlobalReducer48[1];
|
|
4607
|
+
var codeExpiration = state.formState.otpState.codeExpiration;
|
|
4608
|
+
var userSuppliedEmail = state.formState.emailState.userSuppliedEmail;
|
|
4609
|
+
var _useEmailOtpLoginOrSi3 = useEmailOtpLoginOrSignup(),
|
|
4610
|
+
sendOtp = _useEmailOtpLoginOrSi3.trigger,
|
|
4611
|
+
isSendingOtp = _useEmailOtpLoginOrSi3.isMutating,
|
|
4612
|
+
sendOtpError = _useEmailOtpLoginOrSi3.error;
|
|
4613
|
+
var _useEmailOtpDiscovery3 = useEmailOtpDiscoverySend(),
|
|
4614
|
+
sendOtpDiscovery = _useEmailOtpDiscovery3.trigger,
|
|
4615
|
+
isSendingDiscovery = _useEmailOtpDiscovery3.isMutating,
|
|
4616
|
+
sendDiscoveryError = _useEmailOtpDiscovery3.error,
|
|
4617
|
+
resetSendDiscovery = _useEmailOtpDiscovery3.reset;
|
|
4618
|
+
var isSending = isSendingDiscovery || isSendingOtp;
|
|
4619
|
+
var sendError = sendDiscoveryError || sendOtpError;
|
|
4620
|
+
var _useMutate5 = useMutate('stytch.otps.email.discovery.authenticate', function (_, _ref96) {
|
|
4621
|
+
var _ref96$arg = _ref96.arg,
|
|
4622
|
+
otp = _ref96$arg.otp,
|
|
4623
|
+
email = _ref96$arg.email;
|
|
4624
|
+
return stytchClient.otps.email.discovery.authenticate({
|
|
4625
|
+
code: otp,
|
|
4626
|
+
email_address: email
|
|
4627
|
+
});
|
|
4628
|
+
}, {
|
|
4629
|
+
onSuccess: function onSuccess(data) {
|
|
4630
|
+
onDiscoveryAuthenticateSuccess(data, dispatch);
|
|
4631
|
+
}
|
|
4632
|
+
}),
|
|
4633
|
+
discoveryAuthenticate = _useMutate5.trigger,
|
|
4634
|
+
isDiscoveryAuthenticating = _useMutate5.isMutating,
|
|
4635
|
+
discoveryAuthenticateError = _useMutate5.error,
|
|
4636
|
+
resetDiscoveryAuthenticate = _useMutate5.reset;
|
|
4637
|
+
var _useMutate6 = useMutate('stytch.otps.email.authenticate', function (_, _ref97) {
|
|
4638
|
+
var _ref97$arg = _ref97.arg,
|
|
4639
|
+
otp = _ref97$arg.otp,
|
|
4640
|
+
emailAddress = _ref97$arg.emailAddress,
|
|
4641
|
+
organizationId = _ref97$arg.organizationId,
|
|
4642
|
+
sessionDurationMinutes = _ref97$arg.sessionDurationMinutes;
|
|
4643
|
+
return stytchClient.otps.email.authenticate({
|
|
4644
|
+
code: otp,
|
|
4645
|
+
email_address: emailAddress,
|
|
4646
|
+
organization_id: organizationId,
|
|
4647
|
+
session_duration_minutes: sessionDurationMinutes
|
|
4648
|
+
});
|
|
4649
|
+
}, {
|
|
4650
|
+
onSuccess: function onSuccess(data) {
|
|
4651
|
+
onAuthenticateSuccess(data, dispatch, config);
|
|
4652
|
+
}
|
|
4653
|
+
}),
|
|
4654
|
+
authenticate = _useMutate6.trigger,
|
|
4655
|
+
isAuthenticating = _useMutate6.isMutating,
|
|
4656
|
+
authenticateError = _useMutate6.error,
|
|
4657
|
+
resetAuthenticate = _useMutate6.reset;
|
|
4658
|
+
var isAuthenticatingAny = isDiscoveryAuthenticating || isAuthenticating;
|
|
4659
|
+
var authenticateAnyError = discoveryAuthenticateError || authenticateError;
|
|
4660
|
+
var errorAny = authenticateAnyError || sendError;
|
|
4661
|
+
var errorMessage = errorAny ? 'Invalid passcode, please try again.' : undefined;
|
|
4662
|
+
var resetAll = function resetAll() {
|
|
4663
|
+
resetDiscoveryAuthenticate();
|
|
4664
|
+
resetAuthenticate();
|
|
4665
|
+
resetSendDiscovery();
|
|
4666
|
+
};
|
|
4667
|
+
var handleSubmit = function handleSubmit(otp) {
|
|
4668
|
+
resetAll();
|
|
4669
|
+
if (state.flowState.type === internal.AuthFlowType.Discovery) {
|
|
4670
|
+
discoveryAuthenticate({
|
|
4671
|
+
otp: otp,
|
|
4672
|
+
email: userSuppliedEmail
|
|
4673
|
+
});
|
|
4674
|
+
} else if (state.flowState.type === internal.AuthFlowType.Organization && state.flowState.organization && state.formState.emailState.userSuppliedEmail) {
|
|
4675
|
+
authenticate({
|
|
4676
|
+
otp: otp,
|
|
4677
|
+
emailAddress: state.formState.emailState.userSuppliedEmail,
|
|
4678
|
+
organizationId: state.flowState.organization.organization_id,
|
|
4679
|
+
sessionDurationMinutes: config.sessionOptions.sessionDurationMinutes
|
|
4680
|
+
});
|
|
4681
|
+
}
|
|
4682
|
+
};
|
|
4683
|
+
var handleResendOTP = function handleResendOTP() {
|
|
4684
|
+
resetAll();
|
|
4685
|
+
if (!isSending) {
|
|
4686
|
+
if (state.flowState.type === internal.AuthFlowType.Discovery) {
|
|
4687
|
+
sendOtpDiscovery({
|
|
4688
|
+
email: userSuppliedEmail
|
|
4689
|
+
});
|
|
4690
|
+
} else if (state.flowState.type === internal.AuthFlowType.Organization && state.flowState.organization) {
|
|
4691
|
+
sendOtp({
|
|
4692
|
+
email: userSuppliedEmail,
|
|
4693
|
+
organization_id: state.flowState.organization.organization_id
|
|
4694
|
+
});
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
};
|
|
4698
|
+
var handleBack = function handleBack() {
|
|
4699
|
+
dispatch({
|
|
4700
|
+
type: 'navigate_back'
|
|
4701
|
+
});
|
|
4702
|
+
};
|
|
4703
|
+
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4704
|
+
direction: "column",
|
|
4705
|
+
gap: 24
|
|
4706
|
+
}, /*#__PURE__*/extractErrorMessage.wn.createElement(BackArrow, {
|
|
4707
|
+
onClick: handleBack
|
|
4708
|
+
}), codeExpiration !== null ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(SentOTPEntry, {
|
|
4709
|
+
isSubmitting: isAuthenticatingAny,
|
|
4710
|
+
onSubmit: handleSubmit,
|
|
4711
|
+
errorMessage: errorMessage,
|
|
4712
|
+
expiration: codeExpiration,
|
|
4713
|
+
formattedDestination: userSuppliedEmail,
|
|
4714
|
+
resendOTP: handleResendOTP
|
|
4715
|
+
})) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingScreen, null)));
|
|
3981
4716
|
};
|
|
3982
4717
|
var mfaOptions = _defineProperty(_defineProperty({}, internal.B2BMFAProducts.totp, {
|
|
3983
4718
|
label: 'Use an authenticator app'
|
|
@@ -3988,10 +4723,10 @@ var MFAEnrollmentSelectionScreen = function MFAEnrollmentSelectionScreen() {
|
|
|
3988
4723
|
var _useConfig = useConfig(),
|
|
3989
4724
|
mfaProductInclude = _useConfig.mfaProductInclude,
|
|
3990
4725
|
mfaProductOrder = _useConfig.mfaProductOrder;
|
|
3991
|
-
var
|
|
3992
|
-
|
|
3993
|
-
state =
|
|
3994
|
-
dispatch =
|
|
4726
|
+
var _useGlobalReducer49 = useGlobalReducer(),
|
|
4727
|
+
_useGlobalReducer50 = _slicedToArray(_useGlobalReducer49, 2),
|
|
4728
|
+
state = _useGlobalReducer50[0],
|
|
4729
|
+
dispatch = _useGlobalReducer50[1];
|
|
3995
4730
|
var organizationMfaOptionsSupported = state.mfa.primaryInfo.organizationMfaOptionsSupported;
|
|
3996
4731
|
var handleChooseMethod = function handleChooseMethod(method) {
|
|
3997
4732
|
dispatch({
|
|
@@ -4030,9 +4765,9 @@ var MFAEnrollmentSelectionScreen = function MFAEnrollmentSelectionScreen() {
|
|
|
4030
4765
|
size: "header"
|
|
4031
4766
|
}, "Set up Multi-Factor Authentication"), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Your organization requires an additional form of verification to make your account more secure."), /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4032
4767
|
direction: "column"
|
|
4033
|
-
}, displayOptions.map(function (
|
|
4034
|
-
var option =
|
|
4035
|
-
label =
|
|
4768
|
+
}, displayOptions.map(function (_ref98) {
|
|
4769
|
+
var option = _ref98.option,
|
|
4770
|
+
label = _ref98.label;
|
|
4036
4771
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(MenuButton, {
|
|
4037
4772
|
key: option,
|
|
4038
4773
|
onClick: function onClick() {
|
|
@@ -4054,13 +4789,13 @@ var inboxLinks = function inboxLinks(emailDomain) {
|
|
|
4054
4789
|
OUTLOOK: 'https://outlook.office.com/mail/0/inbox'
|
|
4055
4790
|
};
|
|
4056
4791
|
};
|
|
4057
|
-
var Link = extractErrorMessage.He.a(
|
|
4792
|
+
var Link = extractErrorMessage.He.a(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n all: unset;\n cursor: pointer;\n\n &:hover {\n text-decoration: underline;\n text-decoration-color: ", ";\n }\n"])), function (props) {
|
|
4058
4793
|
return props.theme.colors.primary;
|
|
4059
4794
|
});
|
|
4060
|
-
var EmailProviderLink = function EmailProviderLink(
|
|
4061
|
-
var label =
|
|
4062
|
-
href =
|
|
4063
|
-
Icon =
|
|
4795
|
+
var EmailProviderLink = function EmailProviderLink(_ref99) {
|
|
4796
|
+
var label = _ref99.label,
|
|
4797
|
+
href = _ref99.href,
|
|
4798
|
+
Icon = _ref99.Icon;
|
|
4064
4799
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4065
4800
|
gap: 4
|
|
4066
4801
|
}, Icon, /*#__PURE__*/extractErrorMessage.wn.createElement(Link, {
|
|
@@ -4069,16 +4804,16 @@ var EmailProviderLink = function EmailProviderLink(_ref77) {
|
|
|
4069
4804
|
rel: "noopener noreferrer"
|
|
4070
4805
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Open in ", label)));
|
|
4071
4806
|
};
|
|
4072
|
-
var VerifyEmailConfirmation = function VerifyEmailConfirmation(
|
|
4073
|
-
var emailDomain =
|
|
4074
|
-
reset =
|
|
4075
|
-
email =
|
|
4807
|
+
var VerifyEmailConfirmation = function VerifyEmailConfirmation(_ref100) {
|
|
4808
|
+
var emailDomain = _ref100.emailDomain,
|
|
4809
|
+
reset = _ref100.reset,
|
|
4810
|
+
email = _ref100.email;
|
|
4076
4811
|
var _inboxLinks = inboxLinks(emailDomain),
|
|
4077
4812
|
GMAIL = _inboxLinks.GMAIL,
|
|
4078
4813
|
OUTLOOK = _inboxLinks.OUTLOOK;
|
|
4079
|
-
var
|
|
4080
|
-
|
|
4081
|
-
dispatch =
|
|
4814
|
+
var _useGlobalReducer51 = useGlobalReducer(),
|
|
4815
|
+
_useGlobalReducer52 = _slicedToArray(_useGlobalReducer51, 2),
|
|
4816
|
+
dispatch = _useGlobalReducer52[1];
|
|
4082
4817
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4083
4818
|
direction: "column",
|
|
4084
4819
|
gap: 24
|
|
@@ -4118,17 +4853,17 @@ var useEmailDomain = function useEmailDomain() {
|
|
|
4118
4853
|
var _a, _b;
|
|
4119
4854
|
var stytch = useStytch();
|
|
4120
4855
|
var config = useConfig();
|
|
4121
|
-
var _extractErrorMessage$
|
|
4856
|
+
var _extractErrorMessage$37 = extractErrorMessage.h(function () {
|
|
4122
4857
|
var _internal$readB2BInte4 = internal.readB2BInternals(stytch).bootstrap.getSync(),
|
|
4123
4858
|
emailDomains = _internal$readB2BInte4.emailDomains;
|
|
4124
4859
|
return emailDomains;
|
|
4125
4860
|
}),
|
|
4126
|
-
_extractErrorMessage$
|
|
4127
|
-
emailDomains = _extractErrorMessage$
|
|
4128
|
-
setEmailDomains = _extractErrorMessage$
|
|
4861
|
+
_extractErrorMessage$38 = _slicedToArray(_extractErrorMessage$37, 2),
|
|
4862
|
+
emailDomains = _extractErrorMessage$38[0],
|
|
4863
|
+
setEmailDomains = _extractErrorMessage$38[1];
|
|
4129
4864
|
extractErrorMessage.p(function () {
|
|
4130
|
-
internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (
|
|
4131
|
-
var emailDomains =
|
|
4865
|
+
internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref101) {
|
|
4866
|
+
var emailDomains = _ref101.emailDomains;
|
|
4132
4867
|
setEmailDomains(emailDomains);
|
|
4133
4868
|
});
|
|
4134
4869
|
}, [stytch]);
|
|
@@ -4141,14 +4876,14 @@ var useEmailDomain = function useEmailDomain() {
|
|
|
4141
4876
|
return null;
|
|
4142
4877
|
};
|
|
4143
4878
|
var PasswordResetConfirmation = function PasswordResetConfirmation() {
|
|
4144
|
-
var
|
|
4145
|
-
|
|
4146
|
-
state =
|
|
4147
|
-
dispatch =
|
|
4879
|
+
var _useGlobalReducer53 = useGlobalReducer(),
|
|
4880
|
+
_useGlobalReducer54 = _slicedToArray(_useGlobalReducer53, 2),
|
|
4881
|
+
state = _useGlobalReducer54[0],
|
|
4882
|
+
dispatch = _useGlobalReducer54[1];
|
|
4148
4883
|
var emailDomain = useEmailDomain();
|
|
4149
4884
|
var reset = function reset() {
|
|
4150
4885
|
dispatch({
|
|
4151
|
-
type: '
|
|
4886
|
+
type: 'set_user_supplied_email',
|
|
4152
4887
|
email: ''
|
|
4153
4888
|
});
|
|
4154
4889
|
dispatch({
|
|
@@ -4162,11 +4897,11 @@ var PasswordResetConfirmation = function PasswordResetConfirmation() {
|
|
|
4162
4897
|
email: state.formState.passwordState.email
|
|
4163
4898
|
});
|
|
4164
4899
|
};
|
|
4165
|
-
var Block = extractErrorMessage.He.div(
|
|
4900
|
+
var Block = extractErrorMessage.He.div(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n height: 4px;\n width: 25%;\n background-color: ", ";\n"])), function (props) {
|
|
4166
4901
|
return props.$bgColor;
|
|
4167
4902
|
});
|
|
4168
|
-
var PasswordStrengthCheck = function PasswordStrengthCheck(
|
|
4169
|
-
var score =
|
|
4903
|
+
var PasswordStrengthCheck = function PasswordStrengthCheck(_ref102) {
|
|
4904
|
+
var score = _ref102.score;
|
|
4170
4905
|
var blocks = [];
|
|
4171
4906
|
switch (score) {
|
|
4172
4907
|
case 0:
|
|
@@ -4271,76 +5006,76 @@ var removeStytchParams = function removeStytchParams(value) {
|
|
|
4271
5006
|
params["delete"]('stytch_token_type');
|
|
4272
5007
|
return url;
|
|
4273
5008
|
};
|
|
4274
|
-
var Form = extractErrorMessage.He.form(
|
|
5009
|
+
var Form = extractErrorMessage.He.form(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n width: 100%;\n"])));
|
|
4275
5010
|
var PasswordResetForm = function PasswordResetForm() {
|
|
4276
5011
|
var stytchClient = useStytch();
|
|
4277
5012
|
var config = useConfig();
|
|
4278
|
-
var
|
|
4279
|
-
|
|
4280
|
-
dispatch =
|
|
5013
|
+
var _useGlobalReducer55 = useGlobalReducer(),
|
|
5014
|
+
_useGlobalReducer56 = _slicedToArray(_useGlobalReducer55, 2),
|
|
5015
|
+
dispatch = _useGlobalReducer56[1];
|
|
4281
5016
|
var onEvent = useEventCallback();
|
|
4282
5017
|
var onError = useErrorCallback();
|
|
4283
|
-
var _extractErrorMessage$35 = extractErrorMessage.h(''),
|
|
4284
|
-
_extractErrorMessage$36 = _slicedToArray(_extractErrorMessage$35, 2),
|
|
4285
|
-
resetTokenType = _extractErrorMessage$36[0],
|
|
4286
|
-
setResetTokenType = _extractErrorMessage$36[1];
|
|
4287
|
-
var _extractErrorMessage$37 = extractErrorMessage.h(''),
|
|
4288
|
-
_extractErrorMessage$38 = _slicedToArray(_extractErrorMessage$37, 2),
|
|
4289
|
-
resetToken = _extractErrorMessage$38[0],
|
|
4290
|
-
setResetToken = _extractErrorMessage$38[1];
|
|
4291
|
-
var dataLayer = internal.readB2BInternals(stytchClient).dataLayer;
|
|
4292
|
-
var email = dataLayer.getItem('reset-email-value');
|
|
4293
5018
|
var _extractErrorMessage$39 = extractErrorMessage.h(''),
|
|
4294
5019
|
_extractErrorMessage$40 = _slicedToArray(_extractErrorMessage$39, 2),
|
|
4295
|
-
|
|
4296
|
-
|
|
5020
|
+
resetTokenType = _extractErrorMessage$40[0],
|
|
5021
|
+
setResetTokenType = _extractErrorMessage$40[1];
|
|
4297
5022
|
var _extractErrorMessage$41 = extractErrorMessage.h(''),
|
|
4298
5023
|
_extractErrorMessage$42 = _slicedToArray(_extractErrorMessage$41, 2),
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
var
|
|
5024
|
+
resetToken = _extractErrorMessage$42[0],
|
|
5025
|
+
setResetToken = _extractErrorMessage$42[1];
|
|
5026
|
+
var dataLayer = internal.readB2BInternals(stytchClient).dataLayer;
|
|
5027
|
+
var email = dataLayer.getItem('reset-email-value');
|
|
5028
|
+
var _extractErrorMessage$43 = extractErrorMessage.h(''),
|
|
4302
5029
|
_extractErrorMessage$44 = _slicedToArray(_extractErrorMessage$43, 2),
|
|
4303
|
-
|
|
4304
|
-
|
|
5030
|
+
password = _extractErrorMessage$44[0],
|
|
5031
|
+
setPassword = _extractErrorMessage$44[1];
|
|
4305
5032
|
var _extractErrorMessage$45 = extractErrorMessage.h(''),
|
|
4306
5033
|
_extractErrorMessage$46 = _slicedToArray(_extractErrorMessage$45, 2),
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
var _extractErrorMessage$47 = extractErrorMessage.h(
|
|
5034
|
+
errorMessage = _extractErrorMessage$46[0],
|
|
5035
|
+
setErrorMessage = _extractErrorMessage$46[1];
|
|
5036
|
+
var _extractErrorMessage$47 = extractErrorMessage.h(0),
|
|
4310
5037
|
_extractErrorMessage$48 = _slicedToArray(_extractErrorMessage$47, 2),
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
var _extractErrorMessage$49 = extractErrorMessage.h(
|
|
5038
|
+
passwordScore = _extractErrorMessage$48[0],
|
|
5039
|
+
setPasswordScore = _extractErrorMessage$48[1];
|
|
5040
|
+
var _extractErrorMessage$49 = extractErrorMessage.h(''),
|
|
4314
5041
|
_extractErrorMessage$50 = _slicedToArray(_extractErrorMessage$49, 2),
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
var _extractErrorMessage$51 = extractErrorMessage.h(
|
|
5042
|
+
passwordFeedback = _extractErrorMessage$50[0],
|
|
5043
|
+
setPasswordFeedback = _extractErrorMessage$50[1];
|
|
5044
|
+
var _extractErrorMessage$51 = extractErrorMessage.h(true),
|
|
4318
5045
|
_extractErrorMessage$52 = _slicedToArray(_extractErrorMessage$51, 2),
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
var _extractErrorMessage$53 = extractErrorMessage.h(
|
|
5046
|
+
invalidPassword = _extractErrorMessage$52[0],
|
|
5047
|
+
setInvalidPassword = _extractErrorMessage$52[1];
|
|
5048
|
+
var _extractErrorMessage$53 = extractErrorMessage.h(false),
|
|
4322
5049
|
_extractErrorMessage$54 = _slicedToArray(_extractErrorMessage$53, 2),
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
var _extractErrorMessage$55 = extractErrorMessage.h(
|
|
5050
|
+
isSubmitting = _extractErrorMessage$54[0],
|
|
5051
|
+
setIsSubmitting = _extractErrorMessage$54[1];
|
|
5052
|
+
var _extractErrorMessage$55 = extractErrorMessage.h('none'),
|
|
4326
5053
|
_extractErrorMessage$56 = _slicedToArray(_extractErrorMessage$55, 2),
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
var _extractErrorMessage$57 = extractErrorMessage.h(
|
|
5054
|
+
strengthPolicy = _extractErrorMessage$56[0],
|
|
5055
|
+
setStrengthPolicy = _extractErrorMessage$56[1];
|
|
5056
|
+
var _extractErrorMessage$57 = extractErrorMessage.h(0),
|
|
4330
5057
|
_extractErrorMessage$58 = _slicedToArray(_extractErrorMessage$57, 2),
|
|
4331
|
-
|
|
4332
|
-
|
|
5058
|
+
missingCharacters = _extractErrorMessage$58[0],
|
|
5059
|
+
setMissingCharacters = _extractErrorMessage$58[1];
|
|
5060
|
+
var _extractErrorMessage$59 = extractErrorMessage.h(0),
|
|
5061
|
+
_extractErrorMessage$60 = _slicedToArray(_extractErrorMessage$59, 2),
|
|
5062
|
+
missingComplexity = _extractErrorMessage$60[0],
|
|
5063
|
+
setMissingComplexity = _extractErrorMessage$60[1];
|
|
5064
|
+
var _extractErrorMessage$61 = extractErrorMessage.h(false),
|
|
5065
|
+
_extractErrorMessage$62 = _slicedToArray(_extractErrorMessage$61, 2),
|
|
5066
|
+
isPasswordBreached = _extractErrorMessage$62[0],
|
|
5067
|
+
setIsPasswordBreached = _extractErrorMessage$62[1];
|
|
4333
5068
|
var updateStrengthCheck = extractErrorMessage.F(function () {
|
|
4334
5069
|
return internal.debounce(function (password) {
|
|
4335
5070
|
return stytchClient.passwords.strengthCheck({
|
|
4336
5071
|
password: password
|
|
4337
|
-
}).then(function (
|
|
4338
|
-
var score =
|
|
4339
|
-
valid_password =
|
|
4340
|
-
zxcvbn_feedback =
|
|
4341
|
-
luds_feedback =
|
|
4342
|
-
strength_policy =
|
|
4343
|
-
breached_password =
|
|
5072
|
+
}).then(function (_ref103) {
|
|
5073
|
+
var score = _ref103.score,
|
|
5074
|
+
valid_password = _ref103.valid_password,
|
|
5075
|
+
zxcvbn_feedback = _ref103.zxcvbn_feedback,
|
|
5076
|
+
luds_feedback = _ref103.luds_feedback,
|
|
5077
|
+
strength_policy = _ref103.strength_policy,
|
|
5078
|
+
breached_password = _ref103.breached_password;
|
|
4344
5079
|
setStrengthPolicy(strength_policy);
|
|
4345
5080
|
setInvalidPassword(!valid_password);
|
|
4346
5081
|
if (strength_policy === 'zxcvbn') {
|
|
@@ -4413,6 +5148,35 @@ var PasswordResetForm = function PasswordResetForm() {
|
|
|
4413
5148
|
setErrorMessage(message);
|
|
4414
5149
|
setIsSubmitting(false);
|
|
4415
5150
|
});
|
|
5151
|
+
} else if (resetTokenType == 'discovery') {
|
|
5152
|
+
stytchClient.passwords.discovery.resetByEmail({
|
|
5153
|
+
password_reset_token: resetToken,
|
|
5154
|
+
password: password
|
|
5155
|
+
}).then(function (data) {
|
|
5156
|
+
setIsSubmitting(false);
|
|
5157
|
+
onEvent({
|
|
5158
|
+
type: internal.StytchEventType.B2BDiscoveryPasswordReset,
|
|
5159
|
+
data: data
|
|
5160
|
+
});
|
|
5161
|
+
dispatch({
|
|
5162
|
+
type: 'transition',
|
|
5163
|
+
screen: AppScreens$1.Discovery
|
|
5164
|
+
});
|
|
5165
|
+
dispatch({
|
|
5166
|
+
type: 'set_discovery_state',
|
|
5167
|
+
email: data.email_address,
|
|
5168
|
+
discoveredOrganizations: data.discovered_organizations,
|
|
5169
|
+
intermediateSessionToken: data.intermediate_session_token
|
|
5170
|
+
});
|
|
5171
|
+
})["catch"](function (e) {
|
|
5172
|
+
onError(e);
|
|
5173
|
+
var message = e.message;
|
|
5174
|
+
if (e instanceof internal.StytchAPIError) {
|
|
5175
|
+
message = e.error_message;
|
|
5176
|
+
}
|
|
5177
|
+
setErrorMessage(message);
|
|
5178
|
+
setIsSubmitting(false);
|
|
5179
|
+
});
|
|
4416
5180
|
} else {
|
|
4417
5181
|
stytchClient.passwords.resetBySession({
|
|
4418
5182
|
password: password
|
|
@@ -4484,9 +5248,9 @@ var PasswordResetForm = function PasswordResetForm() {
|
|
|
4484
5248
|
}))));
|
|
4485
5249
|
};
|
|
4486
5250
|
var PasswordSetNew = function PasswordSetNew() {
|
|
4487
|
-
var
|
|
4488
|
-
|
|
4489
|
-
dispatch =
|
|
5251
|
+
var _useGlobalReducer57 = useGlobalReducer(),
|
|
5252
|
+
_useGlobalReducer58 = _slicedToArray(_useGlobalReducer57, 2),
|
|
5253
|
+
dispatch = _useGlobalReducer58[1];
|
|
4490
5254
|
var onEvent = useEventCallback();
|
|
4491
5255
|
var config = useConfig();
|
|
4492
5256
|
var _usePasswordInput3 = usePasswordInput(),
|
|
@@ -4495,28 +5259,42 @@ var PasswordSetNew = function PasswordSetNew() {
|
|
|
4495
5259
|
email = _usePasswordInput3.email,
|
|
4496
5260
|
organization = _usePasswordInput3.organization,
|
|
4497
5261
|
setIsSubmitting = _usePasswordInput3.setIsSubmitting;
|
|
4498
|
-
if (!organization) {
|
|
4499
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
4500
|
-
}
|
|
4501
5262
|
var resendResetPassword = function resendResetPassword() {
|
|
4502
|
-
var _a, _b, _c, _d;
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
5263
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5264
|
+
if (!organization) {
|
|
5265
|
+
stytch.passwords.discovery.resetByEmailStart({
|
|
5266
|
+
email_address: email,
|
|
5267
|
+
discovery_redirect_url: (_a = config.emailMagicLinksOptions) === null || _a === void 0 ? void 0 : _a.loginRedirectURL,
|
|
5268
|
+
reset_password_redirect_url: (_b = config.passwordOptions) === null || _b === void 0 ? void 0 : _b.resetPasswordRedirectURL,
|
|
5269
|
+
reset_password_expiration_minutes: (_c = config.passwordOptions) === null || _c === void 0 ? void 0 : _c.resetPasswordExpirationMinutes,
|
|
5270
|
+
reset_password_template_id: (_d = config.passwordOptions) === null || _d === void 0 ? void 0 : _d.resetPasswordTemplateId
|
|
5271
|
+
}).then(function (data) {
|
|
5272
|
+
_t.success('Email resent');
|
|
5273
|
+
setIsSubmitting(false);
|
|
5274
|
+
onEvent({
|
|
5275
|
+
type: internal.StytchEventType.B2BPasswordDiscoveryResetStart,
|
|
5276
|
+
data: data
|
|
5277
|
+
});
|
|
4516
5278
|
});
|
|
4517
|
-
}
|
|
4518
|
-
|
|
4519
|
-
|
|
5279
|
+
} else {
|
|
5280
|
+
stytch.passwords.resetByEmailStart({
|
|
5281
|
+
email_address: email,
|
|
5282
|
+
organization_id: organization.organization_id,
|
|
5283
|
+
login_redirect_url: (_e = config.emailMagicLinksOptions) === null || _e === void 0 ? void 0 : _e.loginTemplateId,
|
|
5284
|
+
reset_password_redirect_url: (_f = config.passwordOptions) === null || _f === void 0 ? void 0 : _f.resetPasswordRedirectURL,
|
|
5285
|
+
reset_password_expiration_minutes: (_g = config.passwordOptions) === null || _g === void 0 ? void 0 : _g.resetPasswordExpirationMinutes,
|
|
5286
|
+
reset_password_template_id: (_h = config.passwordOptions) === null || _h === void 0 ? void 0 : _h.resetPasswordTemplateId
|
|
5287
|
+
}).then(function (data) {
|
|
5288
|
+
_t.success('Email resent');
|
|
5289
|
+
setIsSubmitting(false);
|
|
5290
|
+
onEvent({
|
|
5291
|
+
type: internal.StytchEventType.B2BPasswordResetByEmailStart,
|
|
5292
|
+
data: data
|
|
5293
|
+
});
|
|
5294
|
+
})["catch"](function (e) {
|
|
5295
|
+
onError(e);
|
|
5296
|
+
});
|
|
5297
|
+
}
|
|
4520
5298
|
};
|
|
4521
5299
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4522
5300
|
direction: "column",
|
|
@@ -4542,9 +5320,9 @@ var PasswordSetNew = function PasswordSetNew() {
|
|
|
4542
5320
|
}, "Resend email"))));
|
|
4543
5321
|
};
|
|
4544
5322
|
var PasswordsForgotForm = function PasswordsForgotForm() {
|
|
4545
|
-
var
|
|
4546
|
-
|
|
4547
|
-
dispatch =
|
|
5323
|
+
var _useGlobalReducer59 = useGlobalReducer(),
|
|
5324
|
+
_useGlobalReducer60 = _slicedToArray(_useGlobalReducer59, 2),
|
|
5325
|
+
dispatch = _useGlobalReducer60[1];
|
|
4548
5326
|
var config = useConfig();
|
|
4549
5327
|
var onEvent = useEventCallback();
|
|
4550
5328
|
var passwordOptions = config.passwordOptions;
|
|
@@ -4559,9 +5337,9 @@ var PasswordsForgotForm = function PasswordsForgotForm() {
|
|
|
4559
5337
|
setIsSubmitting = _usePasswordInput4.setIsSubmitting,
|
|
4560
5338
|
handleNonMemberReset = _usePasswordInput4.handleNonMemberReset;
|
|
4561
5339
|
if (!passwordOptions) return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
4562
|
-
if (!organization) return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
|
|
4563
5340
|
var handleSubmit = function handleSubmit(e) {
|
|
4564
5341
|
return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
5342
|
+
var _a, _b, _c, _d;
|
|
4565
5343
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
4566
5344
|
while (1) switch (_context7.prev = _context7.next) {
|
|
4567
5345
|
case 0:
|
|
@@ -4575,26 +5353,56 @@ var PasswordsForgotForm = function PasswordsForgotForm() {
|
|
|
4575
5353
|
case 4:
|
|
4576
5354
|
setErrorMessage('');
|
|
4577
5355
|
setIsSubmitting(true);
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
5356
|
+
if (organization) {
|
|
5357
|
+
internal.readB2BInternals(stytch).searchManager.searchMember(email, organization.organization_id).then(function (_ref104) {
|
|
5358
|
+
var member = _ref104.member;
|
|
5359
|
+
var _a, _b, _c, _d;
|
|
5360
|
+
if (!(member === null || member === void 0 ? void 0 : member.member_password_id)) {
|
|
5361
|
+
handleNonMemberReset();
|
|
5362
|
+
return;
|
|
5363
|
+
}
|
|
5364
|
+
stytch.passwords.resetByEmailStart({
|
|
5365
|
+
email_address: email,
|
|
5366
|
+
organization_id: organization.organization_id,
|
|
5367
|
+
login_redirect_url: (_a = config.emailMagicLinksOptions) === null || _a === void 0 ? void 0 : _a.loginRedirectURL,
|
|
5368
|
+
reset_password_redirect_url: (_b = config.passwordOptions) === null || _b === void 0 ? void 0 : _b.resetPasswordRedirectURL,
|
|
5369
|
+
reset_password_expiration_minutes: (_c = config.passwordOptions) === null || _c === void 0 ? void 0 : _c.resetPasswordExpirationMinutes,
|
|
5370
|
+
reset_password_template_id: (_d = config.passwordOptions) === null || _d === void 0 ? void 0 : _d.resetPasswordTemplateId
|
|
5371
|
+
}).then(function (data) {
|
|
5372
|
+
setIsSubmitting(false);
|
|
5373
|
+
onEvent({
|
|
5374
|
+
type: internal.StytchEventType.B2BPasswordResetByEmailStart,
|
|
5375
|
+
data: data
|
|
5376
|
+
});
|
|
5377
|
+
dispatch({
|
|
5378
|
+
type: 'set_password_state',
|
|
5379
|
+
email: email
|
|
5380
|
+
});
|
|
5381
|
+
dispatch({
|
|
5382
|
+
type: 'transition',
|
|
5383
|
+
screen: AppScreens$1.PasswordSetNewConfirmation
|
|
5384
|
+
});
|
|
5385
|
+
})["catch"](function (err) {
|
|
5386
|
+
setIsSubmitting(false);
|
|
5387
|
+
setErrorMessage(err.error_message);
|
|
5388
|
+
});
|
|
5389
|
+
})["catch"](function (err) {
|
|
5390
|
+
setIsSubmitting(false);
|
|
5391
|
+
var message = err.message;
|
|
5392
|
+
if (err instanceof internal.StytchAPIError) {
|
|
5393
|
+
message = err.error_message;
|
|
5394
|
+
}
|
|
5395
|
+
setErrorMessage(message);
|
|
5396
|
+
});
|
|
5397
|
+
} else {
|
|
5398
|
+
stytch.passwords.discovery.resetByEmailStart({
|
|
4586
5399
|
email_address: email,
|
|
4587
|
-
|
|
4588
|
-
login_redirect_url: (_a = config.emailMagicLinksOptions) === null || _a === void 0 ? void 0 : _a.loginRedirectURL,
|
|
5400
|
+
discovery_redirect_url: (_a = config.emailMagicLinksOptions) === null || _a === void 0 ? void 0 : _a.loginRedirectURL,
|
|
4589
5401
|
reset_password_redirect_url: (_b = config.passwordOptions) === null || _b === void 0 ? void 0 : _b.resetPasswordRedirectURL,
|
|
4590
5402
|
reset_password_expiration_minutes: (_c = config.passwordOptions) === null || _c === void 0 ? void 0 : _c.resetPasswordExpirationMinutes,
|
|
4591
5403
|
reset_password_template_id: (_d = config.passwordOptions) === null || _d === void 0 ? void 0 : _d.resetPasswordTemplateId
|
|
4592
|
-
}).then(function (
|
|
5404
|
+
}).then(function () {
|
|
4593
5405
|
setIsSubmitting(false);
|
|
4594
|
-
onEvent({
|
|
4595
|
-
type: internal.StytchEventType.B2BPasswordResetByEmailStart,
|
|
4596
|
-
data: data
|
|
4597
|
-
});
|
|
4598
5406
|
dispatch({
|
|
4599
5407
|
type: 'set_password_state',
|
|
4600
5408
|
email: email
|
|
@@ -4607,14 +5415,7 @@ var PasswordsForgotForm = function PasswordsForgotForm() {
|
|
|
4607
5415
|
setIsSubmitting(false);
|
|
4608
5416
|
setErrorMessage(err.error_message);
|
|
4609
5417
|
});
|
|
4610
|
-
}
|
|
4611
|
-
setIsSubmitting(false);
|
|
4612
|
-
var message = err.message;
|
|
4613
|
-
if (err instanceof internal.StytchAPIError) {
|
|
4614
|
-
message = err.error_message;
|
|
4615
|
-
}
|
|
4616
|
-
setErrorMessage(message);
|
|
4617
|
-
});
|
|
5418
|
+
}
|
|
4618
5419
|
case 7:
|
|
4619
5420
|
case "end":
|
|
4620
5421
|
return _context7.stop();
|
|
@@ -4636,7 +5437,7 @@ var PasswordsForgotForm = function PasswordsForgotForm() {
|
|
|
4636
5437
|
}
|
|
4637
5438
|
}), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
4638
5439
|
size: "header"
|
|
4639
|
-
}, "Check your email for help signing in!"), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "We'll email you a login link to sign in to your account directly or reset your password if you have one."), /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
5440
|
+
}, "Check your email for help signing in!"), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, !organization ? "We'll email you a login link to sign up for an account or reset your password if you have one." : "We'll email you a login link to sign in to your account directly or reset your password if you have one."), /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4640
5441
|
direction: "column",
|
|
4641
5442
|
gap: 4
|
|
4642
5443
|
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
@@ -4656,23 +5457,23 @@ var RecoveryCodeEntryScreen = function RecoveryCodeEntryScreen() {
|
|
|
4656
5457
|
var stytchClient = useStytch();
|
|
4657
5458
|
var _useConfig2 = useConfig(),
|
|
4658
5459
|
sessionDurationMinutes = _useConfig2.sessionOptions.sessionDurationMinutes;
|
|
4659
|
-
var
|
|
4660
|
-
|
|
4661
|
-
state =
|
|
4662
|
-
dispatch =
|
|
5460
|
+
var _useGlobalReducer61 = useGlobalReducer(),
|
|
5461
|
+
_useGlobalReducer62 = _slicedToArray(_useGlobalReducer61, 2),
|
|
5462
|
+
state = _useGlobalReducer62[0],
|
|
5463
|
+
dispatch = _useGlobalReducer62[1];
|
|
4663
5464
|
var _state$mfa$primaryInf = state.mfa.primaryInfo,
|
|
4664
5465
|
memberId = _state$mfa$primaryInf.memberId,
|
|
4665
5466
|
organizationId = _state$mfa$primaryInf.organizationId;
|
|
4666
|
-
var _extractErrorMessage$
|
|
4667
|
-
_extractErrorMessage$
|
|
4668
|
-
recoveryCode = _extractErrorMessage$
|
|
4669
|
-
setRecoveryCode = _extractErrorMessage$
|
|
4670
|
-
var _useMutate7 = useMutate('stytch.recoveryCodes.recover', function (_,
|
|
4671
|
-
var
|
|
4672
|
-
recoveryCode =
|
|
4673
|
-
memberId =
|
|
4674
|
-
organizationId =
|
|
4675
|
-
sessionDurationMinutes =
|
|
5467
|
+
var _extractErrorMessage$63 = extractErrorMessage.h(''),
|
|
5468
|
+
_extractErrorMessage$64 = _slicedToArray(_extractErrorMessage$63, 2),
|
|
5469
|
+
recoveryCode = _extractErrorMessage$64[0],
|
|
5470
|
+
setRecoveryCode = _extractErrorMessage$64[1];
|
|
5471
|
+
var _useMutate7 = useMutate('stytch.recoveryCodes.recover', function (_, _ref105) {
|
|
5472
|
+
var _ref105$arg = _ref105.arg,
|
|
5473
|
+
recoveryCode = _ref105$arg.recoveryCode,
|
|
5474
|
+
memberId = _ref105$arg.memberId,
|
|
5475
|
+
organizationId = _ref105$arg.organizationId,
|
|
5476
|
+
sessionDurationMinutes = _ref105$arg.sessionDurationMinutes;
|
|
4676
5477
|
return stytchClient.recoveryCodes.recover({
|
|
4677
5478
|
recovery_code: recoveryCode,
|
|
4678
5479
|
member_id: memberId,
|
|
@@ -4742,8 +5543,8 @@ var RecoveryCodeEntryScreen = function RecoveryCodeEntryScreen() {
|
|
|
4742
5543
|
isSubmitting: isSubmitting
|
|
4743
5544
|
})));
|
|
4744
5545
|
};
|
|
4745
|
-
var InsetContainer = extractErrorMessage.He.div(
|
|
4746
|
-
var CodeList = extractErrorMessage.He.ul(
|
|
5546
|
+
var InsetContainer = extractErrorMessage.He.div(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n background-color: #f3f5f6;\n color: #000;\n font-size: 16px;\n line-height: 28px;\n display: flex;\n align-items: flex-start;\n justify-content: center;\n gap: 8px;\n padding: 16px 8px;\n"])));
|
|
5547
|
+
var CodeList = extractErrorMessage.He.ul(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n list-style: none;\n padding: 0;\n margin: 0;\n"])));
|
|
4747
5548
|
var downloadFile = function downloadFile(content, filename) {
|
|
4748
5549
|
var blob = new Blob([content], {
|
|
4749
5550
|
type: 'text/plain'
|
|
@@ -4756,10 +5557,10 @@ var downloadFile = function downloadFile(content, filename) {
|
|
|
4756
5557
|
URL.revokeObjectURL(url);
|
|
4757
5558
|
};
|
|
4758
5559
|
var RecoveryCodeSaveScreen = function RecoveryCodeSaveScreen() {
|
|
4759
|
-
var
|
|
4760
|
-
|
|
4761
|
-
state =
|
|
4762
|
-
dispatch =
|
|
5560
|
+
var _useGlobalReducer63 = useGlobalReducer(),
|
|
5561
|
+
_useGlobalReducer64 = _slicedToArray(_useGlobalReducer63, 2),
|
|
5562
|
+
state = _useGlobalReducer64[0],
|
|
5563
|
+
dispatch = _useGlobalReducer64[1];
|
|
4763
5564
|
var recoveryCodes = state.mfa.totp.enrollment.recoveryCodes;
|
|
4764
5565
|
var handleContinue = function handleContinue() {
|
|
4765
5566
|
dispatch({
|
|
@@ -4817,7 +5618,7 @@ var RecoveryCodeSaveScreen = function RecoveryCodeSaveScreen() {
|
|
|
4817
5618
|
onClick: handleContinue
|
|
4818
5619
|
}, "Done"));
|
|
4819
5620
|
};
|
|
4820
|
-
var Select = extractErrorMessage.He.select(
|
|
5621
|
+
var Select = extractErrorMessage.He.select(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", ";\n height: 47px;\n box-sizing: border-box;\n padding: 0 8px;\n color: ", ";\n font-family: ", ";\n width: 80px;\n font-size: 18px;\n"])), function (props) {
|
|
4821
5622
|
return props.theme.inputs.backgroundColor;
|
|
4822
5623
|
}, function (props) {
|
|
4823
5624
|
return props.theme.inputs.borderColor;
|
|
@@ -4828,9 +5629,9 @@ var Select = extractErrorMessage.He.select(_templateObject54 || (_templateObject
|
|
|
4828
5629
|
}, function (props) {
|
|
4829
5630
|
return props.theme.typography.fontFamily;
|
|
4830
5631
|
});
|
|
4831
|
-
var CountrySelector = function CountrySelector(
|
|
4832
|
-
var country =
|
|
4833
|
-
setCountry =
|
|
5632
|
+
var CountrySelector = function CountrySelector(_ref106) {
|
|
5633
|
+
var country = _ref106.country,
|
|
5634
|
+
setCountry = _ref106.setCountry;
|
|
4834
5635
|
var countryFormatter = new Intl.DisplayNames(['en'], {
|
|
4835
5636
|
type: 'region'
|
|
4836
5637
|
});
|
|
@@ -4841,24 +5642,24 @@ var CountrySelector = function CountrySelector(_ref84) {
|
|
|
4841
5642
|
onChange: function onChange(e) {
|
|
4842
5643
|
setCountry(e.target.value);
|
|
4843
5644
|
}
|
|
4844
|
-
}, Object.entries(internal.COUNTRIES_LIST).map(function (
|
|
4845
|
-
var
|
|
4846
|
-
countryCode =
|
|
4847
|
-
countryNumber =
|
|
5645
|
+
}, Object.entries(internal.COUNTRIES_LIST).map(function (_ref107) {
|
|
5646
|
+
var _ref108 = _slicedToArray(_ref107, 2),
|
|
5647
|
+
countryCode = _ref108[0],
|
|
5648
|
+
countryNumber = _ref108[1];
|
|
4848
5649
|
return /*#__PURE__*/extractErrorMessage.wn.createElement("option", {
|
|
4849
5650
|
key: countryCode,
|
|
4850
5651
|
value: countryCode
|
|
4851
5652
|
}, countryCode !== country ? "+".concat(countryNumber, " ").concat(countryFormatter.of(countryCode)) : "+".concat(countryNumber));
|
|
4852
5653
|
}));
|
|
4853
5654
|
};
|
|
4854
|
-
var PhoneStyledInput = extractErrorMessage.He(Input)(
|
|
4855
|
-
var PhoneInput = function PhoneInput(
|
|
4856
|
-
var phone =
|
|
4857
|
-
setPhone =
|
|
4858
|
-
country =
|
|
4859
|
-
setCountry =
|
|
4860
|
-
parsePhoneNumber =
|
|
4861
|
-
hasPasskeys =
|
|
5655
|
+
var PhoneStyledInput = extractErrorMessage.He(Input)(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n flex-grow: 1;\n min-width: 100px;\n"])));
|
|
5656
|
+
var PhoneInput = function PhoneInput(_ref109) {
|
|
5657
|
+
var phone = _ref109.phone,
|
|
5658
|
+
setPhone = _ref109.setPhone,
|
|
5659
|
+
country = _ref109.country,
|
|
5660
|
+
setCountry = _ref109.setCountry,
|
|
5661
|
+
parsePhoneNumber = _ref109.parsePhoneNumber,
|
|
5662
|
+
hasPasskeys = _ref109.hasPasskeys;
|
|
4862
5663
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
4863
5664
|
direction: "row",
|
|
4864
5665
|
wrap: "nowrap",
|
|
@@ -4920,8 +5721,8 @@ var InvalidPhoneNumberError = /*#__PURE__*/function (_internal$StytchSDKEr) {
|
|
|
4920
5721
|
}
|
|
4921
5722
|
return _createClass(InvalidPhoneNumberError);
|
|
4922
5723
|
}(internal.StytchSDKError);
|
|
4923
|
-
var findErrorTypeFrom = function findErrorTypeFrom(
|
|
4924
|
-
var error =
|
|
5724
|
+
var findErrorTypeFrom = function findErrorTypeFrom(_ref110) {
|
|
5725
|
+
var error = _ref110.error;
|
|
4925
5726
|
var errorType = extractErrorType(error);
|
|
4926
5727
|
return !!errorType && errorType in supportedErrorTypeMap ? errorType : 'default';
|
|
4927
5728
|
};
|
|
@@ -4932,10 +5733,10 @@ var supportedErrorTypeMap = {
|
|
|
4932
5733
|
var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
|
|
4933
5734
|
var _a, _b;
|
|
4934
5735
|
var stytchClient = useStytch();
|
|
4935
|
-
var
|
|
4936
|
-
|
|
4937
|
-
state =
|
|
4938
|
-
dispatch =
|
|
5736
|
+
var _useGlobalReducer65 = useGlobalReducer(),
|
|
5737
|
+
_useGlobalReducer66 = _slicedToArray(_useGlobalReducer65, 2),
|
|
5738
|
+
state = _useGlobalReducer66[0],
|
|
5739
|
+
dispatch = _useGlobalReducer66[1];
|
|
4939
5740
|
var _state$mfa$smsOtp = state.mfa.smsOtp,
|
|
4940
5741
|
isSending = _state$mfa$smsOtp.isSending,
|
|
4941
5742
|
sendError = _state$mfa$smsOtp.sendError,
|
|
@@ -4943,14 +5744,14 @@ var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
|
|
|
4943
5744
|
var _state$mfa$primaryInf2 = state.mfa.primaryInfo,
|
|
4944
5745
|
memberId = _state$mfa$primaryInf2.memberId,
|
|
4945
5746
|
organizationId = _state$mfa$primaryInf2.organizationId;
|
|
4946
|
-
var _extractErrorMessage$
|
|
4947
|
-
_extractErrorMessage$
|
|
4948
|
-
countryCode = _extractErrorMessage$
|
|
4949
|
-
setCountryCode = _extractErrorMessage$
|
|
4950
|
-
var _extractErrorMessage$
|
|
4951
|
-
_extractErrorMessage$
|
|
4952
|
-
phoneNumber = _extractErrorMessage$
|
|
4953
|
-
setPhoneNumber = _extractErrorMessage$
|
|
5747
|
+
var _extractErrorMessage$65 = extractErrorMessage.wn.useState((_a = enrolledNumber === null || enrolledNumber === void 0 ? void 0 : enrolledNumber.countryCode) !== null && _a !== void 0 ? _a : DEFAULT_COUNTRY_CODE),
|
|
5748
|
+
_extractErrorMessage$66 = _slicedToArray(_extractErrorMessage$65, 2),
|
|
5749
|
+
countryCode = _extractErrorMessage$66[0],
|
|
5750
|
+
setCountryCode = _extractErrorMessage$66[1];
|
|
5751
|
+
var _extractErrorMessage$67 = extractErrorMessage.wn.useState((_b = enrolledNumber === null || enrolledNumber === void 0 ? void 0 : enrolledNumber.phoneNumber) !== null && _b !== void 0 ? _b : ''),
|
|
5752
|
+
_extractErrorMessage$68 = _slicedToArray(_extractErrorMessage$67, 2),
|
|
5753
|
+
phoneNumber = _extractErrorMessage$68[0],
|
|
5754
|
+
setPhoneNumber = _extractErrorMessage$68[1];
|
|
4954
5755
|
var errorType = findErrorTypeFrom({
|
|
4955
5756
|
error: sendError
|
|
4956
5757
|
});
|
|
@@ -4961,8 +5762,8 @@ var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
|
|
|
4961
5762
|
regionCode: countryCode
|
|
4962
5763
|
});
|
|
4963
5764
|
};
|
|
4964
|
-
var _useMutate8 = useMutate('stytch.otps.sms.send', function (_,
|
|
4965
|
-
var parsedNumber =
|
|
5765
|
+
var _useMutate8 = useMutate('stytch.otps.sms.send', function (_, _ref111) {
|
|
5766
|
+
var parsedNumber = _ref111.arg.parsedNumber;
|
|
4966
5767
|
return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
4967
5768
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
4968
5769
|
while (1) switch (_context11.prev = _context11.next) {
|
|
@@ -5061,252 +5862,15 @@ var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
|
|
|
5061
5862
|
disabled: !phoneNumber
|
|
5062
5863
|
})));
|
|
5063
5864
|
};
|
|
5064
|
-
var InlineButton = function InlineButton(_ref90) {
|
|
5065
|
-
var onClick = _ref90.onClick,
|
|
5066
|
-
children = _ref90.children;
|
|
5067
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement("button", {
|
|
5068
|
-
onClick: onClick,
|
|
5069
|
-
style: {
|
|
5070
|
-
all: 'unset'
|
|
5071
|
-
}
|
|
5072
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement("b", {
|
|
5073
|
-
style: {
|
|
5074
|
-
cursor: 'pointer'
|
|
5075
|
-
}
|
|
5076
|
-
}, children));
|
|
5077
|
-
};
|
|
5078
|
-
var Wrapper = extractErrorMessage.He.div(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-rows: ", ";\n transition: grid-template-rows 0.15s ease-out;\n"])), function (_ref91) {
|
|
5079
|
-
var isOpen = _ref91.isOpen;
|
|
5080
|
-
return isOpen ? '1fr' : '0fr';
|
|
5081
|
-
});
|
|
5082
|
-
var Inner = extractErrorMessage.He.div(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n overflow: hidden;\n"])));
|
|
5083
|
-
var AnimatedContainer = function AnimatedContainer(_ref92) {
|
|
5084
|
-
var isOpen = _ref92.isOpen,
|
|
5085
|
-
children = _ref92.children;
|
|
5086
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(Wrapper, {
|
|
5087
|
-
isOpen: isOpen
|
|
5088
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Inner, null, children));
|
|
5089
|
-
};
|
|
5090
|
-
var Container = extractErrorMessage.He.div(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n border-radius: 3px;\n overflow: hidden;\n"])), function (_ref93) {
|
|
5091
|
-
var theme = _ref93.theme;
|
|
5092
|
-
return theme.colors.disabled;
|
|
5093
|
-
});
|
|
5094
|
-
var loading = extractErrorMessage.Ue(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(-1%);\n }\n"])));
|
|
5095
|
-
var Progress = extractErrorMessage.He.div(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n height: 100%;\n width: 100%;\n background-color: ", ";\n animation: ", " 10s cubic-bezier(0.22, 1, 0.36, 1);\n"])), function (_ref94) {
|
|
5096
|
-
var theme = _ref94.theme;
|
|
5097
|
-
return theme.colors.primary;
|
|
5098
|
-
}, loading);
|
|
5099
|
-
var LoadingBar = function LoadingBar(_ref95) {
|
|
5100
|
-
var isLoading = _ref95.isLoading;
|
|
5101
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(Container, null, isLoading && /*#__PURE__*/extractErrorMessage.wn.createElement(Progress, null));
|
|
5102
|
-
};
|
|
5103
|
-
var GAP = '8px';
|
|
5104
|
-
var WIDTH = '46px';
|
|
5105
|
-
var INPUT_HEIGHT = '46px';
|
|
5106
|
-
var Digit = extractErrorMessage.He.div(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: 4px;\n align-items: center;\n display: flex;\n font-size: 18px;\n justify-content: center;\n height: ", ";\n width: ", ";\n background: ", ";\n color: ", ";\n"])), function (_ref96) {
|
|
5107
|
-
var disabled = _ref96.disabled,
|
|
5108
|
-
theme = _ref96.theme;
|
|
5109
|
-
return disabled ? theme.colors.disabled : '#ADBCC5';
|
|
5110
|
-
}, INPUT_HEIGHT, WIDTH, function (_ref97) {
|
|
5111
|
-
var disabled = _ref97.disabled,
|
|
5112
|
-
theme = _ref97.theme;
|
|
5113
|
-
return disabled ? theme.colors.disabled : theme.inputs.backgroundColor;
|
|
5114
|
-
}, function (_ref98) {
|
|
5115
|
-
var disabled = _ref98.disabled,
|
|
5116
|
-
theme = _ref98.theme;
|
|
5117
|
-
return disabled ? theme.colors.disabledText : theme.inputs.textColor;
|
|
5118
|
-
});
|
|
5119
|
-
var digitsContainerStyles = {
|
|
5120
|
-
display: 'flex',
|
|
5121
|
-
justifyContent: 'space-between',
|
|
5122
|
-
gap: GAP,
|
|
5123
|
-
position: 'relative',
|
|
5124
|
-
zIndex: -1
|
|
5125
|
-
};
|
|
5126
|
-
var otpContainerStyles = {
|
|
5127
|
-
overflow: 'hidden',
|
|
5128
|
-
position: 'relative',
|
|
5129
|
-
textAlign: 'initial',
|
|
5130
|
-
zIndex: 1
|
|
5131
|
-
};
|
|
5132
|
-
var invisibleInputStyles = {
|
|
5133
|
-
background: 'transparent',
|
|
5134
|
-
border: 'none',
|
|
5135
|
-
color: 'transparent',
|
|
5136
|
-
height: INPUT_HEIGHT,
|
|
5137
|
-
margin: 0,
|
|
5138
|
-
outline: 'none',
|
|
5139
|
-
position: 'absolute',
|
|
5140
|
-
width: "calc(100% - (0.5 * ".concat(WIDTH, "))"),
|
|
5141
|
-
caretColor: '#ADBCC5',
|
|
5142
|
-
letterSpacing: "calc(".concat(WIDTH, " - 1ch + ").concat(GAP, ")"),
|
|
5143
|
-
paddingLeft: "calc(0.5 * ".concat(WIDTH, ")"),
|
|
5144
|
-
zIndex: 10
|
|
5145
|
-
};
|
|
5146
|
-
var DigitAtIndex = function DigitAtIndex(_ref99) {
|
|
5147
|
-
var index = _ref99.index,
|
|
5148
|
-
disabled = _ref99.disabled,
|
|
5149
|
-
otp = _ref99.otp;
|
|
5150
|
-
var fill = otp ? otp[index] : '';
|
|
5151
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(Digit, {
|
|
5152
|
-
disabled: disabled,
|
|
5153
|
-
"data-testid": "otp-".concat(index)
|
|
5154
|
-
}, fill);
|
|
5155
|
-
};
|
|
5156
|
-
var OTPInput = function OTPInput(_ref100) {
|
|
5157
|
-
var otp = _ref100.otp,
|
|
5158
|
-
setOtp = _ref100.setOtp,
|
|
5159
|
-
disabled = _ref100.disabled;
|
|
5160
|
-
var onPasscodeChange = function onPasscodeChange(e) {
|
|
5161
|
-
if (!/^\d*$/.test(e.target.value)) {
|
|
5162
|
-
return;
|
|
5163
|
-
}
|
|
5164
|
-
setOtp(e.target.value);
|
|
5165
|
-
};
|
|
5166
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement("div", {
|
|
5167
|
-
style: otpContainerStyles
|
|
5168
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement("input", Object.assign({
|
|
5169
|
-
"aria-label": "One-time passcode",
|
|
5170
|
-
autoComplete: "one-time-code",
|
|
5171
|
-
autoFocus: true,
|
|
5172
|
-
disabled: disabled,
|
|
5173
|
-
style: invisibleInputStyles,
|
|
5174
|
-
maxLength: 6,
|
|
5175
|
-
onChange: onPasscodeChange,
|
|
5176
|
-
type: "text",
|
|
5177
|
-
inputMode: "numeric",
|
|
5178
|
-
value: otp
|
|
5179
|
-
}, extractErrorMessage.passwordManagerDisableAutofillProps)), /*#__PURE__*/extractErrorMessage.wn.createElement("div", {
|
|
5180
|
-
style: digitsContainerStyles
|
|
5181
|
-
}, _toConsumableArray(Array(6).keys()).map(function (i) {
|
|
5182
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(DigitAtIndex, {
|
|
5183
|
-
key: "digit-".concat(i),
|
|
5184
|
-
index: i,
|
|
5185
|
-
otp: otp,
|
|
5186
|
-
disabled: !!disabled
|
|
5187
|
-
});
|
|
5188
|
-
})));
|
|
5189
|
-
};
|
|
5190
|
-
var OTP_CODE_LENGTH = 6;
|
|
5191
|
-
var OTPControl = function OTPControl(_ref101) {
|
|
5192
|
-
var isSubmitting = _ref101.isSubmitting,
|
|
5193
|
-
onSubmit = _ref101.onSubmit,
|
|
5194
|
-
errorMessage = _ref101.errorMessage;
|
|
5195
|
-
var _extractErrorMessage$65 = extractErrorMessage.h(''),
|
|
5196
|
-
_extractErrorMessage$66 = _slicedToArray(_extractErrorMessage$65, 2),
|
|
5197
|
-
otp = _extractErrorMessage$66[0],
|
|
5198
|
-
setOtp = _extractErrorMessage$66[1];
|
|
5199
|
-
var handleOtpChange = function handleOtpChange(otp) {
|
|
5200
|
-
setOtp(otp);
|
|
5201
|
-
if (otp.length === OTP_CODE_LENGTH) {
|
|
5202
|
-
onSubmit(otp);
|
|
5203
|
-
}
|
|
5204
|
-
};
|
|
5205
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
5206
|
-
direction: "column",
|
|
5207
|
-
maxWidth: 316
|
|
5208
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(OTPInput, {
|
|
5209
|
-
otp: otp,
|
|
5210
|
-
setOtp: handleOtpChange,
|
|
5211
|
-
disabled: isSubmitting
|
|
5212
|
-
}), /*#__PURE__*/extractErrorMessage.wn.createElement(AnimatedContainer, {
|
|
5213
|
-
isOpen: isSubmitting
|
|
5214
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
5215
|
-
direction: "column",
|
|
5216
|
-
gap: 8,
|
|
5217
|
-
marginTop: 8
|
|
5218
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
5219
|
-
color: "secondary",
|
|
5220
|
-
size: "helper"
|
|
5221
|
-
}, "Verifying passcode..."), /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingBar, {
|
|
5222
|
-
isLoading: isSubmitting
|
|
5223
|
-
}))), !isSubmitting && /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorText, {
|
|
5224
|
-
errorMessage: errorMessage !== null && errorMessage !== void 0 ? errorMessage : ''
|
|
5225
|
-
}));
|
|
5226
|
-
};
|
|
5227
|
-
var OTPEntry = function OTPEntry(_ref102) {
|
|
5228
|
-
var header = _ref102.header,
|
|
5229
|
-
helperContent = _ref102.helperContent,
|
|
5230
|
-
instruction = _ref102.instruction,
|
|
5231
|
-
isSubmitting = _ref102.isSubmitting,
|
|
5232
|
-
onSubmit = _ref102.onSubmit,
|
|
5233
|
-
errorMessage = _ref102.errorMessage;
|
|
5234
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
5235
|
-
direction: "column",
|
|
5236
|
-
gap: 24
|
|
5237
|
-
}, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
5238
|
-
size: "header"
|
|
5239
|
-
}, header), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, instruction), /*#__PURE__*/extractErrorMessage.wn.createElement(OTPControl, {
|
|
5240
|
-
isSubmitting: isSubmitting,
|
|
5241
|
-
onSubmit: onSubmit,
|
|
5242
|
-
errorMessage: errorMessage
|
|
5243
|
-
}), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
|
|
5244
|
-
size: "helper",
|
|
5245
|
-
color: "secondary"
|
|
5246
|
-
}, helperContent));
|
|
5247
|
-
};
|
|
5248
|
-
var getSecondsRemaining = function getSecondsRemaining(expiration) {
|
|
5249
|
-
var now = new Date();
|
|
5250
|
-
return Math.ceil((expiration.getTime() - now.getTime()) / 1000);
|
|
5251
|
-
};
|
|
5252
|
-
var ExpirationMessage = function ExpirationMessage(_ref103) {
|
|
5253
|
-
var expiration = _ref103.expiration,
|
|
5254
|
-
resendOTP = _ref103.resendOTP;
|
|
5255
|
-
var _extractErrorMessage$67 = extractErrorMessage.h(function () {
|
|
5256
|
-
return getSecondsRemaining(expiration);
|
|
5257
|
-
}),
|
|
5258
|
-
_extractErrorMessage$68 = _slicedToArray(_extractErrorMessage$67, 2),
|
|
5259
|
-
seconds = _extractErrorMessage$68[0],
|
|
5260
|
-
setSeconds = _extractErrorMessage$68[1];
|
|
5261
|
-
var codeExpired = seconds <= 0;
|
|
5262
|
-
extractErrorMessage.p(function () {
|
|
5263
|
-
if (!codeExpired) {
|
|
5264
|
-
var updateSeconds = function updateSeconds() {
|
|
5265
|
-
return setSeconds(getSecondsRemaining(expiration));
|
|
5266
|
-
};
|
|
5267
|
-
var interval = setInterval(updateSeconds, 1000);
|
|
5268
|
-
updateSeconds();
|
|
5269
|
-
return function () {
|
|
5270
|
-
return clearInterval(interval);
|
|
5271
|
-
};
|
|
5272
|
-
}
|
|
5273
|
-
}, [codeExpired, expiration]);
|
|
5274
|
-
var displayMinutes = Math.floor(Number(seconds / 60));
|
|
5275
|
-
var displaySeconds = seconds - displayMinutes * 60;
|
|
5276
|
-
var formattedTime = "".concat(displayMinutes, ":").concat(displaySeconds < 10 ? "0".concat(displaySeconds) : displaySeconds);
|
|
5277
|
-
var formattedText = seconds > 0 ? "Your code expires in ".concat(formattedTime, ". Didn't get it? ") : 'Your code has expired. ';
|
|
5278
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, formattedText, /*#__PURE__*/extractErrorMessage.wn.createElement(InlineButton, {
|
|
5279
|
-
onClick: resendOTP
|
|
5280
|
-
}, "Resend code"));
|
|
5281
|
-
};
|
|
5282
|
-
var SentOTPEntry = function SentOTPEntry(_ref104) {
|
|
5283
|
-
var expiration = _ref104.expiration,
|
|
5284
|
-
formattedDestination = _ref104.formattedDestination,
|
|
5285
|
-
isSubmitting = _ref104.isSubmitting,
|
|
5286
|
-
onSubmit = _ref104.onSubmit,
|
|
5287
|
-
errorMessage = _ref104.errorMessage,
|
|
5288
|
-
resendOTP = _ref104.resendOTP;
|
|
5289
|
-
return /*#__PURE__*/extractErrorMessage.wn.createElement(OTPEntry, {
|
|
5290
|
-
header: "Enter passcode",
|
|
5291
|
-
helperContent: /*#__PURE__*/extractErrorMessage.wn.createElement(ExpirationMessage, {
|
|
5292
|
-
expiration: expiration,
|
|
5293
|
-
resendOTP: resendOTP
|
|
5294
|
-
}),
|
|
5295
|
-
instruction: /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, "A 6-digit passcode was sent to you at ", /*#__PURE__*/extractErrorMessage.wn.createElement("b", null, formattedDestination), "."),
|
|
5296
|
-
isSubmitting: isSubmitting,
|
|
5297
|
-
onSubmit: onSubmit,
|
|
5298
|
-
errorMessage: errorMessage
|
|
5299
|
-
});
|
|
5300
|
-
};
|
|
5301
5865
|
var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
|
|
5302
5866
|
var _a;
|
|
5303
5867
|
var stytchClient = useStytch();
|
|
5304
5868
|
var _useConfig3 = useConfig(),
|
|
5305
5869
|
sessionDurationMinutes = _useConfig3.sessionOptions.sessionDurationMinutes;
|
|
5306
|
-
var
|
|
5307
|
-
|
|
5308
|
-
state =
|
|
5309
|
-
dispatch =
|
|
5870
|
+
var _useGlobalReducer67 = useGlobalReducer(),
|
|
5871
|
+
_useGlobalReducer68 = _slicedToArray(_useGlobalReducer67, 2),
|
|
5872
|
+
state = _useGlobalReducer68[0],
|
|
5873
|
+
dispatch = _useGlobalReducer68[1];
|
|
5310
5874
|
var _state$mfa = state.mfa,
|
|
5311
5875
|
isEnrolling = _state$mfa.isEnrolling,
|
|
5312
5876
|
_state$mfa$smsOtp2 = _state$mfa.smsOtp,
|
|
@@ -5318,10 +5882,10 @@ var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
|
|
|
5318
5882
|
memberPhoneNumber = _state$mfa$primaryInf3.memberPhoneNumber,
|
|
5319
5883
|
organizationId = _state$mfa$primaryInf3.organizationId,
|
|
5320
5884
|
organizationMfaOptionsSupported = _state$mfa$primaryInf3.organizationMfaOptionsSupported;
|
|
5321
|
-
var _useMutate9 = useMutate('stytch.otps.sms.send', function (_,
|
|
5322
|
-
var
|
|
5323
|
-
memberId =
|
|
5324
|
-
organizationId =
|
|
5885
|
+
var _useMutate9 = useMutate('stytch.otps.sms.send', function (_, _ref112) {
|
|
5886
|
+
var _ref112$arg = _ref112.arg,
|
|
5887
|
+
memberId = _ref112$arg.memberId,
|
|
5888
|
+
organizationId = _ref112$arg.organizationId;
|
|
5325
5889
|
dispatch({
|
|
5326
5890
|
type: 'sms_otp/send'
|
|
5327
5891
|
});
|
|
@@ -5350,12 +5914,12 @@ var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
|
|
|
5350
5914
|
sendSms = _useMutate9.trigger,
|
|
5351
5915
|
isSending = _useMutate9.isMutating,
|
|
5352
5916
|
sendError = _useMutate9.error;
|
|
5353
|
-
var _useMutate10 = useMutate('stytch.otps.sms.authenticate', function (_,
|
|
5354
|
-
var
|
|
5355
|
-
otp =
|
|
5356
|
-
memberId =
|
|
5357
|
-
organizationId =
|
|
5358
|
-
sessionDurationMinutes =
|
|
5917
|
+
var _useMutate10 = useMutate('stytch.otps.sms.authenticate', function (_, _ref113) {
|
|
5918
|
+
var _ref113$arg = _ref113.arg,
|
|
5919
|
+
otp = _ref113$arg.otp,
|
|
5920
|
+
memberId = _ref113$arg.memberId,
|
|
5921
|
+
organizationId = _ref113$arg.organizationId,
|
|
5922
|
+
sessionDurationMinutes = _ref113$arg.sessionDurationMinutes;
|
|
5359
5923
|
return stytchClient.otps.sms.authenticate({
|
|
5360
5924
|
code: otp,
|
|
5361
5925
|
member_id: memberId,
|
|
@@ -5484,10 +6048,10 @@ var CodeContainer = extractErrorMessage.He(InsetContainer)(_templateObject63 ||
|
|
|
5484
6048
|
var Spacer = extractErrorMessage.He.div(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n flex: 0 1 24px;\n"])));
|
|
5485
6049
|
var Code = extractErrorMessage.He.code(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n white-space: pre-wrap;\n align-self: center;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n gap: 1ch;\n"])));
|
|
5486
6050
|
var TOTPEnrollManualScreen = function TOTPEnrollManualScreen() {
|
|
5487
|
-
var
|
|
5488
|
-
|
|
5489
|
-
state =
|
|
5490
|
-
dispatch =
|
|
6051
|
+
var _useGlobalReducer69 = useGlobalReducer(),
|
|
6052
|
+
_useGlobalReducer70 = _slicedToArray(_useGlobalReducer69, 2),
|
|
6053
|
+
state = _useGlobalReducer70[0],
|
|
6054
|
+
dispatch = _useGlobalReducer70[1];
|
|
5491
6055
|
var secret = state.mfa.totp.enrollment.secret;
|
|
5492
6056
|
var displaySecret = secret.toLowerCase();
|
|
5493
6057
|
var secretChunked = displaySecret.split(/(.{4})/g).filter(Boolean);
|
|
@@ -5555,10 +6119,10 @@ var TOTPEnrollManualScreen = function TOTPEnrollManualScreen() {
|
|
|
5555
6119
|
var QRCodeImg = extractErrorMessage.He.img(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n margin: 0 auto;\n"])));
|
|
5556
6120
|
var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
|
|
5557
6121
|
var stytchClient = useStytch();
|
|
5558
|
-
var
|
|
5559
|
-
|
|
5560
|
-
state =
|
|
5561
|
-
dispatch =
|
|
6122
|
+
var _useGlobalReducer71 = useGlobalReducer(),
|
|
6123
|
+
_useGlobalReducer72 = _slicedToArray(_useGlobalReducer71, 2),
|
|
6124
|
+
state = _useGlobalReducer72[0],
|
|
6125
|
+
dispatch = _useGlobalReducer72[1];
|
|
5562
6126
|
var _state$mfa$totp = state.mfa.totp,
|
|
5563
6127
|
createError = _state$mfa$totp.createError,
|
|
5564
6128
|
enrollment = _state$mfa$totp.enrollment,
|
|
@@ -5566,10 +6130,10 @@ var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
|
|
|
5566
6130
|
var _state$mfa$primaryInf4 = state.mfa.primaryInfo,
|
|
5567
6131
|
memberId = _state$mfa$primaryInf4.memberId,
|
|
5568
6132
|
organizationId = _state$mfa$primaryInf4.organizationId;
|
|
5569
|
-
var _useMutate11 = useMutate('stytch.totp.create', function (_,
|
|
5570
|
-
var
|
|
5571
|
-
memberId =
|
|
5572
|
-
organizationId =
|
|
6133
|
+
var _useMutate11 = useMutate('stytch.totp.create', function (_, _ref114) {
|
|
6134
|
+
var _ref114$arg = _ref114.arg,
|
|
6135
|
+
memberId = _ref114$arg.memberId,
|
|
6136
|
+
organizationId = _ref114$arg.organizationId;
|
|
5573
6137
|
dispatch({
|
|
5574
6138
|
type: 'totp/create'
|
|
5575
6139
|
});
|
|
@@ -5635,11 +6199,11 @@ var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
|
|
|
5635
6199
|
onClick: handleContinue
|
|
5636
6200
|
}, "Continue"))) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingScreen, null)));
|
|
5637
6201
|
};
|
|
5638
|
-
var TOTPEntry = function TOTPEntry(
|
|
5639
|
-
var helperContent =
|
|
5640
|
-
isSubmitting =
|
|
5641
|
-
onSubmit =
|
|
5642
|
-
errorMessage =
|
|
6202
|
+
var TOTPEntry = function TOTPEntry(_ref115) {
|
|
6203
|
+
var helperContent = _ref115.helperContent,
|
|
6204
|
+
isSubmitting = _ref115.isSubmitting,
|
|
6205
|
+
onSubmit = _ref115.onSubmit,
|
|
6206
|
+
errorMessage = _ref115.errorMessage;
|
|
5643
6207
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(OTPEntry, {
|
|
5644
6208
|
header: "Enter verification code",
|
|
5645
6209
|
instruction: "Enter the 6-digit code from your authenticator app.",
|
|
@@ -5653,22 +6217,22 @@ var TOTPEntryScreen = function TOTPEntryScreen() {
|
|
|
5653
6217
|
var stytchClient = useStytch();
|
|
5654
6218
|
var _useConfig4 = useConfig(),
|
|
5655
6219
|
sessionDurationMinutes = _useConfig4.sessionOptions.sessionDurationMinutes;
|
|
5656
|
-
var
|
|
5657
|
-
|
|
5658
|
-
state =
|
|
5659
|
-
dispatch =
|
|
6220
|
+
var _useGlobalReducer73 = useGlobalReducer(),
|
|
6221
|
+
_useGlobalReducer74 = _slicedToArray(_useGlobalReducer73, 2),
|
|
6222
|
+
state = _useGlobalReducer74[0],
|
|
6223
|
+
dispatch = _useGlobalReducer74[1];
|
|
5660
6224
|
var isEnrolling = state.mfa.isEnrolling;
|
|
5661
6225
|
var _state$mfa$primaryInf5 = state.mfa.primaryInfo,
|
|
5662
6226
|
enrolledMfaMethods = _state$mfa$primaryInf5.enrolledMfaMethods,
|
|
5663
6227
|
memberId = _state$mfa$primaryInf5.memberId,
|
|
5664
6228
|
organizationId = _state$mfa$primaryInf5.organizationId,
|
|
5665
6229
|
organizationMfaOptionsSupported = _state$mfa$primaryInf5.organizationMfaOptionsSupported;
|
|
5666
|
-
var _useMutate12 = useMutate('stytch.totp.authenticate', function (_,
|
|
5667
|
-
var
|
|
5668
|
-
memberId =
|
|
5669
|
-
organizationId =
|
|
5670
|
-
otp =
|
|
5671
|
-
sessionDurationMinutes =
|
|
6230
|
+
var _useMutate12 = useMutate('stytch.totp.authenticate', function (_, _ref116) {
|
|
6231
|
+
var _ref116$arg = _ref116.arg,
|
|
6232
|
+
memberId = _ref116$arg.memberId,
|
|
6233
|
+
organizationId = _ref116$arg.organizationId,
|
|
6234
|
+
otp = _ref116$arg.otp,
|
|
6235
|
+
sessionDurationMinutes = _ref116$arg.sessionDurationMinutes;
|
|
5672
6236
|
return stytchClient.totp.authenticate({
|
|
5673
6237
|
code: otp,
|
|
5674
6238
|
member_id: memberId,
|
|
@@ -5741,49 +6305,49 @@ var TOTPEntryScreen = function TOTPEntryScreen() {
|
|
|
5741
6305
|
onClick: handleSwitchToSms
|
|
5742
6306
|
}, "Text me a code instead"))));
|
|
5743
6307
|
};
|
|
5744
|
-
var MainContainer = extractErrorMessage.He.div(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n width: ", ";\n font-family: ", ";\n box-sizing: border-box;\n * {\n box-sizing: content-box;\n }\n background-color: ", ";\n border: ", ";\n border-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-bottom: ", ";\n"])), function (
|
|
5745
|
-
var theme =
|
|
6308
|
+
var MainContainer = extractErrorMessage.He.div(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n width: ", ";\n font-family: ", ";\n box-sizing: border-box;\n * {\n box-sizing: content-box;\n }\n background-color: ", ";\n border: ", ";\n border-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-bottom: ", ";\n"])), function (_ref117) {
|
|
6309
|
+
var theme = _ref117.theme;
|
|
5746
6310
|
return theme.container.width;
|
|
5747
|
-
}, function (
|
|
5748
|
-
var theme =
|
|
6311
|
+
}, function (_ref118) {
|
|
6312
|
+
var theme = _ref118.theme;
|
|
5749
6313
|
return theme.typography.fontFamily;
|
|
5750
|
-
}, function (
|
|
5751
|
-
var theme =
|
|
6314
|
+
}, function (_ref119) {
|
|
6315
|
+
var theme = _ref119.theme;
|
|
5752
6316
|
return theme.container.backgroundColor;
|
|
5753
|
-
}, function (
|
|
5754
|
-
var theme =
|
|
6317
|
+
}, function (_ref120) {
|
|
6318
|
+
var theme = _ref120.theme;
|
|
5755
6319
|
return theme.container.border;
|
|
5756
|
-
}, function (
|
|
5757
|
-
var theme =
|
|
6320
|
+
}, function (_ref121) {
|
|
6321
|
+
var theme = _ref121.theme;
|
|
5758
6322
|
return theme.container.borderRadius;
|
|
5759
|
-
}, function (
|
|
5760
|
-
var theme =
|
|
5761
|
-
displayWatermark =
|
|
6323
|
+
}, function (_ref122) {
|
|
6324
|
+
var theme = _ref122.theme,
|
|
6325
|
+
displayWatermark = _ref122.displayWatermark;
|
|
5762
6326
|
return displayWatermark ? '0' : theme.container.borderRadius;
|
|
5763
|
-
}, function (
|
|
5764
|
-
var theme =
|
|
5765
|
-
displayWatermark =
|
|
6327
|
+
}, function (_ref123) {
|
|
6328
|
+
var theme = _ref123.theme,
|
|
6329
|
+
displayWatermark = _ref123.displayWatermark;
|
|
5766
6330
|
return displayWatermark ? '0' : theme.container.borderRadius;
|
|
5767
|
-
}, function (
|
|
5768
|
-
var theme =
|
|
5769
|
-
displayWatermark =
|
|
6331
|
+
}, function (_ref124) {
|
|
6332
|
+
var theme = _ref124.theme,
|
|
6333
|
+
displayWatermark = _ref124.displayWatermark;
|
|
5770
6334
|
return displayWatermark ? 'none' : theme.container.border;
|
|
5771
6335
|
});
|
|
5772
6336
|
var ChildrenContainer = extractErrorMessage.He.div(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n padding: 24px 32px;\n"])));
|
|
5773
|
-
var WatermarkContainer = extractErrorMessage.He.div(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n width: ", ";\n background-color: ", ";\n border: ", ";\n border-top: none;\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n overflow: hidden;\n"])), function (
|
|
5774
|
-
var theme =
|
|
6337
|
+
var WatermarkContainer = extractErrorMessage.He.div(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n width: ", ";\n background-color: ", ";\n border: ", ";\n border-top: none;\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n overflow: hidden;\n"])), function (_ref125) {
|
|
6338
|
+
var theme = _ref125.theme;
|
|
5775
6339
|
return theme.container.width;
|
|
5776
|
-
}, function (
|
|
5777
|
-
var theme =
|
|
6340
|
+
}, function (_ref126) {
|
|
6341
|
+
var theme = _ref126.theme;
|
|
5778
6342
|
return theme.container.backgroundColor;
|
|
5779
|
-
}, function (
|
|
5780
|
-
var theme =
|
|
6343
|
+
}, function (_ref127) {
|
|
6344
|
+
var theme = _ref127.theme;
|
|
5781
6345
|
return theme.container.border;
|
|
5782
|
-
}, function (
|
|
5783
|
-
var theme =
|
|
6346
|
+
}, function (_ref128) {
|
|
6347
|
+
var theme = _ref128.theme;
|
|
5784
6348
|
return theme.container.borderRadius;
|
|
5785
|
-
}, function (
|
|
5786
|
-
var theme =
|
|
6349
|
+
}, function (_ref129) {
|
|
6350
|
+
var theme = _ref129.theme;
|
|
5787
6351
|
return theme.container.borderRadius;
|
|
5788
6352
|
});
|
|
5789
6353
|
var InnerContainer = extractErrorMessage.He.div(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n background-color: #19303d;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0.5;\n"])));
|
|
@@ -5805,29 +6369,24 @@ var isSupportedTokenType = function isSupportedTokenType(tokenType) {
|
|
|
5805
6369
|
};
|
|
5806
6370
|
var AppContainer$1 = function AppContainer$1() {
|
|
5807
6371
|
var _ScreenComponentMap;
|
|
5808
|
-
var
|
|
5809
|
-
|
|
5810
|
-
state =
|
|
5811
|
-
dispatch =
|
|
6372
|
+
var _useGlobalReducer75 = useGlobalReducer(),
|
|
6373
|
+
_useGlobalReducer76 = _slicedToArray(_useGlobalReducer75, 2),
|
|
6374
|
+
state = _useGlobalReducer76[0],
|
|
6375
|
+
dispatch = _useGlobalReducer76[1];
|
|
5812
6376
|
var stytchClient = useStytch();
|
|
5813
6377
|
var config = useConfig();
|
|
5814
6378
|
var _extractErrorMessage$69 = extractErrorMessage.Ze(),
|
|
5815
6379
|
displayWatermark = _extractErrorMessage$69.displayWatermark;
|
|
5816
6380
|
var isOnlyFloatingOneTap = useIsOnlyFloatingOneTap();
|
|
5817
6381
|
var currentScreen = state.screen;
|
|
5818
|
-
var ScreenComponentMap = (_ScreenComponentMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ScreenComponentMap, AppScreens$1.Main, /*#__PURE__*/extractErrorMessage.wn.createElement(MainScreen, null)), AppScreens$1.EmailConfirmation, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailConfirmation, null)), AppScreens$1.LoggedIn, /*#__PURE__*/extractErrorMessage.wn.createElement(ConfirmationScreen, null)), AppScreens$1.Discovery, /*#__PURE__*/extractErrorMessage.wn.createElement(Discovery, null)), AppScreens$1.Error, /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorScreen, null)), AppScreens$1.PasswordEmailForm, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordsEmailForm, null)), AppScreens$1.PasswordAuthenticate, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordsAuthenticate, null)), AppScreens$1.PasswordResetForm, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordResetForm, null)), AppScreens$1.PasswordResetVerifyConfirmation, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordResetConfirmation, null)), AppScreens$1.PasswordForgotForm, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordsForgotForm, null)), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ScreenComponentMap, AppScreens$1.PasswordSetNewConfirmation, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordSetNew, null)), AppScreens$1.MFAEnrollmentSelection, /*#__PURE__*/extractErrorMessage.wn.createElement(MFAEnrollmentSelectionScreen, null)), AppScreens$1.SMSOTPEnrollment, /*#__PURE__*/extractErrorMessage.wn.createElement(SMSOTPEnrollScreen, null)), AppScreens$1.SMSOTPEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(SMSOTPEntryScreen, null)), AppScreens$1.RecoveryCodeEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(RecoveryCodeEntryScreen, null)), AppScreens$1.RecoveryCodeSave, /*#__PURE__*/extractErrorMessage.wn.createElement(RecoveryCodeSaveScreen, null)), AppScreens$1.TOTPEnrollmentQRCode, /*#__PURE__*/extractErrorMessage.wn.createElement(TOTPEnrollQRScreen, null)), AppScreens$1.TOTPEnrollmentManual, /*#__PURE__*/extractErrorMessage.wn.createElement(TOTPEnrollManualScreen, null)), AppScreens$1.TOTPEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(TOTPEntryScreen, null)));
|
|
6382
|
+
var ScreenComponentMap = (_ScreenComponentMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ScreenComponentMap, AppScreens$1.Main, /*#__PURE__*/extractErrorMessage.wn.createElement(MainScreen, null)), AppScreens$1.EmailConfirmation, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailConfirmation, null)), AppScreens$1.LoggedIn, /*#__PURE__*/extractErrorMessage.wn.createElement(ConfirmationScreen, null)), AppScreens$1.Discovery, /*#__PURE__*/extractErrorMessage.wn.createElement(Discovery, null)), AppScreens$1.Error, /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorScreen, null)), AppScreens$1.PasswordEmailForm, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordsEmailForm, null)), AppScreens$1.PasswordAuthenticate, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordsAuthenticate, null)), AppScreens$1.PasswordResetForm, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordResetForm, null)), AppScreens$1.PasswordResetVerifyConfirmation, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordResetConfirmation, null)), AppScreens$1.PasswordForgotForm, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordsForgotForm, null)), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ScreenComponentMap, AppScreens$1.PasswordSetNewConfirmation, /*#__PURE__*/extractErrorMessage.wn.createElement(PasswordSetNew, null)), AppScreens$1.MFAEnrollmentSelection, /*#__PURE__*/extractErrorMessage.wn.createElement(MFAEnrollmentSelectionScreen, null)), AppScreens$1.SMSOTPEnrollment, /*#__PURE__*/extractErrorMessage.wn.createElement(SMSOTPEnrollScreen, null)), AppScreens$1.SMSOTPEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(SMSOTPEntryScreen, null)), AppScreens$1.RecoveryCodeEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(RecoveryCodeEntryScreen, null)), AppScreens$1.RecoveryCodeSave, /*#__PURE__*/extractErrorMessage.wn.createElement(RecoveryCodeSaveScreen, null)), AppScreens$1.TOTPEnrollmentQRCode, /*#__PURE__*/extractErrorMessage.wn.createElement(TOTPEnrollQRScreen, null)), AppScreens$1.TOTPEnrollmentManual, /*#__PURE__*/extractErrorMessage.wn.createElement(TOTPEnrollManualScreen, null)), AppScreens$1.TOTPEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(TOTPEntryScreen, null)), AppScreens$1.EmailMethodSelection, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailMethodSelectionScreen, null)), _defineProperty(_ScreenComponentMap, AppScreens$1.EmailOTPEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailOTPEntryScreen, null)));
|
|
5819
6383
|
var onSuccess = function onSuccess(data) {
|
|
5820
6384
|
clearStytchSearchParams();
|
|
5821
6385
|
onAuthenticateSuccess(data, dispatch, config);
|
|
5822
6386
|
};
|
|
5823
6387
|
var onDiscoverySuccess = function onDiscoverySuccess(data) {
|
|
5824
6388
|
clearStytchSearchParams();
|
|
5825
|
-
dispatch
|
|
5826
|
-
type: 'set_discovery_state',
|
|
5827
|
-
email: data.email_address,
|
|
5828
|
-
discoveredOrganizations: data.discovered_organizations,
|
|
5829
|
-
intermediateSessionToken: data.intermediate_session_token
|
|
5830
|
-
});
|
|
6389
|
+
onDiscoveryAuthenticateSuccess(data, dispatch);
|
|
5831
6390
|
};
|
|
5832
6391
|
var handleStytchAPIError = function handleStytchAPIError(defaultErrorType) {
|
|
5833
6392
|
return function (error) {
|
|
@@ -5843,8 +6402,8 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
5843
6402
|
});
|
|
5844
6403
|
};
|
|
5845
6404
|
};
|
|
5846
|
-
var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_,
|
|
5847
|
-
var token =
|
|
6405
|
+
var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_, _ref130) {
|
|
6406
|
+
var token = _ref130.arg.token;
|
|
5848
6407
|
return stytchClient.magicLinks.authenticate({
|
|
5849
6408
|
magic_links_token: token,
|
|
5850
6409
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
@@ -5855,8 +6414,8 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
5855
6414
|
}),
|
|
5856
6415
|
stytchMagicLinkAuthenticate = _useMutate13.trigger,
|
|
5857
6416
|
isMagicLinkLoading = _useMutate13.isMutating;
|
|
5858
|
-
var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_,
|
|
5859
|
-
var token =
|
|
6417
|
+
var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_, _ref131) {
|
|
6418
|
+
var token = _ref131.arg.token;
|
|
5860
6419
|
return stytchClient.oauth.authenticate({
|
|
5861
6420
|
oauth_token: token,
|
|
5862
6421
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
@@ -5867,8 +6426,8 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
5867
6426
|
}),
|
|
5868
6427
|
stytchOAuthAuthenticate = _useMutate14.trigger,
|
|
5869
6428
|
isOAuthLoading = _useMutate14.isMutating;
|
|
5870
|
-
var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_,
|
|
5871
|
-
var token =
|
|
6429
|
+
var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_, _ref132) {
|
|
6430
|
+
var token = _ref132.arg.token;
|
|
5872
6431
|
return stytchClient.oauth.discovery.authenticate({
|
|
5873
6432
|
discovery_oauth_token: token
|
|
5874
6433
|
});
|
|
@@ -5878,8 +6437,8 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
5878
6437
|
}),
|
|
5879
6438
|
stytchOAuthDiscoveryAuthenticate = _useMutate15.trigger,
|
|
5880
6439
|
isDiscoveryOAuthLoading = _useMutate15.isMutating;
|
|
5881
|
-
var _useMutate16 = useMutate("stytch.sso.authenticate", function (_,
|
|
5882
|
-
var token =
|
|
6440
|
+
var _useMutate16 = useMutate("stytch.sso.authenticate", function (_, _ref133) {
|
|
6441
|
+
var token = _ref133.arg.token;
|
|
5883
6442
|
return stytchClient.sso.authenticate({
|
|
5884
6443
|
sso_token: token,
|
|
5885
6444
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
@@ -5890,8 +6449,8 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
5890
6449
|
}),
|
|
5891
6450
|
stytchSSOAuthenticate = _useMutate16.trigger,
|
|
5892
6451
|
isSSOLoading = _useMutate16.isMutating;
|
|
5893
|
-
var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_,
|
|
5894
|
-
var token =
|
|
6452
|
+
var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_, _ref134) {
|
|
6453
|
+
var token = _ref134.arg.token;
|
|
5895
6454
|
return stytchClient.magicLinks.discovery.authenticate({
|
|
5896
6455
|
discovery_magic_links_token: token
|
|
5897
6456
|
});
|
|
@@ -6000,11 +6559,11 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
6000
6559
|
src: POWERED_BY_STYTCH_IMG_URL
|
|
6001
6560
|
}))))));
|
|
6002
6561
|
};
|
|
6003
|
-
var AppContainer = function AppContainer(
|
|
6004
|
-
var client =
|
|
6005
|
-
styles =
|
|
6006
|
-
callbacks =
|
|
6007
|
-
config =
|
|
6562
|
+
var AppContainer = function AppContainer(_ref135) {
|
|
6563
|
+
var client = _ref135.client,
|
|
6564
|
+
styles = _ref135.styles,
|
|
6565
|
+
callbacks = _ref135.callbacks,
|
|
6566
|
+
config = _ref135.config;
|
|
6008
6567
|
var _extractErrorMessage$70 = extractErrorMessage.h(function () {
|
|
6009
6568
|
var _internal$readB2BInte5 = internal.readB2BInternals(client).bootstrap.getSync(),
|
|
6010
6569
|
displayWatermark = _internal$readB2BInte5.displayWatermark;
|
|
@@ -6020,8 +6579,8 @@ var AppContainer = function AppContainer(_ref128) {
|
|
|
6020
6579
|
options: config
|
|
6021
6580
|
}
|
|
6022
6581
|
});
|
|
6023
|
-
internal.readB2BInternals(client).bootstrap.getAsync().then(function (
|
|
6024
|
-
var displayWatermark =
|
|
6582
|
+
internal.readB2BInternals(client).bootstrap.getAsync().then(function (_ref136) {
|
|
6583
|
+
var displayWatermark = _ref136.displayWatermark;
|
|
6025
6584
|
setDisplayWatermark(displayWatermark);
|
|
6026
6585
|
});
|
|
6027
6586
|
}, [client]);
|
|
@@ -6051,18 +6610,18 @@ var StytchB2BUIClient = /*#__PURE__*/function (_b2b_index_headless$S) {
|
|
|
6051
6610
|
function StytchB2BUIClient() {
|
|
6052
6611
|
_classCallCheck(this, StytchB2BUIClient);
|
|
6053
6612
|
internal.checkNotSSR('StytchUIClient');
|
|
6054
|
-
for (var _len = arguments.length, args = new Array(_len),
|
|
6055
|
-
args[
|
|
6613
|
+
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
6614
|
+
args[_key2] = arguments[_key2];
|
|
6056
6615
|
}
|
|
6057
6616
|
return _callSuper(this, StytchB2BUIClient, [].concat(args));
|
|
6058
6617
|
}
|
|
6059
6618
|
_createClass(StytchB2BUIClient, [{
|
|
6060
6619
|
key: "mount",
|
|
6061
|
-
value: function mount(
|
|
6062
|
-
var elementId =
|
|
6063
|
-
styles =
|
|
6064
|
-
callbacks =
|
|
6065
|
-
config =
|
|
6620
|
+
value: function mount(_ref137) {
|
|
6621
|
+
var elementId = _ref137.elementId,
|
|
6622
|
+
styles = _ref137.styles,
|
|
6623
|
+
callbacks = _ref137.callbacks,
|
|
6624
|
+
config = _ref137.config;
|
|
6066
6625
|
var _a;
|
|
6067
6626
|
var targetParentDomNode = document.querySelector(elementId);
|
|
6068
6627
|
if (!targetParentDomNode) {
|