@descope/flow-components 3.25.0 → 3.26.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.25.0",
8
+ "buildVersion": "3.26.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.25.0",
8
+ "buildVersion": "3.26.0",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
package/dist/index.cjs.js CHANGED
@@ -102717,6 +102717,7 @@ descope-enriched-text {
102717
102717
  'data-password-policy-actual-passwordstrength',
102718
102718
  'data-password-policy-value-disallowedchars',
102719
102719
  'data-password-policy-value-email',
102720
+ 'data-password-policy-value-reuse',
102720
102721
  ];
102721
102722
  const dataAttrs = ['data', 'active-policies', 'overrides', ...overrideAttrs];
102722
102723
  const policyAttrs = ['label', 'value', ...dataAttrs];
@@ -102813,6 +102814,13 @@ descope-enriched-text {
102813
102814
  }
102814
102815
  }
102815
102816
 
102817
+ if (attrName === 'data-password-policy-value-reuse') {
102818
+ const ln = Number(newValue);
102819
+ if (!Number.isNaN(ln) && ln > 0) {
102820
+ this.#overrides = { ...this.#overrides, reuse: { value: `${ln}` } };
102821
+ }
102822
+ }
102823
+
102816
102824
  if (attrName === 'data-password-policy-value-passwordstrength') {
102817
102825
  const passwordStrength = parseInt(newValue);
102818
102826
  if (!Number.isNaN(passwordStrength) && passwordStrength >= 0) {
@@ -102931,17 +102939,17 @@ descope-enriched-text {
102931
102939
  });
102932
102940
  }
102933
102941
 
102934
- return this.#activePolicies.reduce((results, id) => {
102942
+ const items = this.#activePolicies.reduce((results, id) => {
102935
102943
  const policy = policies.find((p) => p.id === id);
102936
102944
 
102937
102945
  if (!policy) {
102938
102946
  return results;
102939
102947
  }
102940
102948
 
102941
- const { pattern, message, data, compare } = policy;
102949
+ const { pattern, message, data, compare, info } = policy;
102942
102950
  const normalizedCompare = typeof compare === 'string' ? compare.toUpperCase() : compare;
102943
102951
 
102944
- if ((!pattern && !compare) || !message) {
102952
+ if ((!pattern && !compare && !info) || !message) {
102945
102953
  return results;
102946
102954
  }
102947
102955
 
@@ -102950,7 +102958,11 @@ descope-enriched-text {
102950
102958
  id,
102951
102959
  };
102952
102960
 
102953
- if (pattern) {
102961
+ if (info) {
102962
+ // informational rule the client can't check (e.g. password reuse):
102963
+ // `valid` stays undefined, so it renders neutral and never blocks `isValid`
102964
+ validationResult.info = true;
102965
+ } else if (pattern) {
102954
102966
  const exp = new RegExp(interpolateString(pattern, data));
102955
102967
  validationResult.valid = exp.test(this.value);
102956
102968
  } else if (normalizedCompare === 'STR_NEQ_CI') {
@@ -102979,14 +102991,17 @@ descope-enriched-text {
102979
102991
 
102980
102992
  return results;
102981
102993
  }, []);
102994
+
102995
+ // informational rules always render last
102996
+ return items.sort((a, b) => Number(!!a.info) - Number(!!b.info));
102982
102997
  }
102983
102998
 
102984
102999
  get isValid() {
102985
103000
  return !this.validate().some(({ valid }) => valid === false);
102986
103001
  }
102987
103002
 
102988
- buildValidationItem({ valid, message }) {
102989
- const status = !this.value ? 'none' : valid;
103003
+ buildValidationItem({ valid, message, info }) {
103004
+ const status = !this.value || info ? 'none' : valid;
102990
103005
  const li = document.createElement('li');
102991
103006
  li.className = 'item';
102992
103007
  li.dataset.valid = status;
@@ -103107,6 +103122,7 @@ descope-enriched-text {
103107
103122
  'data-password-policy-value-passwordstrength',
103108
103123
  'data-password-policy-value-disallowedchars',
103109
103124
  'data-password-policy-value-email',
103125
+ 'data-password-policy-value-reuse',
103110
103126
  'label-type',
103111
103127
  'manual-visibility-toggle',
103112
103128
  ],
@@ -112450,6 +112466,11 @@ const Logo = React__default.default.forwardRef(({ width, height, ...props }, ref
112450
112466
  // from a tenant-configured chars list).
112451
112467
  const escapeRegexClassChars = (s) => s.replace(/[\\\]\-^]/g, '\\$&');
112452
112468
  const buildDisallowedCharsPattern = (chars) => chars ? `^[^${escapeRegexClassChars(chars)}]*$` : '';
112469
+ // informational policies: the client can't check them (e.g. reuse needs the
112470
+ // server-side password history), so they render neutral and last and never
112471
+ // block validity. Their `data-password-policy-value-<id>` fills `{{value}}`.
112472
+ const INFO_POLICIES = ['reuse'];
112473
+ const isInfoPolicy = (id) => INFO_POLICIES.includes(id);
112453
112474
  const defaultProps = {
112454
112475
  'has-validation': false,
112455
112476
  'policy-label': 'Passwords must have:',
@@ -112480,6 +112501,7 @@ const defaultProps = {
112480
112501
  'data-password-policy-message-passwordstrength': 'Password strength',
112481
112502
  'data-password-policy-message-disallowedchars': 'Does not contain: {{value}}',
112482
112503
  'data-password-policy-message-disallowemail': 'Does not match your email',
112504
+ 'data-password-policy-message-reuse': 'Cannot be one of your last {{value}} passwords',
112483
112505
  'st-policy-preview-background-color': 'transparent',
112484
112506
  'st-policy-preview-padding': '0'
112485
112507
  };
@@ -112501,7 +112523,8 @@ const NewPassword = React__default.default.forwardRef((props, ref) => {
112501
112523
  'nonalphanumeric',
112502
112524
  'passwordstrength',
112503
112525
  'disallowedchars',
112504
- 'disallowemail'
112526
+ 'disallowemail',
112527
+ 'reuse'
112505
112528
  ].map((id) => {
112506
112529
  const entry = {
112507
112530
  id,
@@ -112519,6 +112542,12 @@ const NewPassword = React__default.default.forwardRef((props, ref) => {
112519
112542
  entry.pattern = buildDisallowedCharsPattern(chars);
112520
112543
  entry.data = { value: chars };
112521
112544
  }
112545
+ if (isInfoPolicy(id)) {
112546
+ entry.info = true;
112547
+ entry.data = {
112548
+ value: mergedPropsByKey[`data-password-policy-value-${id}`] || ''
112549
+ };
112550
+ }
112522
112551
  return entry;
112523
112552
  }));
112524
112553
  return (React__default.default.createElement("descope-new-password", { ...mergedProps, ref: ref, "available-policies": availablePolicies }));
package/dist/index.d.ts CHANGED
@@ -367,9 +367,11 @@ type Props$K = {
367
367
  'data-password-policy-message-passwordstrength'?: string;
368
368
  'data-password-policy-message-disallowedchars'?: string;
369
369
  'data-password-policy-message-disallowemail'?: string;
370
+ 'data-password-policy-message-reuse'?: string;
370
371
  'data-password-policy-value-minlength'?: string;
371
372
  'data-password-policy-value-disallowedchars'?: string;
372
373
  'data-password-policy-value-email'?: string;
374
+ 'data-password-policy-value-reuse'?: string;
373
375
  'st-policy-preview-background-color'?: string;
374
376
  'st-policy-preview-padding'?: string;
375
377
  };
package/dist/index.esm.js CHANGED
@@ -308,6 +308,11 @@ const Logo = React.forwardRef(({ width, height, ...props }, ref) => (React.creat
308
308
  // from a tenant-configured chars list).
309
309
  const escapeRegexClassChars = (s) => s.replace(/[\\\]\-^]/g, '\\$&');
310
310
  const buildDisallowedCharsPattern = (chars) => chars ? `^[^${escapeRegexClassChars(chars)}]*$` : '';
311
+ // informational policies: the client can't check them (e.g. reuse needs the
312
+ // server-side password history), so they render neutral and last and never
313
+ // block validity. Their `data-password-policy-value-<id>` fills `{{value}}`.
314
+ const INFO_POLICIES = ['reuse'];
315
+ const isInfoPolicy = (id) => INFO_POLICIES.includes(id);
311
316
  const defaultProps = {
312
317
  'has-validation': false,
313
318
  'policy-label': 'Passwords must have:',
@@ -338,6 +343,7 @@ const defaultProps = {
338
343
  'data-password-policy-message-passwordstrength': 'Password strength',
339
344
  'data-password-policy-message-disallowedchars': 'Does not contain: {{value}}',
340
345
  'data-password-policy-message-disallowemail': 'Does not match your email',
346
+ 'data-password-policy-message-reuse': 'Cannot be one of your last {{value}} passwords',
341
347
  'st-policy-preview-background-color': 'transparent',
342
348
  'st-policy-preview-padding': '0'
343
349
  };
@@ -359,7 +365,8 @@ const NewPassword = React.forwardRef((props, ref) => {
359
365
  'nonalphanumeric',
360
366
  'passwordstrength',
361
367
  'disallowedchars',
362
- 'disallowemail'
368
+ 'disallowemail',
369
+ 'reuse'
363
370
  ].map((id) => {
364
371
  const entry = {
365
372
  id,
@@ -377,6 +384,12 @@ const NewPassword = React.forwardRef((props, ref) => {
377
384
  entry.pattern = buildDisallowedCharsPattern(chars);
378
385
  entry.data = { value: chars };
379
386
  }
387
+ if (isInfoPolicy(id)) {
388
+ entry.info = true;
389
+ entry.data = {
390
+ value: mergedPropsByKey[`data-password-policy-value-${id}`] || ''
391
+ };
392
+ }
380
393
  return entry;
381
394
  }));
382
395
  return (React.createElement("descope-new-password", { ...mergedProps, ref: ref, "available-policies": availablePolicies }));
@@ -24,9 +24,11 @@ export type Props = {
24
24
  'data-password-policy-message-passwordstrength'?: string;
25
25
  'data-password-policy-message-disallowedchars'?: string;
26
26
  'data-password-policy-message-disallowemail'?: string;
27
+ 'data-password-policy-message-reuse'?: string;
27
28
  'data-password-policy-value-minlength'?: string;
28
29
  'data-password-policy-value-disallowedchars'?: string;
29
30
  'data-password-policy-value-email'?: string;
31
+ 'data-password-policy-value-reuse'?: string;
30
32
  'st-policy-preview-background-color'?: string;
31
33
  'st-policy-preview-padding'?: string;
32
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "3.25.0",
3
+ "version": "3.26.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.25.0"
101
+ "@descope/web-components-ui": "3.26.0"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "react": ">= 18"