@stytch/vanilla-js 5.17.2 → 5.18.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/dist/b2b/index.js CHANGED
@@ -51,6 +51,42 @@ var DEFAULT_MFA_STATE = {
51
51
  enrollment: null
52
52
  }
53
53
  };
54
+ var ErrorType;
55
+ (function (ErrorType) {
56
+ ErrorType[ErrorType["Default"] = 0] = "Default";
57
+ ErrorType[ErrorType["EmailMagicLink"] = 1] = "EmailMagicLink";
58
+ ErrorType[ErrorType["Organization"] = 2] = "Organization";
59
+ ErrorType[ErrorType["CannotJoinOrgDueToAuthPolicy"] = 3] = "CannotJoinOrgDueToAuthPolicy";
60
+ ErrorType[ErrorType["AdBlockerDetected"] = 4] = "AdBlockerDetected";
61
+ })(ErrorType || (ErrorType = {}));
62
+ var AppScreens$1;
63
+ (function (AppScreens) {
64
+ AppScreens["Main"] = "Main";
65
+ AppScreens["EmailConfirmation"] = "Email Confirmation";
66
+ AppScreens["LoggedIn"] = "Logged In";
67
+ AppScreens["Discovery"] = "Discovery";
68
+ AppScreens["Error"] = "Error";
69
+ AppScreens["PasswordEmailForm"] = "Password Email";
70
+ AppScreens["PasswordAuthenticate"] = "Password Authenticate";
71
+ AppScreens["PasswordResetForm"] = "Password Reset Form";
72
+ AppScreens["PasswordResetVerifyConfirmation"] = "Password Reset Verify Confirmation";
73
+ AppScreens["PasswordForgotForm"] = "Password Forgot Form";
74
+ AppScreens["PasswordSetNewConfirmation"] = "Password Set New Confirmation";
75
+ AppScreens["MFAEnrollmentSelection"] = "MFA Enrollment Selection";
76
+ AppScreens["RecoveryCodeEntry"] = "Recovery Code Entry";
77
+ AppScreens["RecoveryCodeSave"] = "Recovery Code Save";
78
+ AppScreens["SMSOTPEnrollment"] = "SMS OTP Enrollment";
79
+ AppScreens["SMSOTPEntry"] = "SMS OTP Entry";
80
+ AppScreens["TOTPEnrollmentManual"] = "TOTP Enrollment Manual";
81
+ AppScreens["TOTPEnrollmentQRCode"] = "TOTP Enrollment QR Code";
82
+ AppScreens["TOTPEntry"] = "TOTP Entry";
83
+ AppScreens["EmailMethodSelection"] = "Email Method Selection";
84
+ AppScreens["EmailOTPEntry"] = "Email OTP Entry";
85
+ AppScreens["SSODiscoveryEmail"] = "SSO Discovery Email";
86
+ AppScreens["SSODiscoveryFallback"] = "SSO Discovery Fallback";
87
+ AppScreens["SSODiscoveryMenu"] = "SSO Discovery Menu";
88
+ AppScreens["IDPConsent"] = "IDP Consent";
89
+ })(AppScreens$1 || (AppScreens$1 = {}));
54
90
  var getAuthMethodsForMember = function getAuthMethodsForMember(authMethods, member) {
55
91
  var memberHasPassword = !!(member === null || member === void 0 ? void 0 : member.member_password_id);
56
92
  return memberHasPassword ? authMethods : authMethods.filter(function (method) {
@@ -478,42 +514,6 @@ var reducer = function reducer(state, action) {
478
514
  return mfaReducer(state, action);
479
515
  }
480
516
  };
481
- var AppScreens$1;
482
- (function (AppScreens) {
483
- AppScreens["Main"] = "Main";
484
- AppScreens["EmailConfirmation"] = "Email Confirmation";
485
- AppScreens["LoggedIn"] = "Logged In";
486
- AppScreens["Discovery"] = "Discovery";
487
- AppScreens["Error"] = "Error";
488
- AppScreens["PasswordEmailForm"] = "Password Email";
489
- AppScreens["PasswordAuthenticate"] = "Password Authenticate";
490
- AppScreens["PasswordResetForm"] = "Password Reset Form";
491
- AppScreens["PasswordResetVerifyConfirmation"] = "Password Reset Verify Confirmation";
492
- AppScreens["PasswordForgotForm"] = "Password Forgot Form";
493
- AppScreens["PasswordSetNewConfirmation"] = "Password Set New Confirmation";
494
- AppScreens["MFAEnrollmentSelection"] = "MFA Enrollment Selection";
495
- AppScreens["RecoveryCodeEntry"] = "Recovery Code Entry";
496
- AppScreens["RecoveryCodeSave"] = "Recovery Code Save";
497
- AppScreens["SMSOTPEnrollment"] = "SMS OTP Enrollment";
498
- AppScreens["SMSOTPEntry"] = "SMS OTP Entry";
499
- AppScreens["TOTPEnrollmentManual"] = "TOTP Enrollment Manual";
500
- AppScreens["TOTPEnrollmentQRCode"] = "TOTP Enrollment QR Code";
501
- AppScreens["TOTPEntry"] = "TOTP Entry";
502
- AppScreens["EmailMethodSelection"] = "Email Method Selection";
503
- AppScreens["EmailOTPEntry"] = "Email OTP Entry";
504
- AppScreens["SSODiscoveryEmail"] = "SSO Discovery Email";
505
- AppScreens["SSODiscoveryFallback"] = "SSO Discovery Fallback";
506
- AppScreens["SSODiscoveryMenu"] = "SSO Discovery Menu";
507
- AppScreens["IDPConsent"] = "IDP Consent";
508
- })(AppScreens$1 || (AppScreens$1 = {}));
509
- var ErrorType;
510
- (function (ErrorType) {
511
- ErrorType[ErrorType["Default"] = 0] = "Default";
512
- ErrorType[ErrorType["EmailMagicLink"] = 1] = "EmailMagicLink";
513
- ErrorType[ErrorType["Organization"] = 2] = "Organization";
514
- ErrorType[ErrorType["CannotJoinOrgDueToAuthPolicy"] = 3] = "CannotJoinOrgDueToAuthPolicy";
515
- ErrorType[ErrorType["AdBlockerDetected"] = 4] = "AdBlockerDetected";
516
- })(ErrorType || (ErrorType = {}));
517
517
  var DEFAULT_STATE = {
518
518
  screen: AppScreens$1.Main,
519
519
  screenHistory: [],
@@ -3651,13 +3651,13 @@ var Discovery = function Discovery() {
3651
3651
  return handleDiscoveryOrganizationStart(discoveredOrganization);
3652
3652
  }
3653
3653
  }, /*#__PURE__*/extractErrorMessage.y(Flex, {
3654
- gap: 4,
3654
+ gap: 8,
3655
3655
  alignItems: "center"
3656
3656
  }, /*#__PURE__*/extractErrorMessage.y(Logo, {
3657
3657
  name: organization.organization_name,
3658
3658
  logo: organization.organization_logo_url
3659
3659
  }), /*#__PURE__*/extractErrorMessage.y("div", null, organization.organization_name)), /*#__PURE__*/extractErrorMessage.y(Flex, {
3660
- gap: 4,
3660
+ gap: 8,
3661
3661
  alignItems: "center"
3662
3662
  }, /*#__PURE__*/extractErrorMessage.y(ActionText, {
3663
3663
  type: membership.type
@@ -3768,14 +3768,18 @@ var ConfirmationSVG = function ConfirmationSVG() {
3768
3768
  stopOpacity: "0.26"
3769
3769
  }))));
3770
3770
  };
3771
- var Confirmation = function Confirmation() {
3771
+ var Confirmation = function Confirmation(_ref77) {
3772
+ var _ref77$header = _ref77.header,
3773
+ header = _ref77$header === void 0 ? 'Success!' : _ref77$header,
3774
+ _ref77$text = _ref77.text,
3775
+ text = _ref77$text === void 0 ? 'You have successfully logged in.' : _ref77$text;
3772
3776
  return /*#__PURE__*/extractErrorMessage.y(Flex, {
3773
3777
  direction: "column",
3774
3778
  gap: 24,
3775
3779
  alignItems: "center"
3776
3780
  }, /*#__PURE__*/extractErrorMessage.y(Text, {
3777
3781
  size: "header"
3778
- }, "Success!"), /*#__PURE__*/extractErrorMessage.y(Text, null, "You have successfully logged in."), /*#__PURE__*/extractErrorMessage.y(ConfirmationSVG, null));
3782
+ }, header), /*#__PURE__*/extractErrorMessage.y(Text, null, text), /*#__PURE__*/extractErrorMessage.y(ConfirmationSVG, null));
3779
3783
  };
3780
3784
  var useMountEffect = function useMountEffect(effect) {
3781
3785
  var effectRef = extractErrorMessage._(effect);
@@ -3812,10 +3816,10 @@ var StyledButton = extractErrorMessage.He.button(_templateObject31 || (_template
3812
3816
  });
3813
3817
  var MenuText = extractErrorMessage.He.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n"])));
3814
3818
  var ChevronContainer = extractErrorMessage.He.span(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
3815
- var MenuButton = function MenuButton(_ref77) {
3816
- var children = _ref77.children,
3817
- disabled = _ref77.disabled,
3818
- onClick = _ref77.onClick;
3819
+ var MenuButton = function MenuButton(_ref78) {
3820
+ var children = _ref78.children,
3821
+ disabled = _ref78.disabled,
3822
+ onClick = _ref78.onClick;
3819
3823
  return /*#__PURE__*/extractErrorMessage.wn.createElement(StyledButton, {
3820
3824
  type: "button",
3821
3825
  onClick: onClick,
@@ -3916,9 +3920,9 @@ var EmailMethodSelectionScreen = function EmailMethodSelectionScreen() {
3916
3920
  size: "header"
3917
3921
  }, "Select how you\u2019d like to continue."), /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3918
3922
  direction: "column"
3919
- }, displayOptions.map(function (_ref78) {
3920
- var option = _ref78.option,
3921
- label = _ref78.label;
3923
+ }, displayOptions.map(function (_ref79) {
3924
+ var option = _ref79.option,
3925
+ label = _ref79.label;
3922
3926
  return /*#__PURE__*/extractErrorMessage.wn.createElement(MenuButton, {
3923
3927
  key: option,
3924
3928
  disabled: isSending,
@@ -3930,9 +3934,9 @@ var EmailMethodSelectionScreen = function EmailMethodSelectionScreen() {
3930
3934
  errorMessage: errorMessage
3931
3935
  }));
3932
3936
  };
3933
- var InlineButton = function InlineButton(_ref79) {
3934
- var onClick = _ref79.onClick,
3935
- children = _ref79.children;
3937
+ var InlineButton = function InlineButton(_ref80) {
3938
+ var onClick = _ref80.onClick,
3939
+ children = _ref80.children;
3936
3940
  return /*#__PURE__*/extractErrorMessage.wn.createElement("button", {
3937
3941
  onClick: onClick,
3938
3942
  style: {
@@ -3944,45 +3948,45 @@ var InlineButton = function InlineButton(_ref79) {
3944
3948
  }
3945
3949
  }, children));
3946
3950
  };
3947
- var Wrapper = extractErrorMessage.He.div(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-rows: ", ";\n transition: grid-template-rows 0.15s ease-out;\n"])), function (_ref80) {
3948
- var isOpen = _ref80.isOpen;
3951
+ var Wrapper = extractErrorMessage.He.div(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-rows: ", ";\n transition: grid-template-rows 0.15s ease-out;\n"])), function (_ref81) {
3952
+ var isOpen = _ref81.isOpen;
3949
3953
  return isOpen ? '1fr' : '0fr';
3950
3954
  });
3951
3955
  var Inner = extractErrorMessage.He.div(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n overflow: hidden;\n"])));
3952
- var AnimatedContainer = function AnimatedContainer(_ref81) {
3953
- var isOpen = _ref81.isOpen,
3954
- children = _ref81.children;
3956
+ var AnimatedContainer = function AnimatedContainer(_ref82) {
3957
+ var isOpen = _ref82.isOpen,
3958
+ children = _ref82.children;
3955
3959
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Wrapper, {
3956
3960
  isOpen: isOpen
3957
3961
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Inner, null, children));
3958
3962
  };
3959
- var Container = extractErrorMessage.He.div(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n border-radius: 3px;\n overflow: hidden;\n"])), function (_ref82) {
3960
- var theme = _ref82.theme;
3963
+ var Container = extractErrorMessage.He.div(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n border-radius: 3px;\n overflow: hidden;\n"])), function (_ref83) {
3964
+ var theme = _ref83.theme;
3961
3965
  return theme.colors.disabled;
3962
3966
  });
3963
3967
  var loading = extractErrorMessage.Ue(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(-1%);\n }\n"])));
3964
- var Progress = extractErrorMessage.He.div(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n height: 100%;\n width: 100%;\n background-color: ", ";\n animation: ", " 10s cubic-bezier(0.22, 1, 0.36, 1);\n"])), function (_ref83) {
3965
- var theme = _ref83.theme;
3968
+ var Progress = extractErrorMessage.He.div(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n height: 100%;\n width: 100%;\n background-color: ", ";\n animation: ", " 10s cubic-bezier(0.22, 1, 0.36, 1);\n"])), function (_ref84) {
3969
+ var theme = _ref84.theme;
3966
3970
  return theme.colors.primary;
3967
3971
  }, loading);
3968
- var LoadingBar = function LoadingBar(_ref84) {
3969
- var isLoading = _ref84.isLoading;
3972
+ var LoadingBar = function LoadingBar(_ref85) {
3973
+ var isLoading = _ref85.isLoading;
3970
3974
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Container, null, isLoading && /*#__PURE__*/extractErrorMessage.wn.createElement(Progress, null));
3971
3975
  };
3972
3976
  var GAP = '8px';
3973
3977
  var WIDTH = '46px';
3974
3978
  var INPUT_HEIGHT = '46px';
3975
- var Digit = extractErrorMessage.He.div(_templateObject39 || (_templateObject39 = _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 (_ref85) {
3976
- var disabled = _ref85.disabled,
3977
- theme = _ref85.theme;
3978
- return disabled ? theme.colors.disabled : '#ADBCC5';
3979
- }, INPUT_HEIGHT, WIDTH, function (_ref86) {
3979
+ var Digit = extractErrorMessage.He.div(_templateObject39 || (_templateObject39 = _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 (_ref86) {
3980
3980
  var disabled = _ref86.disabled,
3981
3981
  theme = _ref86.theme;
3982
- return disabled ? theme.colors.disabled : theme.inputs.backgroundColor;
3983
- }, function (_ref87) {
3982
+ return disabled ? theme.colors.disabled : '#ADBCC5';
3983
+ }, INPUT_HEIGHT, WIDTH, function (_ref87) {
3984
3984
  var disabled = _ref87.disabled,
3985
3985
  theme = _ref87.theme;
3986
+ return disabled ? theme.colors.disabled : theme.inputs.backgroundColor;
3987
+ }, function (_ref88) {
3988
+ var disabled = _ref88.disabled,
3989
+ theme = _ref88.theme;
3986
3990
  return disabled ? theme.colors.disabledText : theme.inputs.textColor;
3987
3991
  });
3988
3992
  var digitsContainerStyles = {
@@ -4012,20 +4016,20 @@ var invisibleInputStyles = {
4012
4016
  paddingLeft: "calc(0.5 * ".concat(WIDTH, ")"),
4013
4017
  zIndex: 10
4014
4018
  };
4015
- var DigitAtIndex = function DigitAtIndex(_ref88) {
4016
- var index = _ref88.index,
4017
- disabled = _ref88.disabled,
4018
- otp = _ref88.otp;
4019
+ var DigitAtIndex = function DigitAtIndex(_ref89) {
4020
+ var index = _ref89.index,
4021
+ disabled = _ref89.disabled,
4022
+ otp = _ref89.otp;
4019
4023
  var fill = otp ? otp[index] : '';
4020
4024
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Digit, {
4021
4025
  disabled: disabled,
4022
4026
  "data-testid": "otp-".concat(index)
4023
4027
  }, fill);
4024
4028
  };
4025
- var OTPInput = function OTPInput(_ref89) {
4026
- var otp = _ref89.otp,
4027
- setOtp = _ref89.setOtp,
4028
- disabled = _ref89.disabled;
4029
+ var OTPInput = function OTPInput(_ref90) {
4030
+ var otp = _ref90.otp,
4031
+ setOtp = _ref90.setOtp,
4032
+ disabled = _ref90.disabled;
4029
4033
  var onPasscodeChange = function onPasscodeChange(e) {
4030
4034
  if (!/^\d*$/.test(e.target.value)) {
4031
4035
  return;
@@ -4057,10 +4061,10 @@ var OTPInput = function OTPInput(_ref89) {
4057
4061
  })));
4058
4062
  };
4059
4063
  var OTP_CODE_LENGTH = 6;
4060
- var OTPControl = function OTPControl(_ref90) {
4061
- var isSubmitting = _ref90.isSubmitting,
4062
- onSubmit = _ref90.onSubmit,
4063
- errorMessage = _ref90.errorMessage;
4064
+ var OTPControl = function OTPControl(_ref91) {
4065
+ var isSubmitting = _ref91.isSubmitting,
4066
+ onSubmit = _ref91.onSubmit,
4067
+ errorMessage = _ref91.errorMessage;
4064
4068
  var _extractErrorMessage$31 = extractErrorMessage.h(''),
4065
4069
  _extractErrorMessage$32 = _slicedToArray(_extractErrorMessage$31, 2),
4066
4070
  otp = _extractErrorMessage$32[0],
@@ -4093,13 +4097,13 @@ var OTPControl = function OTPControl(_ref90) {
4093
4097
  errorMessage: errorMessage !== null && errorMessage !== void 0 ? errorMessage : ''
4094
4098
  }));
4095
4099
  };
4096
- var OTPEntry = function OTPEntry(_ref91) {
4097
- var header = _ref91.header,
4098
- helperContent = _ref91.helperContent,
4099
- instruction = _ref91.instruction,
4100
- isSubmitting = _ref91.isSubmitting,
4101
- onSubmit = _ref91.onSubmit,
4102
- errorMessage = _ref91.errorMessage;
4100
+ var OTPEntry = function OTPEntry(_ref92) {
4101
+ var header = _ref92.header,
4102
+ helperContent = _ref92.helperContent,
4103
+ instruction = _ref92.instruction,
4104
+ isSubmitting = _ref92.isSubmitting,
4105
+ onSubmit = _ref92.onSubmit,
4106
+ errorMessage = _ref92.errorMessage;
4103
4107
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
4104
4108
  direction: "column",
4105
4109
  gap: 24
@@ -4118,9 +4122,9 @@ var getSecondsRemaining = function getSecondsRemaining(expiration) {
4118
4122
  var now = new Date();
4119
4123
  return Math.ceil((expiration.getTime() - now.getTime()) / 1000);
4120
4124
  };
4121
- var ExpirationMessage = function ExpirationMessage(_ref92) {
4122
- var expiration = _ref92.expiration,
4123
- resendOTP = _ref92.resendOTP;
4125
+ var ExpirationMessage = function ExpirationMessage(_ref93) {
4126
+ var expiration = _ref93.expiration,
4127
+ resendOTP = _ref93.resendOTP;
4124
4128
  var _extractErrorMessage$33 = extractErrorMessage.h(function () {
4125
4129
  return getSecondsRemaining(expiration);
4126
4130
  }),
@@ -4148,13 +4152,13 @@ var ExpirationMessage = function ExpirationMessage(_ref92) {
4148
4152
  onClick: resendOTP
4149
4153
  }, "Resend code"));
4150
4154
  };
4151
- var SentOTPEntry = function SentOTPEntry(_ref93) {
4152
- var expiration = _ref93.expiration,
4153
- formattedDestination = _ref93.formattedDestination,
4154
- isSubmitting = _ref93.isSubmitting,
4155
- onSubmit = _ref93.onSubmit,
4156
- errorMessage = _ref93.errorMessage,
4157
- resendOTP = _ref93.resendOTP;
4155
+ var SentOTPEntry = function SentOTPEntry(_ref94) {
4156
+ var expiration = _ref94.expiration,
4157
+ formattedDestination = _ref94.formattedDestination,
4158
+ isSubmitting = _ref94.isSubmitting,
4159
+ onSubmit = _ref94.onSubmit,
4160
+ errorMessage = _ref94.errorMessage,
4161
+ resendOTP = _ref94.resendOTP;
4158
4162
  return /*#__PURE__*/extractErrorMessage.wn.createElement(OTPEntry, {
4159
4163
  header: "Enter passcode",
4160
4164
  helperContent: /*#__PURE__*/extractErrorMessage.wn.createElement(ExpirationMessage, {
@@ -4187,10 +4191,10 @@ var EmailOTPEntryScreen = function EmailOTPEntryScreen() {
4187
4191
  resetSendDiscovery = _useEmailOtpDiscovery3.reset;
4188
4192
  var isSending = isSendingDiscovery || isSendingOtp;
4189
4193
  var sendError = sendDiscoveryError || sendOtpError;
4190
- var _useMutate5 = useMutate('stytch.otps.email.discovery.authenticate', function (_, _ref94) {
4191
- var _ref94$arg = _ref94.arg,
4192
- otp = _ref94$arg.otp,
4193
- email = _ref94$arg.email;
4194
+ var _useMutate5 = useMutate('stytch.otps.email.discovery.authenticate', function (_, _ref95) {
4195
+ var _ref95$arg = _ref95.arg,
4196
+ otp = _ref95$arg.otp,
4197
+ email = _ref95$arg.email;
4194
4198
  return stytchClient.otps.email.discovery.authenticate({
4195
4199
  code: otp,
4196
4200
  email_address: email
@@ -4204,12 +4208,12 @@ var EmailOTPEntryScreen = function EmailOTPEntryScreen() {
4204
4208
  isDiscoveryAuthenticating = _useMutate5.isMutating,
4205
4209
  discoveryAuthenticateError = _useMutate5.error,
4206
4210
  resetDiscoveryAuthenticate = _useMutate5.reset;
4207
- var _useMutate6 = useMutate('stytch.otps.email.authenticate', function (_, _ref95) {
4208
- var _ref95$arg = _ref95.arg,
4209
- otp = _ref95$arg.otp,
4210
- emailAddress = _ref95$arg.emailAddress,
4211
- organizationId = _ref95$arg.organizationId,
4212
- sessionDurationMinutes = _ref95$arg.sessionDurationMinutes;
4211
+ var _useMutate6 = useMutate('stytch.otps.email.authenticate', function (_, _ref96) {
4212
+ var _ref96$arg = _ref96.arg,
4213
+ otp = _ref96$arg.otp,
4214
+ emailAddress = _ref96$arg.emailAddress,
4215
+ organizationId = _ref96$arg.organizationId,
4216
+ sessionDurationMinutes = _ref96$arg.sessionDurationMinutes;
4213
4217
  return stytchClient.otps.email.authenticate({
4214
4218
  code: otp,
4215
4219
  email_address: emailAddress,
@@ -4335,9 +4339,9 @@ var MFAEnrollmentSelectionScreen = function MFAEnrollmentSelectionScreen() {
4335
4339
  size: "header"
4336
4340
  }, "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, {
4337
4341
  direction: "column"
4338
- }, displayOptions.map(function (_ref96) {
4339
- var option = _ref96.option,
4340
- label = _ref96.label;
4342
+ }, displayOptions.map(function (_ref97) {
4343
+ var option = _ref97.option,
4344
+ label = _ref97.label;
4341
4345
  return /*#__PURE__*/extractErrorMessage.wn.createElement(MenuButton, {
4342
4346
  key: option,
4343
4347
  onClick: function onClick() {
@@ -4362,10 +4366,10 @@ var inboxLinks = function inboxLinks(emailDomain) {
4362
4366
  var Link = 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) {
4363
4367
  return props.theme.colors.primary;
4364
4368
  });
4365
- var EmailProviderLink = function EmailProviderLink(_ref97) {
4366
- var label = _ref97.label,
4367
- href = _ref97.href,
4368
- Icon = _ref97.Icon;
4369
+ var EmailProviderLink = function EmailProviderLink(_ref98) {
4370
+ var label = _ref98.label,
4371
+ href = _ref98.href,
4372
+ Icon = _ref98.Icon;
4369
4373
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
4370
4374
  gap: 4
4371
4375
  }, Icon, /*#__PURE__*/extractErrorMessage.wn.createElement(Link, {
@@ -4374,10 +4378,10 @@ var EmailProviderLink = function EmailProviderLink(_ref97) {
4374
4378
  rel: "noopener noreferrer"
4375
4379
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Open in ", label)));
4376
4380
  };
4377
- var VerifyEmailConfirmation = function VerifyEmailConfirmation(_ref98) {
4378
- var emailDomain = _ref98.emailDomain,
4379
- reset = _ref98.reset,
4380
- email = _ref98.email;
4381
+ var VerifyEmailConfirmation = function VerifyEmailConfirmation(_ref99) {
4382
+ var emailDomain = _ref99.emailDomain,
4383
+ reset = _ref99.reset,
4384
+ email = _ref99.email;
4381
4385
  var _inboxLinks = inboxLinks(emailDomain),
4382
4386
  GMAIL = _inboxLinks.GMAIL,
4383
4387
  OUTLOOK = _inboxLinks.OUTLOOK;
@@ -4432,8 +4436,8 @@ var useEmailDomain = function useEmailDomain() {
4432
4436
  emailDomains = _extractErrorMessage$36[0],
4433
4437
  setEmailDomains = _extractErrorMessage$36[1];
4434
4438
  extractErrorMessage.p(function () {
4435
- internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref99) {
4436
- var emailDomains = _ref99.emailDomains;
4439
+ internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref100) {
4440
+ var emailDomains = _ref100.emailDomains;
4437
4441
  setEmailDomains(emailDomains);
4438
4442
  });
4439
4443
  }, [stytch]);
@@ -4470,8 +4474,8 @@ var PasswordResetConfirmation = function PasswordResetConfirmation() {
4470
4474
  var Block = extractErrorMessage.He.div(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n height: 4px;\n width: 25%;\n background-color: ", ";\n"])), function (props) {
4471
4475
  return props.$bgColor;
4472
4476
  });
4473
- var PasswordStrengthCheck = function PasswordStrengthCheck(_ref100) {
4474
- var score = _ref100.score;
4477
+ var PasswordStrengthCheck = function PasswordStrengthCheck(_ref101) {
4478
+ var score = _ref101.score;
4475
4479
  var blocks = [];
4476
4480
  switch (score) {
4477
4481
  case 0:
@@ -4639,13 +4643,13 @@ var PasswordResetForm = function PasswordResetForm() {
4639
4643
  return internal.debounce(function (password) {
4640
4644
  return stytchClient.passwords.strengthCheck({
4641
4645
  password: password
4642
- }).then(function (_ref101) {
4643
- var score = _ref101.score,
4644
- valid_password = _ref101.valid_password,
4645
- zxcvbn_feedback = _ref101.zxcvbn_feedback,
4646
- luds_feedback = _ref101.luds_feedback,
4647
- strength_policy = _ref101.strength_policy,
4648
- breached_password = _ref101.breached_password;
4646
+ }).then(function (_ref102) {
4647
+ var score = _ref102.score,
4648
+ valid_password = _ref102.valid_password,
4649
+ zxcvbn_feedback = _ref102.zxcvbn_feedback,
4650
+ luds_feedback = _ref102.luds_feedback,
4651
+ strength_policy = _ref102.strength_policy,
4652
+ breached_password = _ref102.breached_password;
4649
4653
  setStrengthPolicy(strength_policy);
4650
4654
  setInvalidPassword(!valid_password);
4651
4655
  if (strength_policy === 'zxcvbn') {
@@ -5162,12 +5166,12 @@ var Z = function Z(e, t) {
5162
5166
  }, [o]),
5163
5167
  a = extractErrorMessage.T(function (r, c) {
5164
5168
  var _g$filter;
5165
- var _ref103 = c || {},
5166
- _ref103$reverseOrder = _ref103.reverseOrder,
5167
- i = _ref103$reverseOrder === void 0 ? !1 : _ref103$reverseOrder,
5168
- _ref103$gutter = _ref103.gutter,
5169
- d = _ref103$gutter === void 0 ? 8 : _ref103$gutter,
5170
- p = _ref103.defaultPosition,
5169
+ var _ref104 = c || {},
5170
+ _ref104$reverseOrder = _ref104.reverseOrder,
5171
+ i = _ref104$reverseOrder === void 0 ? !1 : _ref104$reverseOrder,
5172
+ _ref104$gutter = _ref104.gutter,
5173
+ d = _ref104$gutter === void 0 ? 8 : _ref104$gutter,
5174
+ p = _ref104.defaultPosition,
5171
5175
  g = t.filter(function (m) {
5172
5176
  return (m.position || p) === (r.position || p) && m.height;
5173
5177
  }),
@@ -5218,8 +5222,8 @@ var ue = j("div")(_templateObject52 || (_templateObject52 = _taggedTemplateLiter
5218
5222
  le = j("div")(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: 20px;\n min-height: 20px;\n"]))),
5219
5223
  Te = h$1(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\nfrom {\n transform: scale(0.6);\n opacity: 0.4;\n}\nto {\n transform: scale(1);\n opacity: 1;\n}"]))),
5220
5224
  fe = j("div")(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n position: relative;\n transform: scale(0.6);\n opacity: 0.4;\n min-width: 20px;\n animation: ", " 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n forwards;\n"])), Te),
5221
- M = function M(_ref104) {
5222
- var e = _ref104.toast;
5225
+ M = function M(_ref105) {
5226
+ var e = _ref105.toast;
5223
5227
  var t = e.icon,
5224
5228
  o = e.type,
5225
5229
  s = e.iconTheme;
@@ -5237,19 +5241,19 @@ var ye = function ye(e) {
5237
5241
  Se = j("div")(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n margin: 4px 10px;\n color: inherit;\n flex: 1 1 auto;\n white-space: pre-line;\n"]))),
5238
5242
  Ae = function Ae(e, t) {
5239
5243
  var s = e.includes("top") ? 1 : -1,
5240
- _ref105 = b() ? [he, xe] : [ye(s), ge(s)],
5241
- _ref106 = _slicedToArray(_ref105, 2),
5242
- a = _ref106[0],
5243
- r = _ref106[1];
5244
+ _ref106 = b() ? [he, xe] : [ye(s), ge(s)],
5245
+ _ref107 = _slicedToArray(_ref106, 2),
5246
+ a = _ref107[0],
5247
+ r = _ref107[1];
5244
5248
  return {
5245
5249
  animation: t ? "".concat(h$1(a), " 0.35s cubic-bezier(.21,1.02,.73,1) forwards") : "".concat(h$1(r), " 0.4s forwards cubic-bezier(.06,.71,.55,1)")
5246
5250
  };
5247
5251
  },
5248
- F = extractErrorMessage.w(function (_ref107) {
5249
- var e = _ref107.toast,
5250
- t = _ref107.position,
5251
- o = _ref107.style,
5252
- s = _ref107.children;
5252
+ F = extractErrorMessage.w(function (_ref108) {
5253
+ var e = _ref108.toast,
5254
+ t = _ref108.position,
5255
+ o = _ref108.style,
5256
+ s = _ref108.children;
5253
5257
  var a = e.height ? Ae(e.position || t || "top-center", e.visible) : {
5254
5258
  opacity: 0
5255
5259
  },
@@ -5266,12 +5270,12 @@ var ye = function ye(e) {
5266
5270
  }) : extractErrorMessage.y(extractErrorMessage.g, null, r, c));
5267
5271
  });
5268
5272
  m(extractErrorMessage.y);
5269
- var Ee = function Ee(_ref108) {
5270
- var e = _ref108.id,
5271
- t = _ref108.className,
5272
- o = _ref108.style,
5273
- s = _ref108.onHeightUpdate,
5274
- a = _ref108.children;
5273
+ var Ee = function Ee(_ref109) {
5274
+ var e = _ref109.id,
5275
+ t = _ref109.className,
5276
+ o = _ref109.style,
5277
+ s = _ref109.onHeightUpdate,
5278
+ a = _ref109.children;
5275
5279
  var r = extractErrorMessage.T(function (c) {
5276
5280
  if (c) {
5277
5281
  var _i2 = function _i2() {
@@ -5314,15 +5318,15 @@ var Ee = function Ee(_ref108) {
5314
5318
  },
5315
5319
  ve = u$1(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n z-index: 9999;\n > * {\n pointer-events: auto;\n }\n"]))),
5316
5320
  O = 16,
5317
- Ie = function Ie(_ref109) {
5318
- var e = _ref109.reverseOrder,
5319
- _ref109$position = _ref109.position,
5320
- t = _ref109$position === void 0 ? "top-center" : _ref109$position,
5321
- o = _ref109.toastOptions,
5322
- s = _ref109.gutter,
5323
- a = _ref109.children,
5324
- r = _ref109.containerStyle,
5325
- c = _ref109.containerClassName;
5321
+ Ie = function Ie(_ref110) {
5322
+ var e = _ref110.reverseOrder,
5323
+ _ref110$position = _ref110.position,
5324
+ t = _ref110$position === void 0 ? "top-center" : _ref110$position,
5325
+ o = _ref110.toastOptions,
5326
+ s = _ref110.gutter,
5327
+ a = _ref110.children,
5328
+ r = _ref110.containerStyle,
5329
+ c = _ref110.containerClassName;
5326
5330
  var _D = D(o),
5327
5331
  i = _D.toasts,
5328
5332
  d = _D.handlers;
@@ -5465,8 +5469,8 @@ var PasswordsForgotForm = function PasswordsForgotForm() {
5465
5469
  setErrorMessage('');
5466
5470
  setIsSubmitting(true);
5467
5471
  if (organization) {
5468
- internal.readB2BInternals(stytch).searchManager.searchMember(email, organization.organization_id).then(function (_ref110) {
5469
- var member = _ref110.member;
5472
+ internal.readB2BInternals(stytch).searchManager.searchMember(email, organization.organization_id).then(function (_ref111) {
5473
+ var member = _ref111.member;
5470
5474
  var _a, _b, _c, _d;
5471
5475
  if (!(member === null || member === void 0 ? void 0 : member.member_password_id)) {
5472
5476
  handleNonMemberReset();
@@ -5579,12 +5583,12 @@ var RecoveryCodeEntryScreen = function RecoveryCodeEntryScreen() {
5579
5583
  _extractErrorMessage$64 = _slicedToArray(_extractErrorMessage$63, 2),
5580
5584
  recoveryCode = _extractErrorMessage$64[0],
5581
5585
  setRecoveryCode = _extractErrorMessage$64[1];
5582
- var _useMutate7 = useMutate('stytch.recoveryCodes.recover', function (_, _ref111) {
5583
- var _ref111$arg = _ref111.arg,
5584
- recoveryCode = _ref111$arg.recoveryCode,
5585
- memberId = _ref111$arg.memberId,
5586
- organizationId = _ref111$arg.organizationId,
5587
- sessionDurationMinutes = _ref111$arg.sessionDurationMinutes;
5586
+ var _useMutate7 = useMutate('stytch.recoveryCodes.recover', function (_, _ref112) {
5587
+ var _ref112$arg = _ref112.arg,
5588
+ recoveryCode = _ref112$arg.recoveryCode,
5589
+ memberId = _ref112$arg.memberId,
5590
+ organizationId = _ref112$arg.organizationId,
5591
+ sessionDurationMinutes = _ref112$arg.sessionDurationMinutes;
5588
5592
  return stytchClient.recoveryCodes.recover({
5589
5593
  recovery_code: recoveryCode,
5590
5594
  member_id: memberId,
@@ -5740,9 +5744,9 @@ var Select = extractErrorMessage.He.select(_templateObject61 || (_templateObject
5740
5744
  }, function (props) {
5741
5745
  return props.theme.typography.fontFamily;
5742
5746
  });
5743
- var CountrySelector = function CountrySelector(_ref112) {
5744
- var country = _ref112.country,
5745
- setCountry = _ref112.setCountry;
5747
+ var CountrySelector = function CountrySelector(_ref113) {
5748
+ var country = _ref113.country,
5749
+ setCountry = _ref113.setCountry;
5746
5750
  var countryFormatter = new Intl.DisplayNames(['en'], {
5747
5751
  type: 'region'
5748
5752
  });
@@ -5753,20 +5757,20 @@ var CountrySelector = function CountrySelector(_ref112) {
5753
5757
  onChange: function onChange(e) {
5754
5758
  setCountry(e.target.value);
5755
5759
  }
5756
- }, Object.entries(internal.COUNTRIES_LIST).map(function (_ref113) {
5757
- var _ref114 = _slicedToArray(_ref113, 2),
5758
- countryCode = _ref114[0],
5759
- countryNumber = _ref114[1];
5760
+ }, Object.entries(internal.COUNTRIES_LIST).map(function (_ref114) {
5761
+ var _ref115 = _slicedToArray(_ref114, 2),
5762
+ countryCode = _ref115[0],
5763
+ countryNumber = _ref115[1];
5760
5764
  return /*#__PURE__*/extractErrorMessage.wn.createElement("option", {
5761
5765
  key: countryCode,
5762
5766
  value: countryCode
5763
5767
  }, countryCode !== country ? "+".concat(countryNumber, " ").concat(countryFormatter.of(countryCode)) : "+".concat(countryNumber));
5764
5768
  }));
5765
5769
  };
5766
- var formatNumber = function formatNumber(_ref115) {
5767
- var parsePhoneNumber = _ref115.parsePhoneNumber,
5768
- phoneNumber = _ref115.phoneNumber,
5769
- country = _ref115.country;
5770
+ var formatNumber = function formatNumber(_ref116) {
5771
+ var parsePhoneNumber = _ref116.parsePhoneNumber,
5772
+ phoneNumber = _ref116.phoneNumber,
5773
+ country = _ref116.country;
5770
5774
  return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
5771
5775
  var parsedPhoneNumber;
5772
5776
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
@@ -5799,10 +5803,10 @@ var formatNumber = function formatNumber(_ref115) {
5799
5803
  }, _callee10, null, [[0, 9]]);
5800
5804
  }));
5801
5805
  };
5802
- var formatNumberToIncludeCountryCode = function formatNumberToIncludeCountryCode(_ref116) {
5803
- var parsePhoneNumber = _ref116.parsePhoneNumber,
5804
- phoneNumber = _ref116.phoneNumber,
5805
- country = _ref116.country;
5806
+ var formatNumberToIncludeCountryCode = function formatNumberToIncludeCountryCode(_ref117) {
5807
+ var parsePhoneNumber = _ref117.parsePhoneNumber,
5808
+ phoneNumber = _ref117.phoneNumber,
5809
+ country = _ref117.country;
5806
5810
  return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
5807
5811
  var code, fallbackNumber, fallback, parsedPhoneNumber;
5808
5812
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
@@ -5842,13 +5846,13 @@ var formatNumberToIncludeCountryCode = function formatNumberToIncludeCountryCode
5842
5846
  }));
5843
5847
  };
5844
5848
  var PhoneStyledInput = extractErrorMessage.He(Input)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n flex-grow: 1;\n min-width: 100px;\n"])));
5845
- var PhoneInput = function PhoneInput(_ref117) {
5846
- var phone = _ref117.phone,
5847
- setPhone = _ref117.setPhone,
5848
- country = _ref117.country,
5849
- setCountry = _ref117.setCountry,
5850
- parsePhoneNumber = _ref117.parsePhoneNumber,
5851
- hasPasskeys = _ref117.hasPasskeys;
5849
+ var PhoneInput = function PhoneInput(_ref118) {
5850
+ var phone = _ref118.phone,
5851
+ setPhone = _ref118.setPhone,
5852
+ country = _ref118.country,
5853
+ setCountry = _ref118.setCountry,
5854
+ parsePhoneNumber = _ref118.parsePhoneNumber,
5855
+ hasPasskeys = _ref118.hasPasskeys;
5852
5856
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
5853
5857
  direction: "row",
5854
5858
  wrap: "nowrap",
@@ -5914,8 +5918,8 @@ var InvalidPhoneNumberError = /*#__PURE__*/function (_internal$StytchSDKEr) {
5914
5918
  }
5915
5919
  return _createClass(InvalidPhoneNumberError);
5916
5920
  }(internal.StytchSDKError);
5917
- var findErrorTypeFrom = function findErrorTypeFrom(_ref118) {
5918
- var error = _ref118.error;
5921
+ var findErrorTypeFrom = function findErrorTypeFrom(_ref119) {
5922
+ var error = _ref119.error;
5919
5923
  var errorType = extractErrorType(error);
5920
5924
  return !!errorType && errorType in supportedErrorTypeMap ? errorType : 'default';
5921
5925
  };
@@ -5955,8 +5959,8 @@ var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
5955
5959
  regionCode: countryCode
5956
5960
  });
5957
5961
  };
5958
- var _useMutate8 = useMutate('stytch.otps.sms.send', function (_, _ref119) {
5959
- var parsedNumber = _ref119.arg.parsedNumber;
5962
+ var _useMutate8 = useMutate('stytch.otps.sms.send', function (_, _ref120) {
5963
+ var parsedNumber = _ref120.arg.parsedNumber;
5960
5964
  return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
5961
5965
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
5962
5966
  while (1) switch (_context13.prev = _context13.next) {
@@ -6079,10 +6083,10 @@ var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
6079
6083
  memberPhoneNumber = _state$mfa$primaryInf3.memberPhoneNumber,
6080
6084
  organizationId = _state$mfa$primaryInf3.organizationId,
6081
6085
  organizationMfaOptionsSupported = _state$mfa$primaryInf3.organizationMfaOptionsSupported;
6082
- var _useMutate9 = useMutate('stytch.otps.sms.send', function (_, _ref120) {
6083
- var _ref120$arg = _ref120.arg,
6084
- memberId = _ref120$arg.memberId,
6085
- organizationId = _ref120$arg.organizationId;
6086
+ var _useMutate9 = useMutate('stytch.otps.sms.send', function (_, _ref121) {
6087
+ var _ref121$arg = _ref121.arg,
6088
+ memberId = _ref121$arg.memberId,
6089
+ organizationId = _ref121$arg.organizationId;
6086
6090
  dispatch({
6087
6091
  type: 'sms_otp/send'
6088
6092
  });
@@ -6111,12 +6115,12 @@ var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
6111
6115
  sendSms = _useMutate9.trigger,
6112
6116
  isSending = _useMutate9.isMutating,
6113
6117
  sendError = _useMutate9.error;
6114
- var _useMutate10 = useMutate('stytch.otps.sms.authenticate', function (_, _ref121) {
6115
- var _ref121$arg = _ref121.arg,
6116
- otp = _ref121$arg.otp,
6117
- memberId = _ref121$arg.memberId,
6118
- organizationId = _ref121$arg.organizationId,
6119
- sessionDurationMinutes = _ref121$arg.sessionDurationMinutes;
6118
+ var _useMutate10 = useMutate('stytch.otps.sms.authenticate', function (_, _ref122) {
6119
+ var _ref122$arg = _ref122.arg,
6120
+ otp = _ref122$arg.otp,
6121
+ memberId = _ref122$arg.memberId,
6122
+ organizationId = _ref122$arg.organizationId,
6123
+ sessionDurationMinutes = _ref122$arg.sessionDurationMinutes;
6120
6124
  return stytchClient.otps.sms.authenticate({
6121
6125
  code: otp,
6122
6126
  member_id: memberId,
@@ -6251,8 +6255,8 @@ var useSsoDiscoveryConnection = function useSsoDiscoveryConnection() {
6251
6255
  var stytch = useStytch();
6252
6256
  var _internal$readB2BInte5 = internal.readB2BInternals(stytch),
6253
6257
  networkClient = _internal$readB2BInte5.networkClient;
6254
- return useMutate('internal.stytch.sso.discovery.connection', function (_key, _ref122) {
6255
- var emailAddress = _ref122.arg.emailAddress;
6258
+ return useMutate('internal.stytch.sso.discovery.connection', function (_key, _ref123) {
6259
+ var emailAddress = _ref123.arg.emailAddress;
6256
6260
  return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
6257
6261
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
6258
6262
  while (1) switch (_context17.prev = _context17.next) {
@@ -6441,8 +6445,8 @@ var SSODiscoveryFallback = function SSODiscoveryFallback() {
6441
6445
  var stytchClient = useStytch();
6442
6446
  var _useConfig5 = useConfig(),
6443
6447
  ssoOptions = _useConfig5.ssoOptions;
6444
- var _useMutate11 = useMutate('stytch.organization.getBySlug', function (_, _ref123) {
6445
- var slug = _ref123.arg.slug;
6448
+ var _useMutate11 = useMutate('stytch.organization.getBySlug', function (_, _ref124) {
6449
+ var slug = _ref124.arg.slug;
6446
6450
  return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
6447
6451
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
6448
6452
  while (1) switch (_context20.prev = _context20.next) {
@@ -6666,10 +6670,10 @@ var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
6666
6670
  var _state$mfa$primaryInf4 = state.mfa.primaryInfo,
6667
6671
  memberId = _state$mfa$primaryInf4.memberId,
6668
6672
  organizationId = _state$mfa$primaryInf4.organizationId;
6669
- var _useMutate12 = useMutate('stytch.totp.create', function (_, _ref124) {
6670
- var _ref124$arg = _ref124.arg,
6671
- memberId = _ref124$arg.memberId,
6672
- organizationId = _ref124$arg.organizationId;
6673
+ var _useMutate12 = useMutate('stytch.totp.create', function (_, _ref125) {
6674
+ var _ref125$arg = _ref125.arg,
6675
+ memberId = _ref125$arg.memberId,
6676
+ organizationId = _ref125$arg.organizationId;
6673
6677
  dispatch({
6674
6678
  type: 'totp/create'
6675
6679
  });
@@ -6735,11 +6739,11 @@ var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
6735
6739
  onClick: handleContinue
6736
6740
  }, "Continue"))) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingScreen, null)));
6737
6741
  };
6738
- var TOTPEntry = function TOTPEntry(_ref125) {
6739
- var helperContent = _ref125.helperContent,
6740
- isSubmitting = _ref125.isSubmitting,
6741
- onSubmit = _ref125.onSubmit,
6742
- errorMessage = _ref125.errorMessage;
6742
+ var TOTPEntry = function TOTPEntry(_ref126) {
6743
+ var helperContent = _ref126.helperContent,
6744
+ isSubmitting = _ref126.isSubmitting,
6745
+ onSubmit = _ref126.onSubmit,
6746
+ errorMessage = _ref126.errorMessage;
6743
6747
  return /*#__PURE__*/extractErrorMessage.wn.createElement(OTPEntry, {
6744
6748
  header: "Enter verification code",
6745
6749
  instruction: "Enter the 6-digit code from your authenticator app.",
@@ -6763,12 +6767,12 @@ var TOTPEntryScreen = function TOTPEntryScreen() {
6763
6767
  memberId = _state$mfa$primaryInf5.memberId,
6764
6768
  organizationId = _state$mfa$primaryInf5.organizationId,
6765
6769
  organizationMfaOptionsSupported = _state$mfa$primaryInf5.organizationMfaOptionsSupported;
6766
- var _useMutate13 = useMutate('stytch.totp.authenticate', function (_, _ref126) {
6767
- var _ref126$arg = _ref126.arg,
6768
- memberId = _ref126$arg.memberId,
6769
- organizationId = _ref126$arg.organizationId,
6770
- otp = _ref126$arg.otp,
6771
- sessionDurationMinutes = _ref126$arg.sessionDurationMinutes;
6770
+ var _useMutate13 = useMutate('stytch.totp.authenticate', function (_, _ref127) {
6771
+ var _ref127$arg = _ref127.arg,
6772
+ memberId = _ref127$arg.memberId,
6773
+ organizationId = _ref127$arg.organizationId,
6774
+ otp = _ref127$arg.otp,
6775
+ sessionDurationMinutes = _ref127$arg.sessionDurationMinutes;
6772
6776
  return stytchClient.totp.authenticate({
6773
6777
  code: otp,
6774
6778
  member_id: memberId,
@@ -6901,25 +6905,21 @@ var Snackbar = function Snackbar() {
6901
6905
  }
6902
6906
  });
6903
6907
  };
6904
- var OuterContainer = extractErrorMessage.He.div(_templateObject68 || (_templateObject68 = _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 (_ref127) {
6905
- var theme = _ref127.theme;
6906
- return theme.container.width;
6907
- }, function (_ref128) {
6908
+ var OuterContainer = extractErrorMessage.He.div(_templateObject68 || (_templateObject68 = _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 (_ref128) {
6908
6909
  var theme = _ref128.theme;
6909
- return theme.typography.fontFamily;
6910
+ return theme.container.width;
6910
6911
  }, function (_ref129) {
6911
6912
  var theme = _ref129.theme;
6912
- return theme.container.backgroundColor;
6913
+ return theme.typography.fontFamily;
6913
6914
  }, function (_ref130) {
6914
6915
  var theme = _ref130.theme;
6915
- return theme.container.border;
6916
+ return theme.container.backgroundColor;
6916
6917
  }, function (_ref131) {
6917
6918
  var theme = _ref131.theme;
6918
- return theme.container.borderRadius;
6919
+ return theme.container.border;
6919
6920
  }, function (_ref132) {
6920
- var theme = _ref132.theme,
6921
- displayWatermark = _ref132.displayWatermark;
6922
- return displayWatermark ? '0' : theme.container.borderRadius;
6921
+ var theme = _ref132.theme;
6922
+ return theme.container.borderRadius;
6923
6923
  }, function (_ref133) {
6924
6924
  var theme = _ref133.theme,
6925
6925
  displayWatermark = _ref133.displayWatermark;
@@ -6927,37 +6927,41 @@ var OuterContainer = extractErrorMessage.He.div(_templateObject68 || (_templateO
6927
6927
  }, function (_ref134) {
6928
6928
  var theme = _ref134.theme,
6929
6929
  displayWatermark = _ref134.displayWatermark;
6930
+ return displayWatermark ? '0' : theme.container.borderRadius;
6931
+ }, function (_ref135) {
6932
+ var theme = _ref135.theme,
6933
+ displayWatermark = _ref135.displayWatermark;
6930
6934
  return displayWatermark ? 'none' : theme.container.border;
6931
6935
  });
6932
6936
  var ChildrenContainer = extractErrorMessage.He.div(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n padding: 24px 32px;\n"])));
6933
- var WatermarkContainer = extractErrorMessage.He.div(_templateObject70 || (_templateObject70 = _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 (_ref135) {
6934
- var theme = _ref135.theme;
6935
- return theme.container.width;
6936
- }, function (_ref136) {
6937
+ var WatermarkContainer = extractErrorMessage.He.div(_templateObject70 || (_templateObject70 = _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 (_ref136) {
6937
6938
  var theme = _ref136.theme;
6938
- return theme.container.backgroundColor;
6939
+ return theme.container.width;
6939
6940
  }, function (_ref137) {
6940
6941
  var theme = _ref137.theme;
6941
- return theme.container.border;
6942
+ return theme.container.backgroundColor;
6942
6943
  }, function (_ref138) {
6943
6944
  var theme = _ref138.theme;
6944
- return theme.container.borderRadius;
6945
+ return theme.container.border;
6945
6946
  }, function (_ref139) {
6946
6947
  var theme = _ref139.theme;
6947
6948
  return theme.container.borderRadius;
6949
+ }, function (_ref140) {
6950
+ var theme = _ref140.theme;
6951
+ return theme.container.borderRadius;
6948
6952
  });
6949
6953
  var InnerContainer = extractErrorMessage.He.div(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n background-color: #fff;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0.5;\n"])));
6950
6954
  var Image = extractErrorMessage.He.img(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n width: 150px;\n"])));
6951
6955
  var POWERED_BY_STYTCH_IMG_URL = 'https://public-assets.stytch.com/powered_by_stytch_logo_dark.svg';
6952
- var LoadingContainer = function LoadingContainer(_ref140) {
6953
- var children = _ref140.children;
6956
+ var LoadingContainer = function LoadingContainer(_ref141) {
6957
+ var children = _ref141.children;
6954
6958
  return /*#__PURE__*/extractErrorMessage.wn.createElement(OuterContainer, {
6955
6959
  displayWatermark: false
6956
6960
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(ChildrenContainer, null, children));
6957
6961
  };
6958
- var MainContainer = function MainContainer(_ref141) {
6959
- var children = _ref141.children,
6960
- displayWatermark = _ref141.displayWatermark;
6962
+ var MainContainer = function MainContainer(_ref142) {
6963
+ var children = _ref142.children,
6964
+ displayWatermark = _ref142.displayWatermark;
6961
6965
  return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, /*#__PURE__*/extractErrorMessage.wn.createElement(OuterContainer, {
6962
6966
  displayWatermark: displayWatermark
6963
6967
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(ChildrenContainer, null, children, /*#__PURE__*/extractErrorMessage.wn.createElement(Snackbar, null))), displayWatermark && ( /*#__PURE__*/extractErrorMessage.wn.createElement(WatermarkContainer, null, /*#__PURE__*/extractErrorMessage.wn.createElement(InnerContainer, null, /*#__PURE__*/extractErrorMessage.wn.createElement("a", {
@@ -7023,10 +7027,10 @@ var createBuiltinScopeDescriptions = function createBuiltinScopeDescriptions(sco
7023
7027
  }
7024
7028
  return descriptions;
7025
7029
  };
7026
- var createProfileScopeDescription = function createProfileScopeDescription(_ref142) {
7027
- var containsProfile = _ref142.containsProfile,
7028
- containsEmail = _ref142.containsEmail,
7029
- containsPhoneNumber = _ref142.containsPhoneNumber;
7030
+ var createProfileScopeDescription = function createProfileScopeDescription(_ref143) {
7031
+ var containsProfile = _ref143.containsProfile,
7032
+ containsEmail = _ref143.containsEmail,
7033
+ containsPhoneNumber = _ref143.containsPhoneNumber;
7030
7034
  var details = [];
7031
7035
  if (containsProfile) {
7032
7036
  details.push('Your name, profile picture, and language preferences');
@@ -7070,55 +7074,93 @@ var createCustomScopeDescriptions = function createCustomScopeDescriptions(scope
7070
7074
  }
7071
7075
  return descriptions;
7072
7076
  };
7073
- var fallbackConsentManifestGenerator = function fallbackConsentManifestGenerator(_ref143) {
7074
- var scopes = _ref143.scopes,
7075
- clientName = _ref143.clientName,
7076
- rbacPolicy = _ref143.rbacPolicy;
7077
+ var fallbackConsentManifestGenerator = function fallbackConsentManifestGenerator(_ref144) {
7078
+ var scopes = _ref144.scopes,
7079
+ clientName = _ref144.clientName,
7080
+ rbacPolicy = _ref144.rbacPolicy;
7077
7081
  return [{
7078
7082
  header: "".concat(clientName, " is requesting to:"),
7079
7083
  items: createBuiltinScopeDescriptions(scopes).concat(createCustomScopeDescriptions(scopes, rbacPolicy))
7080
7084
  }];
7081
7085
  };
7082
- var parseOAuthAuthorizeParams = function parseOAuthAuthorizeParams(searchParams) {
7083
- var params = new URLSearchParams(searchParams);
7084
- var parsedParams = {
7086
+ var parseOAuthAuthorizeParams = function parseOAuthAuthorizeParams(params) {
7087
+ var authorizeParams = {
7085
7088
  client_id: '',
7086
7089
  redirect_uri: '',
7087
7090
  response_type: '',
7088
7091
  scope: ''
7089
7092
  };
7090
- var missingField = function missingField(field) {
7091
- return {
7092
- error: "Required parameter is missing: ".concat(field, ". Please reach out to the application developer."),
7093
- params: parsedParams
7094
- };
7095
- };
7096
7093
  var requiredFields = ['client_id', 'redirect_uri', 'response_type', 'scope'];
7097
7094
  for (var _i3 = 0, _requiredFields = requiredFields; _i3 < _requiredFields.length; _i3++) {
7098
7095
  var field = _requiredFields[_i3];
7099
7096
  var value = params.get(field);
7100
7097
  if (!value) {
7101
- return missingField(field);
7098
+ return {
7099
+ error: "Required parameter is missing: ".concat(field, ". Please reach out to the application developer."),
7100
+ result: authorizeParams
7101
+ };
7102
7102
  }
7103
- parsedParams[field] = value;
7103
+ authorizeParams[field] = value;
7104
7104
  }
7105
7105
  var optionalFields = ['code_challenge', 'state', 'nonce'];
7106
7106
  for (var _i4 = 0, _optionalFields = optionalFields; _i4 < _optionalFields.length; _i4++) {
7107
7107
  var _field = _optionalFields[_i4];
7108
7108
  var _value = params.get(_field);
7109
- if (!_value) {
7110
- continue;
7109
+ if (_value) {
7110
+ authorizeParams[_field] = _value;
7111
7111
  }
7112
- parsedParams[_field] = _value;
7113
7112
  }
7114
7113
  return {
7115
7114
  error: null,
7116
- params: parsedParams
7115
+ result: authorizeParams
7117
7116
  };
7118
7117
  };
7119
- var initialState = function initialState(_ref144) {
7120
- var error = _ref144.error,
7121
- params = _ref144.params;
7118
+ var parseOAuthLogoutParams = function parseOAuthLogoutParams(params) {
7119
+ var logoutParams = {
7120
+ client_id: '',
7121
+ post_logout_redirect_uri: ''
7122
+ };
7123
+ var requiredFields = ['client_id', 'post_logout_redirect_uri'];
7124
+ for (var _i5 = 0, _requiredFields2 = requiredFields; _i5 < _requiredFields2.length; _i5++) {
7125
+ var field = _requiredFields2[_i5];
7126
+ var value = params.get(field);
7127
+ if (!value) {
7128
+ return {
7129
+ error: "Required parameter is missing: ".concat(field, ". Please reach out to the application developer."),
7130
+ result: logoutParams
7131
+ };
7132
+ }
7133
+ logoutParams[field] = value;
7134
+ }
7135
+ logoutParams.id_token_hint = params.get('id_token_hint') || undefined;
7136
+ logoutParams.state = params.get('state') || undefined;
7137
+ return {
7138
+ error: null,
7139
+ result: logoutParams
7140
+ };
7141
+ };
7142
+ var parseIDPParams = function parseIDPParams(searchParams) {
7143
+ var params = new URLSearchParams(searchParams);
7144
+ if (params.has('post_logout_redirect_uri')) {
7145
+ var logoutResult = parseOAuthLogoutParams(params);
7146
+ return {
7147
+ error: logoutResult.error,
7148
+ flow: {
7149
+ type: 'Logout',
7150
+ params: logoutResult.result
7151
+ }
7152
+ };
7153
+ }
7154
+ var authorizeResult = parseOAuthAuthorizeParams(params);
7155
+ return {
7156
+ error: authorizeResult.error,
7157
+ flow: {
7158
+ type: 'Authorize',
7159
+ params: authorizeResult.result
7160
+ }
7161
+ };
7162
+ };
7163
+ var initialState$1 = function initialState$1(error, params) {
7122
7164
  return {
7123
7165
  loading: !error,
7124
7166
  preflight: !!error,
@@ -7170,17 +7212,16 @@ var idpStateReducer = function idpStateReducer(state, action) {
7170
7212
  }
7171
7213
  };
7172
7214
  var useIDPState = function useIDPState(_ref145) {
7173
- var oauthAuthorizeStart = _ref145.oauthAuthorizeStart,
7215
+ var initialError = _ref145.initialError,
7216
+ initialParams = _ref145.initialParams,
7217
+ oauthAuthorizeStart = _ref145.oauthAuthorizeStart,
7174
7218
  oauthAuthorizeSubmit = _ref145.oauthAuthorizeSubmit,
7175
7219
  onError = _ref145.onError,
7176
7220
  onEvent = _ref145.onEvent;
7177
- var _extractErrorMessage$79 = extractErrorMessage.h(parseOAuthAuthorizeParams(window.location.search)),
7178
- _extractErrorMessage$80 = _slicedToArray(_extractErrorMessage$79, 1),
7179
- parseResult = _extractErrorMessage$80[0];
7180
- var _extractErrorMessage$81 = extractErrorMessage.s(idpStateReducer, initialState(parseResult)),
7181
- _extractErrorMessage$82 = _slicedToArray(_extractErrorMessage$81, 2),
7182
- state = _extractErrorMessage$82[0],
7183
- dispatch = _extractErrorMessage$82[1];
7221
+ var _extractErrorMessage$79 = extractErrorMessage.s(idpStateReducer, initialState$1(initialError, initialParams)),
7222
+ _extractErrorMessage$80 = _slicedToArray(_extractErrorMessage$79, 2),
7223
+ state = _extractErrorMessage$80[0],
7224
+ dispatch = _extractErrorMessage$80[1];
7184
7225
  var onErrorRef = extractErrorMessage._(onError);
7185
7226
  extractErrorMessage.p(function () {
7186
7227
  onErrorRef.current = onError;
@@ -7190,10 +7231,9 @@ var useIDPState = function useIDPState(_ref145) {
7190
7231
  onEventRef.current = onEvent;
7191
7232
  }, [onEvent]);
7192
7233
  extractErrorMessage.p(function () {
7193
- var errorMessage = parseResult.error;
7194
- if (!errorMessage) return;
7195
- onErrorRef.current(new internal.IDPOAuthFlowMissingParamError(errorMessage));
7196
- }, [parseResult.error]);
7234
+ if (!initialError) return;
7235
+ onErrorRef.current(new internal.IDPOAuthFlowMissingParamError(initialError));
7236
+ }, [initialError]);
7197
7237
  var submitInternal = extractErrorMessage.T(function (_ref146) {
7198
7238
  var consent_required = _ref146.consent_required,
7199
7239
  consent_granted = _ref146.consent_granted;
@@ -7205,7 +7245,7 @@ var useIDPState = function useIDPState(_ref145) {
7205
7245
  type: 'START_SUBMIT'
7206
7246
  });
7207
7247
  _context24.next = 3;
7208
- return oauthAuthorizeSubmit(Object.assign(Object.assign({}, parseResult.params), {
7248
+ return oauthAuthorizeSubmit(Object.assign(Object.assign({}, initialParams), {
7209
7249
  consent_granted: consent_granted
7210
7250
  }));
7211
7251
  case 3:
@@ -7232,7 +7272,7 @@ var useIDPState = function useIDPState(_ref145) {
7232
7272
  }
7233
7273
  }, _callee24);
7234
7274
  }));
7235
- }, [dispatch, oauthAuthorizeSubmit, parseResult.params]);
7275
+ }, [dispatch, oauthAuthorizeSubmit, initialParams]);
7236
7276
  var submit = extractErrorMessage.T(function (_ref147) {
7237
7277
  var consent_granted = _ref147.consent_granted;
7238
7278
  return submitInternal({
@@ -7252,18 +7292,18 @@ var useIDPState = function useIDPState(_ref145) {
7252
7292
  onEventRef.current({
7253
7293
  type: internal.StytchEventType.OAuthAuthorizeFlowStart,
7254
7294
  data: {
7255
- client_id: parseResult.params['client_id'],
7256
- redirect_uri: parseResult.params['redirect_uri'],
7257
- scope: parseResult.params['scope']
7295
+ client_id: initialParams['client_id'],
7296
+ redirect_uri: initialParams['redirect_uri'],
7297
+ scope: initialParams['scope']
7258
7298
  }
7259
7299
  });
7260
7300
  _context25.prev = 2;
7261
7301
  _context25.next = 5;
7262
7302
  return oauthAuthorizeStart({
7263
- client_id: parseResult.params['client_id'],
7264
- redirect_uri: parseResult.params['redirect_uri'],
7265
- response_type: parseResult.params['response_type'],
7266
- scope: parseResult.params['scope']
7303
+ client_id: initialParams['client_id'],
7304
+ redirect_uri: initialParams['redirect_uri'],
7305
+ response_type: initialParams['response_type'],
7306
+ scope: initialParams['scope']
7267
7307
  });
7268
7308
  case 5:
7269
7309
  startResponse = _context25.sent;
@@ -7304,7 +7344,7 @@ var useIDPState = function useIDPState(_ref145) {
7304
7344
  }
7305
7345
  }, _callee25, null, [[2, 8]]);
7306
7346
  }));
7307
- }, [oauthAuthorizeStart, parseResult, submitInternal]);
7347
+ }, [oauthAuthorizeStart, initialParams, submitInternal]);
7308
7348
  extractErrorMessage.p(function () {
7309
7349
  if (state.preflight) {
7310
7350
  return;
@@ -7488,7 +7528,203 @@ var UngrantableScopes = function UngrantableScopes(_ref158) {
7488
7528
  }, "\u2022\xA0", desc));
7489
7529
  })));
7490
7530
  };
7491
- var IDPConsentScreenImpl = function IDPConsentScreenImpl() {
7531
+ var initialState = function initialState(error) {
7532
+ return {
7533
+ loading: !error,
7534
+ preflight: !!error,
7535
+ error: error,
7536
+ denied: false,
7537
+ consent_required: false,
7538
+ redirect_uri: ''
7539
+ };
7540
+ };
7541
+ var logoutStateReducer = function logoutStateReducer(state, action) {
7542
+ switch (action.type) {
7543
+ case 'START_PREFLIGHT':
7544
+ return Object.assign(Object.assign({}, state), {
7545
+ preflight: true,
7546
+ loading: true
7547
+ });
7548
+ case 'PREFLIGHT_ERROR':
7549
+ return Object.assign(Object.assign({}, state), {
7550
+ preflight: true,
7551
+ loading: false,
7552
+ error: action.error
7553
+ });
7554
+ case 'COMPLETE_PREFLIGHT':
7555
+ return Object.assign(Object.assign({}, state), {
7556
+ loading: false,
7557
+ consent_required: action.consent_required,
7558
+ redirect_uri: action.redirect_uri
7559
+ });
7560
+ case 'CONSENT_DENIED':
7561
+ return Object.assign(Object.assign({}, state), {
7562
+ denied: true
7563
+ });
7564
+ default:
7565
+ return state;
7566
+ }
7567
+ };
7568
+ var useLogoutState = function useLogoutState(_ref159) {
7569
+ var initialError = _ref159.initialError,
7570
+ initialParams = _ref159.initialParams,
7571
+ oauthLogoutStart = _ref159.oauthLogoutStart,
7572
+ revokeSession = _ref159.revokeSession,
7573
+ onError = _ref159.onError;
7574
+ var _extractErrorMessage$81 = extractErrorMessage.s(logoutStateReducer, initialState(initialError)),
7575
+ _extractErrorMessage$82 = _slicedToArray(_extractErrorMessage$81, 2),
7576
+ state = _extractErrorMessage$82[0],
7577
+ dispatch = _extractErrorMessage$82[1];
7578
+ var onErrorRef = extractErrorMessage._(onError);
7579
+ extractErrorMessage.p(function () {
7580
+ onErrorRef.current = onError;
7581
+ }, [onError]);
7582
+ extractErrorMessage.p(function () {
7583
+ if (!initialError) return;
7584
+ onErrorRef.current(new internal.IDPOAuthFlowMissingParamError(initialError));
7585
+ }, [initialError]);
7586
+ var submitInternal = extractErrorMessage.T(function (redirectURI) {
7587
+ return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
7588
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
7589
+ while (1) switch (_context26.prev = _context26.next) {
7590
+ case 0:
7591
+ _context26.next = 2;
7592
+ return revokeSession();
7593
+ case 2:
7594
+ window.location.href = redirectURI;
7595
+ case 3:
7596
+ case "end":
7597
+ return _context26.stop();
7598
+ }
7599
+ }, _callee26);
7600
+ }));
7601
+ }, [revokeSession]);
7602
+ var logoutPreflight = extractErrorMessage.T(function () {
7603
+ return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
7604
+ var startResponse, message;
7605
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
7606
+ while (1) switch (_context27.prev = _context27.next) {
7607
+ case 0:
7608
+ dispatch({
7609
+ type: 'START_PREFLIGHT'
7610
+ });
7611
+ _context27.prev = 1;
7612
+ _context27.next = 4;
7613
+ return oauthLogoutStart(initialParams);
7614
+ case 4:
7615
+ startResponse = _context27.sent;
7616
+ _context27.next = 13;
7617
+ break;
7618
+ case 7:
7619
+ _context27.prev = 7;
7620
+ _context27.t0 = _context27["catch"](1);
7621
+ message = _context27.t0.error_message;
7622
+ dispatch({
7623
+ type: 'PREFLIGHT_ERROR',
7624
+ error: message
7625
+ });
7626
+ onErrorRef.current(_context27.t0);
7627
+ return _context27.abrupt("return");
7628
+ case 13:
7629
+ if (!startResponse.consent_required) {
7630
+ _context27.next = 18;
7631
+ break;
7632
+ }
7633
+ dispatch({
7634
+ type: 'COMPLETE_PREFLIGHT',
7635
+ consent_required: startResponse.consent_required,
7636
+ redirect_uri: startResponse.redirect_uri
7637
+ });
7638
+ return _context27.abrupt("return");
7639
+ case 18:
7640
+ submitInternal(startResponse.redirect_uri);
7641
+ case 19:
7642
+ case "end":
7643
+ return _context27.stop();
7644
+ }
7645
+ }, _callee27, null, [[1, 7]]);
7646
+ }));
7647
+ }, [initialParams, oauthLogoutStart, submitInternal]);
7648
+ extractErrorMessage.p(function () {
7649
+ if (state.preflight) {
7650
+ return;
7651
+ }
7652
+ logoutPreflight();
7653
+ }, [logoutPreflight, state.preflight]);
7654
+ var submit = extractErrorMessage.T(function (_ref160) {
7655
+ var consent_granted = _ref160.consent_granted;
7656
+ return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
7657
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
7658
+ while (1) switch (_context28.prev = _context28.next) {
7659
+ case 0:
7660
+ if (!consent_granted) {
7661
+ _context28.next = 4;
7662
+ break;
7663
+ }
7664
+ return _context28.abrupt("return", submitInternal(state.redirect_uri));
7665
+ case 4:
7666
+ dispatch({
7667
+ type: 'CONSENT_DENIED'
7668
+ });
7669
+ case 5:
7670
+ case "end":
7671
+ return _context28.stop();
7672
+ }
7673
+ }, _callee28);
7674
+ }));
7675
+ }, [submitInternal, state]);
7676
+ return {
7677
+ state: state,
7678
+ submit: submit
7679
+ };
7680
+ };
7681
+ var IDPLogout = function IDPLogout(_ref161) {
7682
+ var state = _ref161.state,
7683
+ submit = _ref161.submit,
7684
+ bootstrap = _ref161.bootstrap,
7685
+ bootstrapNotLoaded = _ref161.bootstrapNotLoaded;
7686
+ var loading = state.loading,
7687
+ error = state.error,
7688
+ denied = state.denied;
7689
+ if (loading || bootstrapNotLoaded) {
7690
+ return /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingScreen, null);
7691
+ }
7692
+ if (error) {
7693
+ return /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorDisplay, {
7694
+ text: error
7695
+ });
7696
+ }
7697
+ if (denied) {
7698
+ return /*#__PURE__*/extractErrorMessage.wn.createElement(Confirmation, {
7699
+ text: "You have not been logged out. You may close this page."
7700
+ });
7701
+ }
7702
+ return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
7703
+ direction: "column",
7704
+ gap: 24
7705
+ }, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
7706
+ size: "header",
7707
+ align: "center"
7708
+ }, "Log out?"), /*#__PURE__*/extractErrorMessage.wn.createElement("div", null, "Are you sure you want to log out of your ", bootstrap.projectName, " account?"), /*#__PURE__*/extractErrorMessage.wn.createElement("div", null, /*#__PURE__*/extractErrorMessage.wn.createElement(Button, {
7709
+ type: "button",
7710
+ onClick: function onClick() {
7711
+ return submit({
7712
+ consent_granted: true
7713
+ });
7714
+ }
7715
+ }, "Yes"), /*#__PURE__*/extractErrorMessage.wn.createElement(Button, {
7716
+ type: "button",
7717
+ onClick: function onClick() {
7718
+ return submit({
7719
+ consent_granted: false
7720
+ });
7721
+ },
7722
+ variant: "text"
7723
+ }, "No")));
7724
+ };
7725
+ var IDPConsentScreenImpl = function IDPConsentScreenImpl(_ref162) {
7726
+ var initialError = _ref162.initialError,
7727
+ initialParams = _ref162.initialParams;
7492
7728
  var stytchClient = useStytch();
7493
7729
  var onError = useErrorCallback();
7494
7730
  var onEvent = useEventCallback();
@@ -7497,6 +7733,8 @@ var IDPConsentScreenImpl = function IDPConsentScreenImpl() {
7497
7733
  var bootstrap = useBootstrap();
7498
7734
  var customConsentManifestGenerator = useConsentManifestGenerator();
7499
7735
  var idpConsentState = useIDPState({
7736
+ initialError: initialError,
7737
+ initialParams: initialParams,
7500
7738
  oauthAuthorizeStart: oauthAuthorizeStart,
7501
7739
  oauthAuthorizeSubmit: oauthAuthorizeSubmit,
7502
7740
  onError: onError,
@@ -7548,11 +7786,44 @@ var IDPConsentScreenImpl = function IDPConsentScreenImpl() {
7548
7786
  clientName: clientName
7549
7787
  }));
7550
7788
  };
7789
+ var IDPLogoutScreenImpl = function IDPLogoutScreenImpl(_ref163) {
7790
+ var initialError = _ref163.initialError,
7791
+ initialParams = _ref163.initialParams;
7792
+ var stytchClient = useStytch();
7793
+ var onError = useErrorCallback();
7794
+ var oauthLogoutStart = internal.readB2BInternals(stytchClient).idp.oauthLogoutStart;
7795
+ var revokeSession = function revokeSession() {
7796
+ return stytchClient.session.revoke({
7797
+ forceClear: true
7798
+ });
7799
+ };
7800
+ var bootstrap = useBootstrap();
7801
+ var idpLogoutState = useLogoutState({
7802
+ initialError: initialError,
7803
+ initialParams: initialParams,
7804
+ oauthLogoutStart: oauthLogoutStart,
7805
+ revokeSession: revokeSession,
7806
+ onError: onError
7807
+ });
7808
+ return /*#__PURE__*/extractErrorMessage.wn.createElement(IDPLogout, Object.assign({}, idpLogoutState, {
7809
+ bootstrap: bootstrap,
7810
+ bootstrapNotLoaded: false
7811
+ }));
7812
+ };
7551
7813
  var IDPConsentScreen = function IDPConsentScreen() {
7552
- return /*#__PURE__*/extractErrorMessage.wn.createElement(EnsureMemberIsLoggedIn, null, /*#__PURE__*/extractErrorMessage.wn.createElement(IDPConsentScreenImpl, null));
7814
+ var _extractErrorMessage$83 = extractErrorMessage.h(parseIDPParams(window.location.search)),
7815
+ _extractErrorMessage$84 = _slicedToArray(_extractErrorMessage$83, 1),
7816
+ parseResult = _extractErrorMessage$84[0];
7817
+ return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, parseResult.flow.type === 'Authorize' && ( /*#__PURE__*/extractErrorMessage.wn.createElement(EnsureMemberIsLoggedIn, null, /*#__PURE__*/extractErrorMessage.wn.createElement(IDPConsentScreenImpl, {
7818
+ initialError: parseResult.error,
7819
+ initialParams: parseResult.flow.params
7820
+ }))), parseResult.flow.type === 'Logout' && ( /*#__PURE__*/extractErrorMessage.wn.createElement(IDPLogoutScreenImpl, {
7821
+ initialError: parseResult.error,
7822
+ initialParams: parseResult.flow.params
7823
+ })));
7553
7824
  };
7554
- var EnsureMemberIsLoggedIn = function EnsureMemberIsLoggedIn(_ref159) {
7555
- var children = _ref159.children;
7825
+ var EnsureMemberIsLoggedIn = function EnsureMemberIsLoggedIn(_ref164) {
7826
+ var children = _ref164.children;
7556
7827
  var member = useStytchMember();
7557
7828
  var onError = useErrorCallback();
7558
7829
  var onErrorRef = extractErrorMessage._(onError);
@@ -7593,8 +7864,8 @@ var AppContainer$1 = function AppContainer$1() {
7593
7864
  dispatch = _useGlobalReducer82[1];
7594
7865
  var stytchClient = useStytch();
7595
7866
  var config = useConfig();
7596
- var _extractErrorMessage$83 = extractErrorMessage.Ze(),
7597
- displayWatermark = _extractErrorMessage$83.displayWatermark;
7867
+ var _extractErrorMessage$85 = extractErrorMessage.Ze(),
7868
+ displayWatermark = _extractErrorMessage$85.displayWatermark;
7598
7869
  var isOnlyFloatingOneTap = useIsOnlyFloatingOneTap();
7599
7870
  var currentScreen = state.screen;
7600
7871
  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(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ScreenComponentMap, AppScreens$1.EmailOTPEntry, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailOTPEntryScreen, null)), AppScreens$1.SSODiscoveryEmail, /*#__PURE__*/extractErrorMessage.wn.createElement(SSODiscoveryEmail, null)), AppScreens$1.SSODiscoveryFallback, /*#__PURE__*/extractErrorMessage.wn.createElement(SSODiscoveryFallback, null)), AppScreens$1.SSODiscoveryMenu, /*#__PURE__*/extractErrorMessage.wn.createElement(SSODiscoveryMenu, null)), AppScreens$1.IDPConsent, /*#__PURE__*/extractErrorMessage.wn.createElement(IDPConsentScreen, null)));
@@ -7620,8 +7891,8 @@ var AppContainer$1 = function AppContainer$1() {
7620
7891
  });
7621
7892
  };
7622
7893
  };
7623
- var _useMutate14 = useMutate("stytch.magicLinks.authenticate", function (_, _ref160) {
7624
- var token = _ref160.arg.token;
7894
+ var _useMutate14 = useMutate("stytch.magicLinks.authenticate", function (_, _ref165) {
7895
+ var token = _ref165.arg.token;
7625
7896
  return stytchClient.magicLinks.authenticate({
7626
7897
  magic_links_token: token,
7627
7898
  session_duration_minutes: config.sessionOptions.sessionDurationMinutes
@@ -7632,8 +7903,8 @@ var AppContainer$1 = function AppContainer$1() {
7632
7903
  }),
7633
7904
  stytchMagicLinkAuthenticate = _useMutate14.trigger,
7634
7905
  isMagicLinkLoading = _useMutate14.isMutating;
7635
- var _useMutate15 = useMutate("stytch.impersonation.authenticate", function (_, _ref161) {
7636
- var token = _ref161.arg.token;
7906
+ var _useMutate15 = useMutate("stytch.impersonation.authenticate", function (_, _ref166) {
7907
+ var token = _ref166.arg.token;
7637
7908
  return stytchClient.impersonation.authenticate({
7638
7909
  impersonation_token: token
7639
7910
  });
@@ -7643,8 +7914,8 @@ var AppContainer$1 = function AppContainer$1() {
7643
7914
  }),
7644
7915
  stytchImpersonationAuthenticate = _useMutate15.trigger,
7645
7916
  isImpersonationLoading = _useMutate15.isMutating;
7646
- var _useMutate16 = useMutate("stytch.oauth.authenticate", function (_, _ref162) {
7647
- var token = _ref162.arg.token;
7917
+ var _useMutate16 = useMutate("stytch.oauth.authenticate", function (_, _ref167) {
7918
+ var token = _ref167.arg.token;
7648
7919
  return stytchClient.oauth.authenticate({
7649
7920
  oauth_token: token,
7650
7921
  session_duration_minutes: config.sessionOptions.sessionDurationMinutes
@@ -7655,8 +7926,8 @@ var AppContainer$1 = function AppContainer$1() {
7655
7926
  }),
7656
7927
  stytchOAuthAuthenticate = _useMutate16.trigger,
7657
7928
  isOAuthLoading = _useMutate16.isMutating;
7658
- var _useMutate17 = useMutate("stytch.oauth.discovery.authenticate", function (_, _ref163) {
7659
- var token = _ref163.arg.token;
7929
+ var _useMutate17 = useMutate("stytch.oauth.discovery.authenticate", function (_, _ref168) {
7930
+ var token = _ref168.arg.token;
7660
7931
  return stytchClient.oauth.discovery.authenticate({
7661
7932
  discovery_oauth_token: token
7662
7933
  });
@@ -7666,8 +7937,8 @@ var AppContainer$1 = function AppContainer$1() {
7666
7937
  }),
7667
7938
  stytchOAuthDiscoveryAuthenticate = _useMutate17.trigger,
7668
7939
  isDiscoveryOAuthLoading = _useMutate17.isMutating;
7669
- var _useMutate18 = useMutate("stytch.sso.authenticate", function (_, _ref164) {
7670
- var token = _ref164.arg.token;
7940
+ var _useMutate18 = useMutate("stytch.sso.authenticate", function (_, _ref169) {
7941
+ var token = _ref169.arg.token;
7671
7942
  return stytchClient.sso.authenticate({
7672
7943
  sso_token: token,
7673
7944
  session_duration_minutes: config.sessionOptions.sessionDurationMinutes
@@ -7678,8 +7949,8 @@ var AppContainer$1 = function AppContainer$1() {
7678
7949
  }),
7679
7950
  stytchSSOAuthenticate = _useMutate18.trigger,
7680
7951
  isSSOLoading = _useMutate18.isMutating;
7681
- var _useMutate19 = useMutate("stytch.magicLinks.discovery.authenticate", function (_, _ref165) {
7682
- var token = _ref165.arg.token;
7952
+ var _useMutate19 = useMutate("stytch.magicLinks.discovery.authenticate", function (_, _ref170) {
7953
+ var token = _ref170.arg.token;
7683
7954
  return stytchClient.magicLinks.discovery.authenticate({
7684
7955
  discovery_magic_links_token: token
7685
7956
  });
@@ -7775,19 +8046,19 @@ var AppContainer$1 = function AppContainer$1() {
7775
8046
  displayWatermark: displayWatermark
7776
8047
  }, ScreenComponentMap[currentScreen]);
7777
8048
  };
7778
- var AppContainer = function AppContainer(_ref166) {
7779
- var client = _ref166.client,
7780
- styles = _ref166.styles,
7781
- callbacks = _ref166.callbacks,
7782
- config = _ref166.config;
7783
- var _extractErrorMessage$84 = extractErrorMessage.h(function () {
8049
+ var AppContainer = function AppContainer(_ref171) {
8050
+ var client = _ref171.client,
8051
+ styles = _ref171.styles,
8052
+ callbacks = _ref171.callbacks,
8053
+ config = _ref171.config;
8054
+ var _extractErrorMessage$86 = extractErrorMessage.h(function () {
7784
8055
  var _internal$readB2BInte6 = internal.readB2BInternals(client).bootstrap.getSync(),
7785
8056
  displayWatermark = _internal$readB2BInte6.displayWatermark;
7786
8057
  return displayWatermark;
7787
8058
  }),
7788
- _extractErrorMessage$85 = _slicedToArray(_extractErrorMessage$84, 2),
7789
- displayWatermark = _extractErrorMessage$85[0],
7790
- setDisplayWatermark = _extractErrorMessage$85[1];
8059
+ _extractErrorMessage$87 = _slicedToArray(_extractErrorMessage$86, 2),
8060
+ displayWatermark = _extractErrorMessage$87[0],
8061
+ setDisplayWatermark = _extractErrorMessage$87[1];
7791
8062
  extractErrorMessage.p(function () {
7792
8063
  internal.readB2BInternals(client).networkClient.logEvent({
7793
8064
  name: 'render_b2b_login_screen',
@@ -7795,8 +8066,8 @@ var AppContainer = function AppContainer(_ref166) {
7795
8066
  options: config
7796
8067
  }
7797
8068
  });
7798
- internal.readB2BInternals(client).bootstrap.getAsync().then(function (_ref167) {
7799
- var displayWatermark = _ref167.displayWatermark;
8069
+ internal.readB2BInternals(client).bootstrap.getAsync().then(function (_ref172) {
8070
+ var displayWatermark = _ref172.displayWatermark;
7800
8071
  setDisplayWatermark(displayWatermark);
7801
8072
  });
7802
8073
  }, [client]);
@@ -7826,11 +8097,11 @@ var AppContainer = function AppContainer(_ref166) {
7826
8097
  theme: theme
7827
8098
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(AppContainer$1, null)));
7828
8099
  };
7829
- var B2BIDPContainer = function B2BIDPContainer(_ref168) {
7830
- var client = _ref168.client,
7831
- styles = _ref168.styles,
7832
- callbacks = _ref168.callbacks,
7833
- getIDPConsentManifest = _ref168.getIDPConsentManifest;
8100
+ var B2BIDPContainer = function B2BIDPContainer(_ref173) {
8101
+ var client = _ref173.client,
8102
+ styles = _ref173.styles,
8103
+ callbacks = _ref173.callbacks,
8104
+ getIDPConsentManifest = _ref173.getIDPConsentManifest;
7834
8105
  var initialState = Object.assign(Object.assign({}, DEFAULT_STATE), {
7835
8106
  screen: AppScreens$1.IDPConsent
7836
8107
  });
@@ -7865,11 +8136,11 @@ var StytchB2BUIClient = /*#__PURE__*/function (_b2b_index_headless$S) {
7865
8136
  }
7866
8137
  _createClass(StytchB2BUIClient, [{
7867
8138
  key: "mount",
7868
- value: function mount(_ref169) {
7869
- var elementId = _ref169.elementId,
7870
- styles = _ref169.styles,
7871
- callbacks = _ref169.callbacks,
7872
- config = _ref169.config;
8139
+ value: function mount(_ref174) {
8140
+ var elementId = _ref174.elementId,
8141
+ styles = _ref174.styles,
8142
+ callbacks = _ref174.callbacks,
8143
+ config = _ref174.config;
7873
8144
  var _a;
7874
8145
  var targetParentDomNode = document.querySelector(elementId);
7875
8146
  if (!targetParentDomNode) {
@@ -7896,11 +8167,11 @@ var StytchB2BUIClient = /*#__PURE__*/function (_b2b_index_headless$S) {
7896
8167
  }
7897
8168
  }, {
7898
8169
  key: "mountIdentityProvider",
7899
- value: function mountIdentityProvider(_ref170) {
7900
- var elementId = _ref170.elementId,
7901
- styles = _ref170.styles,
7902
- callbacks = _ref170.callbacks,
7903
- getIDPConsentManifest = _ref170.getIDPConsentManifest;
8170
+ value: function mountIdentityProvider(_ref175) {
8171
+ var elementId = _ref175.elementId,
8172
+ styles = _ref175.styles,
8173
+ callbacks = _ref175.callbacks,
8174
+ getIDPConsentManifest = _ref175.getIDPConsentManifest;
7904
8175
  var _a;
7905
8176
  var targetParentDomNode = document.querySelector(elementId);
7906
8177
  if (!targetParentDomNode) {