@descope/web-components-ui 3.26.5 → 3.27.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.
package/dist/index.esm.js CHANGED
@@ -19358,6 +19358,20 @@ const asciiPattern =
19358
19358
  const unicodePattern =
19359
19359
  "^[\\p{L}\\p{M}\\p{N}._%+'\\-]+@(?:[\\p{L}\\p{M}\\p{N}](?:[\\p{L}\\p{M}\\p{N}\\-]*[\\p{L}\\p{M}\\p{N}])?\\.)+[\\p{L}\\p{M}][\\p{L}\\p{M}\\p{N}\\-]+$";
19360
19360
 
19361
+ // The autocomplete grammar is ordered (section-*, shipping/billing, field name, webauthn) and on/off can't be
19362
+ // combined with a field name, so `email` takes the field name's place, before webauthn
19363
+ const emailVerificationAutocomplete = (autocomplete) => {
19364
+ const tokens = (autocomplete || '')
19365
+ .split(/\s+/)
19366
+ .filter(
19367
+ (token) => token && !['username', 'email', 'on', 'off'].includes(token),
19368
+ );
19369
+ const webauthn = tokens.indexOf('webauthn');
19370
+ tokens.splice(webauthn === -1 ? tokens.length : webauthn, 0, 'email');
19371
+
19372
+ return tokens.join(' ');
19373
+ };
19374
+
19361
19375
  const componentName$B = getComponentName$1('email-field');
19362
19376
 
19363
19377
  const defaultAutocomplete = 'username';
@@ -19406,6 +19420,38 @@ const customMixin$6 = (superclass) =>
19406
19420
  if (!this.validatesFormat) {
19407
19421
  this.disableFormatValidation();
19408
19422
  }
19423
+
19424
+ if (this.emailVerification) {
19425
+ this.enableEmailVerification();
19426
+ }
19427
+ }
19428
+
19429
+ // Read once, in `init`: descope-wc renders the screen html once
19430
+ get emailVerification() {
19431
+ return this.getAttribute('email-verification') === 'true';
19432
+ }
19433
+
19434
+ // Browser email verification needs the native input to be an email field (autocomplete `email`).
19435
+ // The host keeps its own autocomplete: descope-wc finds the passkey autofill field by an exact
19436
+ // `[autocomplete="webauthn"]` match on it, so changing the host would break passkeys
19437
+ enableEmailVerification() {
19438
+ const { baseElement } = this;
19439
+ const delegate = baseElement._delegateAttribute.bind(baseElement);
19440
+ // vaadin writes the native autocomplete only through here, so it writes ours
19441
+ baseElement._delegateAttribute = (name, value) =>
19442
+ delegate(
19443
+ name,
19444
+ name === 'autocomplete'
19445
+ ? emailVerificationAutocomplete(value)
19446
+ : value,
19447
+ );
19448
+ baseElement._delegateAttribute('autocomplete', baseElement.autocomplete);
19449
+
19450
+ // the external input copies the host autocomplete once, when it is created
19451
+ this.externalInput?.setAttribute(
19452
+ 'autocomplete',
19453
+ emailVerificationAutocomplete(this.getAttribute('autocomplete')),
19454
+ );
19409
19455
  }
19410
19456
 
19411
19457
  enableUnicode() {
@@ -26038,6 +26084,10 @@ const recoveryCodes = {
26038
26084
  center: { [vars$V.textAlign]: 'center' },
26039
26085
  },
26040
26086
 
26087
+ displayVariant: {
26088
+ buttons: { [vars$V.hostMinWidth]: '100px' },
26089
+ },
26090
+
26041
26091
  _fullWidth: {
26042
26092
  [vars$V.hostWidth]: '100%',
26043
26093
  },