@descope/flow-components 3.26.5 → 3.27.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.
@@ -5,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.26.5",
8
+ "buildVersion": "3.27.0",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
@@ -5,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.26.5",
8
+ "buildVersion": "3.27.0",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
package/dist/index.cjs.js CHANGED
@@ -98226,6 +98226,20 @@ function requireIndex_cjs () {
98226
98226
  const unicodePattern =
98227
98227
  "^[\\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}\\-]+$";
98228
98228
 
98229
+ // The autocomplete grammar is ordered (section-*, shipping/billing, field name, webauthn) and on/off can't be
98230
+ // combined with a field name, so `email` takes the field name's place, before webauthn
98231
+ const emailVerificationAutocomplete = (autocomplete) => {
98232
+ const tokens = (autocomplete || '')
98233
+ .split(/\s+/)
98234
+ .filter(
98235
+ (token) => token && !['username', 'email', 'on', 'off'].includes(token),
98236
+ );
98237
+ const webauthn = tokens.indexOf('webauthn');
98238
+ tokens.splice(webauthn === -1 ? tokens.length : webauthn, 0, 'email');
98239
+
98240
+ return tokens.join(' ');
98241
+ };
98242
+
98229
98243
  const componentName$U = getComponentName('email-field');
98230
98244
 
98231
98245
  const defaultAutocomplete = 'username';
@@ -98274,6 +98288,38 @@ function requireIndex_cjs () {
98274
98288
  if (!this.validatesFormat) {
98275
98289
  this.disableFormatValidation();
98276
98290
  }
98291
+
98292
+ if (this.emailVerification) {
98293
+ this.enableEmailVerification();
98294
+ }
98295
+ }
98296
+
98297
+ // Read once, in `init`: descope-wc renders the screen html once
98298
+ get emailVerification() {
98299
+ return this.getAttribute('email-verification') === 'true';
98300
+ }
98301
+
98302
+ // Browser email verification needs the native input to be an email field (autocomplete `email`).
98303
+ // The host keeps its own autocomplete: descope-wc finds the passkey autofill field by an exact
98304
+ // `[autocomplete="webauthn"]` match on it, so changing the host would break passkeys
98305
+ enableEmailVerification() {
98306
+ const { baseElement } = this;
98307
+ const delegate = baseElement._delegateAttribute.bind(baseElement);
98308
+ // vaadin writes the native autocomplete only through here, so it writes ours
98309
+ baseElement._delegateAttribute = (name, value) =>
98310
+ delegate(
98311
+ name,
98312
+ name === 'autocomplete'
98313
+ ? emailVerificationAutocomplete(value)
98314
+ : value,
98315
+ );
98316
+ baseElement._delegateAttribute('autocomplete', baseElement.autocomplete);
98317
+
98318
+ // the external input copies the host autocomplete once, when it is created
98319
+ this.externalInput?.setAttribute(
98320
+ 'autocomplete',
98321
+ emailVerificationAutocomplete(this.getAttribute('autocomplete')),
98322
+ );
98277
98323
  }
98278
98324
 
98279
98325
  enableUnicode() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "3.26.5",
3
+ "version": "3.27.0",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -98,7 +98,7 @@
98
98
  "webpack-subresource-integrity": "5.2.0-rc.1"
99
99
  },
100
100
  "dependencies": {
101
- "@descope/web-components-ui": "3.26.5"
101
+ "@descope/web-components-ui": "3.27.0"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "react": ">= 18"