@reachfive/identity-ui 1.26.0 → 1.26.1

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @reachfive/identity-ui - v1.26.0
3
- * Compiled Tue, 09 Apr 2024 15:08:41 UTC
2
+ * @reachfive/identity-ui - v1.26.1
3
+ * Compiled Fri, 19 Apr 2024 13:15:48 UTC
4
4
  *
5
5
  * Copyright (c) ReachFive.
6
6
  *
@@ -4572,6 +4572,7 @@ function isValued(v, rawProperty = "raw") {
4572
4572
  const unwrap = v !== null && typeof v === "object" ? v[rawProperty] : v;
4573
4573
  return unwrap !== null && unwrap !== void 0 && unwrap !== "" && !Number.isNaN(unwrap) && (Array.isArray(unwrap) ? unwrap.length > 0 : true);
4574
4574
  }
4575
+ const isCustomIdentifier = (identifier) => "customIdentifier" in identifier;
4575
4576
  const specializeIdentifier = (identifier) => isValidEmail(identifier) ? { email: identifier } : libphonenumber__namespace.isValidNumber(identifier) ? { phoneNumber: identifier.replace(/\s+/g, "") } : { customIdentifier: identifier };
4576
4577
  function specializeIdentifierData(data) {
4577
4578
  if ("identifier" in data && typeof data.identifier === "string") {
@@ -5264,7 +5265,7 @@ function createForm(config) {
5264
5265
  }, () => callback && callback(!this.state.hasErrors));
5265
5266
  }
5266
5267
  render() {
5267
- const { submitLabel, i18n, fieldValidationDebounce } = this.props;
5268
+ const { submitLabel, allowWebAuthnLogin, i18n, fieldValidationDebounce } = this.props;
5268
5269
  const { errorMessage, isLoading, fields } = this.state;
5269
5270
  return /* @__PURE__ */ React.createElement(Form, { noValidate: true, onSubmit: this.handleSubmit }, errorMessage && /* @__PURE__ */ React.createElement(Error$1, null, errorMessage), this.allFields.map((field) => !field.staticContent ? field.render({
5270
5271
  state: fields[field.key],
@@ -5275,7 +5276,7 @@ function createForm(config) {
5275
5276
  }, fieldValidationDebounce)(this);
5276
5277
  },
5277
5278
  ...this.props.sharedProps
5278
- }) : field.staticContent), /* @__PURE__ */ React.createElement(PrimaryButton, { disabled: isLoading }, i18n(submitLabel)));
5279
+ }) : field.staticContent), !allowWebAuthnLogin && /* @__PURE__ */ React.createElement(PrimaryButton, { disabled: isLoading }, i18n(submitLabel)), allowWebAuthnLogin && this.props.webAuthnButtons(isLoading, this.handleClick));
5279
5280
  }
5280
5281
  }
5281
5282
  __publicField$8(FormComponent, "defaultProps", {
@@ -5969,7 +5970,7 @@ const simpleField = ({ type, placeholder, ...config }) => createField({
5969
5970
  }
5970
5971
  });
5971
5972
 
5972
- const ForgotPasswordWrapper = styled.div`
5973
+ const ForgotPasswordWrapper$1 = styled.div`
5973
5974
  margin-bottom: ${(props) => props.theme.spacing}px;
5974
5975
  text-align: right;
5975
5976
  ${(props) => props.floating && `
@@ -6010,7 +6011,7 @@ const LoginForm = createForm({
6010
6011
  canShowPassword
6011
6012
  }),
6012
6013
  showForgotPassword && {
6013
- staticContent: /* @__PURE__ */ React.createElement(ForgotPasswordWrapper, { key: "forgot-password", floating: showRememberMe }, /* @__PURE__ */ React.createElement(Link, { target: "forgot-password" }, i18n("login.forgotPasswordLink")))
6014
+ staticContent: /* @__PURE__ */ React.createElement(ForgotPasswordWrapper$1, { key: "forgot-password", floating: showRememberMe }, /* @__PURE__ */ React.createElement(Link, { target: "forgot-password" }, i18n("login.forgotPasswordLink")))
6014
6015
  },
6015
6016
  showRememberMe && checkboxField({
6016
6017
  key: "auth.persistent",
@@ -6080,6 +6081,290 @@ const LoginView = ({
6080
6081
  ), allowSignup && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("login.signupLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { target: "signup", controller }, i18n("login.signupLink"))));
6081
6082
  };
6082
6083
 
6084
+ var _path$3, _path2$1;
6085
+ function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
6086
+ var SvgFingerprint = function SvgFingerprint(props) {
6087
+ return /*#__PURE__*/reactExports.createElement("svg", _extends$3({
6088
+ xmlns: "http://www.w3.org/2000/svg",
6089
+ fill: "currentColor",
6090
+ viewBox: "0 0 24 24"
6091
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/reactExports.createElement("path", {
6092
+ fill: "none",
6093
+ d: "M0 0h24v24H0z"
6094
+ })), _path2$1 || (_path2$1 = /*#__PURE__*/reactExports.createElement("path", {
6095
+ d: "M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2a.506.506 0 0 1 .2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67a.49.49 0 0 1-.44.28M3.5 9.72a.499.499 0 0 1-.41-.79c.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25a.5.5 0 0 1-.12.7c-.23.16-.54.11-.7-.12a9.4 9.4 0 0 0-3.39-2.94c-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21m6.25 12.07a.47.47 0 0 1-.35-.15c-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39s-4.66 1.97-4.66 4.39c0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15m7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12M14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1a7.3 7.3 0 0 1-2.17-5.22c0-1.62 1.38-2.94 3.08-2.94s3.08 1.32 3.08 2.94c0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29a11.1 11.1 0 0 1-.73-3.96c0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38"
6096
+ })));
6097
+ };
6098
+
6099
+ var _path$2, _path2;
6100
+ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
6101
+ var SvgKeyboard = function SvgKeyboard(props) {
6102
+ return /*#__PURE__*/reactExports.createElement("svg", _extends$2({
6103
+ xmlns: "http://www.w3.org/2000/svg",
6104
+ fill: "currentColor",
6105
+ viewBox: "0 0 24 24"
6106
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/reactExports.createElement("path", {
6107
+ d: "M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm9 7H8v-2h8zm0-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z"
6108
+ })), _path2 || (_path2 = /*#__PURE__*/reactExports.createElement("path", {
6109
+ fill: "none",
6110
+ d: "M0 0h24v24H0zm0 0h24v24H0z"
6111
+ })));
6112
+ };
6113
+
6114
+ const iconStyle$1 = `
6115
+ width: 40px;
6116
+ height: 40px;
6117
+ `;
6118
+ const FingerPrintIcon = styled(SvgFingerprint)`${iconStyle$1}`;
6119
+ const KeyboardIcon = styled(SvgKeyboard)`${iconStyle$1}`;
6120
+ const PrimaryButtonWithIcon = styled(({
6121
+ type = "submit",
6122
+ disabled = false,
6123
+ text,
6124
+ children,
6125
+ className,
6126
+ ...props
6127
+ }) => {
6128
+ const theme = useTheme();
6129
+ return /* @__PURE__ */ React.createElement(
6130
+ Button,
6131
+ {
6132
+ type,
6133
+ disabled,
6134
+ ...props,
6135
+ className: classes(["r5-button-with-icon"], className),
6136
+ background: theme.backgroundColor,
6137
+ border: theme.backgroundColor,
6138
+ color: theme.primaryColor
6139
+ },
6140
+ children,
6141
+ text && /* @__PURE__ */ React.createElement("span", { className: "r5-button-text" }, text)
6142
+ );
6143
+ })`
6144
+ display: flex;
6145
+ align-items: center;
6146
+ justify-content: center;
6147
+
6148
+ .r5-button-text {
6149
+ margin-left: 10px;
6150
+ text-transform: uppercase;
6151
+ }
6152
+ `;
6153
+ const ButtonsSeparator = styled.div`
6154
+ text-align: center;
6155
+ color: ${(props) => props.theme.mutedTextColor}
6156
+ `;
6157
+ const WebAuthnLoginViewButtons = styled(({ disabled, onPasswordClick, className, ...props }) => {
6158
+ const i18n = useI18n();
6159
+ return /* @__PURE__ */ React.createElement("div", { className: classes(["r5-webauthn-login-buttons"], className) }, /* @__PURE__ */ React.createElement(
6160
+ PrimaryButtonWithIcon,
6161
+ {
6162
+ type: "submit",
6163
+ dataTestId: "webauthn-button",
6164
+ title: i18n("login.withBiometrics"),
6165
+ disabled,
6166
+ ...props
6167
+ },
6168
+ /* @__PURE__ */ React.createElement(FingerPrintIcon, null)
6169
+ ), /* @__PURE__ */ React.createElement(ButtonsSeparator, null, i18n("or")), /* @__PURE__ */ React.createElement(
6170
+ PrimaryButtonWithIcon,
6171
+ {
6172
+ dataTestId: "password-button",
6173
+ title: i18n("login.withPassword"),
6174
+ disabled,
6175
+ onClick: onPasswordClick
6176
+ },
6177
+ /* @__PURE__ */ React.createElement(KeyboardIcon, null)
6178
+ ));
6179
+ })`
6180
+ display: flex;
6181
+ align-items: center;
6182
+
6183
+ & > :not(:last-child) {
6184
+ margin-right: 20px;
6185
+ }
6186
+ `;
6187
+ const WebAuthnSignupViewButtons = styled(({ onBiometricClick, onPasswordClick, className }) => {
6188
+ const i18n = useI18n();
6189
+ return /* @__PURE__ */ React.createElement("div", { className: classes(["r5-webauthn-signup-buttons"], className) }, /* @__PURE__ */ React.createElement(
6190
+ PrimaryButtonWithIcon,
6191
+ {
6192
+ dataTestId: "webauthn-button",
6193
+ onClick: onBiometricClick,
6194
+ title: i18n("signup.withBiometrics"),
6195
+ text: i18n("biometrics")
6196
+ },
6197
+ /* @__PURE__ */ React.createElement(FingerPrintIcon, null)
6198
+ ), /* @__PURE__ */ React.createElement(Separator, { text: i18n("or") }), /* @__PURE__ */ React.createElement(
6199
+ PrimaryButtonWithIcon,
6200
+ {
6201
+ dataTestId: "password-button",
6202
+ onClick: onPasswordClick,
6203
+ title: i18n("signup.withPassword"),
6204
+ text: i18n("password")
6205
+ },
6206
+ /* @__PURE__ */ React.createElement(KeyboardIcon, null)
6207
+ ));
6208
+ })``;
6209
+
6210
+ const LoginWithWebAuthnForm = createForm({
6211
+ prefix: "r5-login-",
6212
+ fields({ showIdentifier = true, defaultIdentifier, config }) {
6213
+ return [
6214
+ identifierField(
6215
+ {
6216
+ defaultValue: defaultIdentifier,
6217
+ withPhoneNumber: showIdentifier && config.sms,
6218
+ required: true,
6219
+ autoComplete: "username webauthn"
6220
+ },
6221
+ config
6222
+ )
6223
+ ];
6224
+ },
6225
+ allowWebAuthnLogin: true
6226
+ });
6227
+ const LoginWithWebAuthnView = ({ acceptTos, allowSignup = true, auth, showLabels = false, socialProviders }) => {
6228
+ const coreClient = useReachfive();
6229
+ const { goTo } = useRouting();
6230
+ const i18n = useI18n();
6231
+ const session = useSession();
6232
+ const controller = new AbortController();
6233
+ const signal = controller.signal;
6234
+ React.useEffect(() => {
6235
+ coreClient.loginWithWebAuthn({
6236
+ conditionalMediation: "preferred",
6237
+ auth: {
6238
+ ...auth
6239
+ },
6240
+ signal
6241
+ }).catch(() => void 0);
6242
+ }, [coreClient, auth, signal]);
6243
+ const handleWebAuthnLogin = React.useCallback(
6244
+ (data) => {
6245
+ const { auth: dataAuth, ...identifier } = specializeIdentifierData(data);
6246
+ if (isCustomIdentifier(identifier)) {
6247
+ console.error("Custom identifier is not a valid WebAuthn identifier.");
6248
+ return Promise.reject(new Error("Custom identifier is not a valid WebAuthn identifier."));
6249
+ }
6250
+ return coreClient.loginWithWebAuthn({
6251
+ ...identifier,
6252
+ auth: {
6253
+ ...dataAuth,
6254
+ ...auth
6255
+ }
6256
+ });
6257
+ },
6258
+ [coreClient, auth]
6259
+ );
6260
+ const redirectToPasswordLoginView = reactExports.useCallback(
6261
+ (data) => {
6262
+ const username = "identifier" in data ? data.identifier : "email" in data ? data.email : "";
6263
+ goTo("login-with-password", { username });
6264
+ },
6265
+ [goTo]
6266
+ );
6267
+ const defaultIdentifier = session?.lastLoginType === "password" ? session.email : void 0;
6268
+ const webAuthnButtons = (disabled, handleClick) => /* @__PURE__ */ React.createElement(
6269
+ WebAuthnLoginViewButtons,
6270
+ {
6271
+ disabled,
6272
+ onPasswordClick: handleClick
6273
+ }
6274
+ );
6275
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("login.title")), socialProviders && socialProviders.length > 0 && /* @__PURE__ */ React.createElement(SocialButtons, { providers: socialProviders, auth, acceptTos }), socialProviders && socialProviders.length > 0 && /* @__PURE__ */ React.createElement(Separator, { text: i18n("or") }), /* @__PURE__ */ React.createElement(
6276
+ LoginWithWebAuthnForm,
6277
+ {
6278
+ showLabels,
6279
+ defaultIdentifier,
6280
+ handler: handleWebAuthnLogin,
6281
+ redirect: redirectToPasswordLoginView,
6282
+ webAuthnButtons
6283
+ }
6284
+ ), allowSignup && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("login.signupLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { controller, target: "signup" }, i18n("login.signupLink"))));
6285
+ };
6286
+
6287
+ const ForgotPasswordWrapper = styled.div`
6288
+ margin-bottom: ${(props) => props.theme.spacing}px;
6289
+ text-align: right;
6290
+ ${(props) => props.floating && `
6291
+ position: absolute;
6292
+ right: 0;
6293
+ `};
6294
+ `;
6295
+ const LoginWithPasswordForm = createForm({
6296
+ prefix: "r5-login-",
6297
+ fields({ username, showRememberMe, canShowPassword, showForgotPassword, i18n, config }) {
6298
+ return [
6299
+ config.sms ? identifierField({
6300
+ key: "identifier",
6301
+ defaultValue: username,
6302
+ withPhoneNumber: true,
6303
+ readOnly: true
6304
+ }, config) : identifierField({
6305
+ key: "identifier",
6306
+ defaultValue: username,
6307
+ withPhoneNumber: false,
6308
+ readOnly: true
6309
+ }, config),
6310
+ simplePasswordField({
6311
+ key: "password",
6312
+ label: "password",
6313
+ autoComplete: "current-password",
6314
+ canShowPassword
6315
+ }),
6316
+ showForgotPassword && {
6317
+ staticContent: /* @__PURE__ */ React.createElement(ForgotPasswordWrapper, { key: "forgot-password", floating: showRememberMe }, /* @__PURE__ */ React.createElement(Link, { target: "forgot-password" }, i18n("login.forgotPasswordLink")))
6318
+ },
6319
+ showRememberMe && checkboxField({
6320
+ key: "auth.persistent",
6321
+ label: "rememberMe",
6322
+ defaultValue: false
6323
+ })
6324
+ ];
6325
+ },
6326
+ submitLabel: "login.submitLabel"
6327
+ });
6328
+ const LoginWithPasswordView = ({
6329
+ allowForgotPassword = true,
6330
+ auth,
6331
+ canShowPassword,
6332
+ recaptcha_enabled = false,
6333
+ recaptcha_site_key,
6334
+ showLabels,
6335
+ showRememberMe
6336
+ }) => {
6337
+ const i18n = useI18n();
6338
+ const coreClient = useReachfive();
6339
+ const { goTo, params } = useRouting();
6340
+ const { username } = params;
6341
+ reactExports.useLayoutEffect(() => {
6342
+ importGoogleRecaptchaScript(recaptcha_site_key);
6343
+ }, [recaptcha_site_key]);
6344
+ const callback = (data) => {
6345
+ const { auth: dataAuth, ...specializedData } = specializeIdentifierData(data);
6346
+ return coreClient.loginWithPassword({
6347
+ ...specializedData,
6348
+ captchaToken: data.captchaToken,
6349
+ auth: {
6350
+ ...dataAuth,
6351
+ ...auth
6352
+ }
6353
+ }).then((res) => res?.stepUpToken ? goTo("fa-selection", { token: res.stepUpToken, amr: res.amr ?? [] }) : res);
6354
+ };
6355
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("login.title")), /* @__PURE__ */ React.createElement(
6356
+ LoginWithPasswordForm,
6357
+ {
6358
+ username,
6359
+ showLabels,
6360
+ showRememberMe,
6361
+ showForgotPassword: allowForgotPassword,
6362
+ canShowPassword,
6363
+ handler: (data) => ReCaptcha.handle(data, { recaptcha_enabled, recaptcha_site_key }, callback, "login")
6364
+ }
6365
+ ), /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: "login-with-web-authn" }, i18n("login.password.userAnotherIdentifier"))));
6366
+ };
6367
+
6083
6368
  const SelectField = (props) => {
6084
6369
  const {
6085
6370
  value = "",
@@ -6969,100 +7254,10 @@ const PasswordSignupForm = ({
6969
7254
  );
6970
7255
  };
6971
7256
 
6972
- var _path$3, _path2$1;
6973
- function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
6974
- var SvgFingerprint = function SvgFingerprint(props) {
6975
- return /*#__PURE__*/reactExports.createElement("svg", _extends$3({
6976
- xmlns: "http://www.w3.org/2000/svg",
6977
- fill: "currentColor",
6978
- viewBox: "0 0 24 24"
6979
- }, props), _path$3 || (_path$3 = /*#__PURE__*/reactExports.createElement("path", {
6980
- fill: "none",
6981
- d: "M0 0h24v24H0z"
6982
- })), _path2$1 || (_path2$1 = /*#__PURE__*/reactExports.createElement("path", {
6983
- d: "M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2a.506.506 0 0 1 .2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67a.49.49 0 0 1-.44.28M3.5 9.72a.499.499 0 0 1-.41-.79c.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25a.5.5 0 0 1-.12.7c-.23.16-.54.11-.7-.12a9.4 9.4 0 0 0-3.39-2.94c-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21m6.25 12.07a.47.47 0 0 1-.35-.15c-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39s-4.66 1.97-4.66 4.39c0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15m7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12M14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1a7.3 7.3 0 0 1-2.17-5.22c0-1.62 1.38-2.94 3.08-2.94s3.08 1.32 3.08 2.94c0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29a11.1 11.1 0 0 1-.73-3.96c0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38"
6984
- })));
6985
- };
6986
-
6987
- var _path$2, _path2;
6988
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
6989
- var SvgKeyboard = function SvgKeyboard(props) {
6990
- return /*#__PURE__*/reactExports.createElement("svg", _extends$2({
6991
- xmlns: "http://www.w3.org/2000/svg",
6992
- fill: "currentColor",
6993
- viewBox: "0 0 24 24"
6994
- }, props), _path$2 || (_path$2 = /*#__PURE__*/reactExports.createElement("path", {
6995
- d: "M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm9 7H8v-2h8zm0-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z"
6996
- })), _path2 || (_path2 = /*#__PURE__*/reactExports.createElement("path", {
6997
- fill: "none",
6998
- d: "M0 0h24v24H0zm0 0h24v24H0z"
6999
- })));
7000
- };
7001
-
7002
- const iconStyle$1 = `
7003
- width: 40px;
7004
- height: 40px;
7005
- `;
7006
- const FingerPrintIcon = styled(SvgFingerprint)`${iconStyle$1}`;
7007
- const KeyboardIcon = styled(SvgKeyboard)`${iconStyle$1}`;
7008
- const PrimaryButtonWithIcon = styled(({
7009
- type = "submit",
7010
- disabled = false,
7011
- text,
7012
- children,
7013
- className,
7014
- ...props
7015
- }) => {
7016
- const theme = useTheme();
7017
- return /* @__PURE__ */ React.createElement(
7018
- Button,
7019
- {
7020
- type,
7021
- disabled,
7022
- ...props,
7023
- className: classes(["r5-button-with-icon"], className),
7024
- background: theme.backgroundColor,
7025
- border: theme.backgroundColor,
7026
- color: theme.primaryColor
7027
- },
7028
- children,
7029
- text && /* @__PURE__ */ React.createElement("span", { className: "r5-button-text" }, text)
7030
- );
7031
- })`
7032
- display: flex;
7033
- align-items: center;
7034
- justify-content: center;
7035
-
7036
- .r5-button-text {
7037
- margin-left: 10px;
7038
- text-transform: uppercase;
7039
- }
7040
- `;
7041
- const WebAuthnSignupViewButtons = styled(({ onBiometricClick, onPasswordClick, className }) => {
7042
- const i18n = useI18n();
7043
- return /* @__PURE__ */ React.createElement("div", { className: classes(["r5-webauthn-signup-buttons"], className) }, /* @__PURE__ */ React.createElement(
7044
- PrimaryButtonWithIcon,
7045
- {
7046
- dataTestId: "webauthn-button",
7047
- onClick: onBiometricClick,
7048
- title: i18n("signup.withBiometrics"),
7049
- text: i18n("biometrics")
7050
- },
7051
- /* @__PURE__ */ React.createElement(FingerPrintIcon, null)
7052
- ), /* @__PURE__ */ React.createElement(Separator, { text: i18n("or") }), /* @__PURE__ */ React.createElement(
7053
- PrimaryButtonWithIcon,
7054
- {
7055
- dataTestId: "password-button",
7056
- onClick: onPasswordClick,
7057
- title: i18n("signup.withPassword"),
7058
- text: i18n("password")
7059
- },
7060
- /* @__PURE__ */ React.createElement(KeyboardIcon, null)
7061
- ));
7062
- })``;
7063
-
7064
7257
  const SignupView = ({
7065
7258
  allowLogin = true,
7259
+ initialScreen,
7260
+ allowWebAuthnLogin = false,
7066
7261
  allowWebAuthnSignup = false,
7067
7262
  socialProviders,
7068
7263
  ...props
@@ -7075,7 +7270,7 @@ const SignupView = ({
7075
7270
  onPasswordClick: () => goTo("signup-with-password"),
7076
7271
  onBiometricClick: () => goTo("signup-with-web-authn")
7077
7272
  }
7078
- ) : /* @__PURE__ */ React.createElement(PasswordSignupForm, { ...props }), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("signup.loginLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { target: "login" }, i18n("signup.loginLink"))));
7273
+ ) : /* @__PURE__ */ React.createElement(PasswordSignupForm, { ...props }), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("signup.loginLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("signup.loginLink"))));
7079
7274
  };
7080
7275
 
7081
7276
  const SignupWithPasswordView = (props) => {
@@ -7148,7 +7343,9 @@ const ForgotPasswordView = ({
7148
7343
  allowLogin = true,
7149
7344
  displaySafeErrorMessage = false,
7150
7345
  showLabels = false,
7346
+ allowWebAuthnLogin = false,
7151
7347
  recaptcha_enabled = false,
7348
+ initialScreen,
7152
7349
  recaptcha_site_key,
7153
7350
  redirectUrl,
7154
7351
  returnToAfterPasswordReset
@@ -7176,18 +7373,18 @@ const ForgotPasswordView = ({
7176
7373
  onSuccess: () => goTo("forgot-password-success"),
7177
7374
  skipError: displaySafeErrorMessage && skipError
7178
7375
  }
7179
- ), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: "login" }, i18n("forgotPassword.backToLoginLink"))));
7376
+ ), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("forgotPassword.backToLoginLink"))));
7180
7377
  };
7181
- const ForgotPasswordSuccessView = ({ allowLogin }) => {
7378
+ const ForgotPasswordSuccessView = ({ allowLogin, initialScreen, allowWebAuthnLogin }) => {
7182
7379
  const i18n = useI18n();
7183
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("forgotPassword.title")), /* @__PURE__ */ React.createElement(Info, null, i18n("forgotPassword.successMessage")), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: "login" }, i18n("back"))));
7380
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("forgotPassword.title")), /* @__PURE__ */ React.createElement(Info, null, i18n("forgotPassword.successMessage")), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("back"))));
7184
7381
  };
7185
7382
 
7186
- const QuickLoginView = ({ auth, session }) => {
7383
+ const QuickLoginView = ({ initialScreen, allowWebAuthnLogin = false, auth, session }) => {
7187
7384
  const i18n = useI18n();
7188
7385
  if (!session)
7189
7386
  return null;
7190
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, session.name || session.email), /* @__PURE__ */ React.createElement(Intro, null, i18n("lastTimeYouLoggedInWith")), /* @__PURE__ */ React.createElement(SocialButtons, { providers: session.lastLoginType ? [session.lastLoginType] : [], auth }), /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: "login" }, i18n("notYourAccount"))));
7387
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, session.name || session.email), /* @__PURE__ */ React.createElement(Intro, null, i18n("lastTimeYouLoggedInWith")), /* @__PURE__ */ React.createElement(SocialButtons, { providers: session.lastLoginType ? [session.lastLoginType] : [], auth }), /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("notYourAccount"))));
7191
7388
  };
7192
7389
 
7193
7390
  const ReauthView = ({ allowForgotPassword = true, auth, session, showLabels = false, socialProviders }) => {
@@ -7338,20 +7535,28 @@ var mfaStepUpWidget = createMultiViewWidget({
7338
7535
  }
7339
7536
  });
7340
7537
 
7538
+ function selectLogin(initialScreen, allowWebAuthnLogin) {
7539
+ if (initialScreen === "login" || initialScreen === "login-with-web-authn")
7540
+ return initialScreen;
7541
+ return !allowWebAuthnLogin ? "login" : "login-with-web-authn";
7542
+ }
7341
7543
  var authWidget = createMultiViewWidget({
7342
7544
  initialView({
7343
7545
  initialScreen,
7344
7546
  allowLogin = true,
7345
7547
  allowQuickLogin = true,
7346
7548
  allowSignup = true,
7549
+ allowWebAuthnLogin,
7347
7550
  socialProviders,
7348
7551
  session = {}
7349
7552
  }) {
7350
7553
  const quickLogin = allowQuickLogin && !session.isAuthenticated && session.lastLoginType && socialProviders ? socialProviders.indexOf(session.lastLoginType) >= 0 : false;
7351
- return initialScreen || quickLogin && "quick-login" || session.isAuthenticated && "reauth" || allowLogin && "login" || allowSignup && "signup" || "forgot-password";
7554
+ return initialScreen || quickLogin && "quick-login" || session.isAuthenticated && "reauth" || allowLogin && !allowWebAuthnLogin && "login" || allowLogin && "login-with-web-authn" || allowSignup && "signup" || "forgot-password";
7352
7555
  },
7353
7556
  views: {
7354
7557
  "login": LoginView,
7558
+ "login-with-web-authn": LoginWithWebAuthnView,
7559
+ "login-with-password": LoginWithPasswordView,
7355
7560
  "signup": SignupView,
7356
7561
  "signup-with-password": SignupWithPasswordView,
7357
7562
  "signup-with-web-authn": SignupWithWebAuthnView,