@descope/web-components-ui 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.
package/dist/index.esm.js CHANGED
@@ -12912,6 +12912,7 @@ const overrideAttrs = [
12912
12912
  'data-password-policy-actual-passwordstrength',
12913
12913
  'data-password-policy-value-disallowedchars',
12914
12914
  'data-password-policy-value-email',
12915
+ 'data-password-policy-value-reuse',
12915
12916
  ];
12916
12917
  const dataAttrs = ['data', 'active-policies', 'overrides', ...overrideAttrs];
12917
12918
  const policyAttrs = ['label', 'value', ...dataAttrs];
@@ -13008,6 +13009,13 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
13008
13009
  }
13009
13010
  }
13010
13011
 
13012
+ if (attrName === 'data-password-policy-value-reuse') {
13013
+ const ln = Number(newValue);
13014
+ if (!Number.isNaN(ln) && ln > 0) {
13015
+ this.#overrides = { ...this.#overrides, reuse: { value: `${ln}` } };
13016
+ }
13017
+ }
13018
+
13011
13019
  if (attrName === 'data-password-policy-value-passwordstrength') {
13012
13020
  const passwordStrength = parseInt(newValue);
13013
13021
  if (!Number.isNaN(passwordStrength) && passwordStrength >= 0) {
@@ -13126,17 +13134,17 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
13126
13134
  });
13127
13135
  }
13128
13136
 
13129
- return this.#activePolicies.reduce((results, id) => {
13137
+ const items = this.#activePolicies.reduce((results, id) => {
13130
13138
  const policy = policies.find((p) => p.id === id);
13131
13139
 
13132
13140
  if (!policy) {
13133
13141
  return results;
13134
13142
  }
13135
13143
 
13136
- const { pattern, message, data, compare } = policy;
13144
+ const { pattern, message, data, compare, info } = policy;
13137
13145
  const normalizedCompare = typeof compare === 'string' ? compare.toUpperCase() : compare;
13138
13146
 
13139
- if ((!pattern && !compare) || !message) {
13147
+ if ((!pattern && !compare && !info) || !message) {
13140
13148
  return results;
13141
13149
  }
13142
13150
 
@@ -13145,7 +13153,11 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
13145
13153
  id,
13146
13154
  };
13147
13155
 
13148
- if (pattern) {
13156
+ if (info) {
13157
+ // informational rule the client can't check (e.g. password reuse):
13158
+ // `valid` stays undefined, so it renders neutral and never blocks `isValid`
13159
+ validationResult.info = true;
13160
+ } else if (pattern) {
13149
13161
  const exp = new RegExp(interpolateString(pattern, data));
13150
13162
  validationResult.valid = exp.test(this.value);
13151
13163
  } else if (normalizedCompare === 'STR_NEQ_CI') {
@@ -13174,14 +13186,17 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
13174
13186
 
13175
13187
  return results;
13176
13188
  }, []);
13189
+
13190
+ // informational rules always render last
13191
+ return items.sort((a, b) => Number(!!a.info) - Number(!!b.info));
13177
13192
  }
13178
13193
 
13179
13194
  get isValid() {
13180
13195
  return !this.validate().some(({ valid }) => valid === false);
13181
13196
  }
13182
13197
 
13183
- buildValidationItem({ valid, message }) {
13184
- const status = !this.value ? 'none' : valid;
13198
+ buildValidationItem({ valid, message, info }) {
13199
+ const status = !this.value || info ? 'none' : valid;
13185
13200
  const li = document.createElement('li');
13186
13201
  li.className = 'item';
13187
13202
  li.dataset.valid = status;
@@ -13302,6 +13317,7 @@ const customMixin$c = (superclass) =>
13302
13317
  'data-password-policy-value-passwordstrength',
13303
13318
  'data-password-policy-value-disallowedchars',
13304
13319
  'data-password-policy-value-email',
13320
+ 'data-password-policy-value-reuse',
13305
13321
  'label-type',
13306
13322
  'manual-visibility-toggle',
13307
13323
  ],
@@ -13492,6 +13508,7 @@ const policyPanelAttrs = [
13492
13508
  'data-password-policy-value-passwordstrength',
13493
13509
  'data-password-policy-value-disallowedchars',
13494
13510
  'data-password-policy-value-email',
13511
+ 'data-password-policy-value-reuse',
13495
13512
  'manual-visibility-toggle',
13496
13513
  ];
13497
13514
  const commonAttrs$2 = [