@descope/web-components-ui 3.9.2 → 3.10.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/cjs/index.cjs.js +76 -11
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +78 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/descope-anchored.js +1 -1
- package/dist/umd/descope-anchored.js.map +1 -1
- package/dist/umd/descope-attachment.js +1 -1
- package/dist/umd/descope-attachment.js.map +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js.map +1 -1
- package/dist/umd/descope-new-password-index-js.js +1 -1
- package/dist/umd/descope-new-password-index-js.js.map +1 -1
- package/dist/umd/descope-policy-validation-index-js.js +1 -1
- package/dist/umd/descope-policy-validation-index-js.js.map +1 -1
- package/dist/umd/descope-tooltip.js +1 -1
- package/dist/umd/descope-tooltip.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +35 -35
- package/src/components/descope-new-password/NewPasswordClass.js +2 -0
- package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +2 -0
- package/src/components/descope-policy-validation/PolicyValidationClass.js +72 -8
- package/stories/descope-new-password.stories.js +25 -1
- package/stories/descope-policy-validation.stories.js +39 -5
package/dist/index.esm.js
CHANGED
|
@@ -12443,6 +12443,8 @@ const overrideAttrs = [
|
|
|
12443
12443
|
'data-password-policy-value-minlength',
|
|
12444
12444
|
'data-password-policy-value-passwordstrength',
|
|
12445
12445
|
'data-password-policy-actual-passwordstrength',
|
|
12446
|
+
'data-password-policy-value-disallowedchars',
|
|
12447
|
+
'data-password-policy-value-email',
|
|
12446
12448
|
];
|
|
12447
12449
|
const dataAttrs = ['data', 'active-policies', 'overrides', ...overrideAttrs];
|
|
12448
12450
|
const policyAttrs = ['label', 'value', ...dataAttrs];
|
|
@@ -12561,6 +12563,46 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
|
|
|
12561
12563
|
};
|
|
12562
12564
|
}
|
|
12563
12565
|
}
|
|
12566
|
+
|
|
12567
|
+
// disallowedchars: this stores the configured char list in
|
|
12568
|
+
// overrides.disallowedchars.value so the message can interpolate
|
|
12569
|
+
// `{{value}}`. The regex pattern itself is built upstream (orchestrator
|
|
12570
|
+
// or caller) and shipped on the policy entry — it is not derived from
|
|
12571
|
+
// this override. When the attribute is cleared, drop the override so
|
|
12572
|
+
// the panel doesn't keep stale data.
|
|
12573
|
+
if (attrName === 'data-password-policy-value-disallowedchars') {
|
|
12574
|
+
if (newValue) {
|
|
12575
|
+
this.#overrides = {
|
|
12576
|
+
...this.#overrides,
|
|
12577
|
+
disallowedchars: {
|
|
12578
|
+
...this.#overrides?.disallowedchars,
|
|
12579
|
+
value: newValue,
|
|
12580
|
+
},
|
|
12581
|
+
};
|
|
12582
|
+
} else if (this.#overrides?.disallowedchars) {
|
|
12583
|
+
const { disallowedchars: _drop, ...rest } = this.#overrides;
|
|
12584
|
+
this.#overrides = rest;
|
|
12585
|
+
}
|
|
12586
|
+
}
|
|
12587
|
+
|
|
12588
|
+
// disallowemail: stash the user's email so the STR_NEQ_CI comparator
|
|
12589
|
+
// has an `expected` to compare against the live password value. Clear
|
|
12590
|
+
// the override when the attribute is removed/empty so we don't keep
|
|
12591
|
+
// blocking against a previous user's email.
|
|
12592
|
+
if (attrName === 'data-password-policy-value-email') {
|
|
12593
|
+
if (newValue) {
|
|
12594
|
+
this.#overrides = {
|
|
12595
|
+
...this.#overrides,
|
|
12596
|
+
disallowemail: {
|
|
12597
|
+
...this.#overrides?.disallowemail,
|
|
12598
|
+
expected: newValue,
|
|
12599
|
+
},
|
|
12600
|
+
};
|
|
12601
|
+
} else if (this.#overrides?.disallowemail) {
|
|
12602
|
+
const { disallowemail: _drop, ...rest } = this.#overrides;
|
|
12603
|
+
this.#overrides = rest;
|
|
12604
|
+
}
|
|
12605
|
+
}
|
|
12564
12606
|
}
|
|
12565
12607
|
|
|
12566
12608
|
this.renderItems(this.#availablePolicies, this.#activePolicies, this.#overrides);
|
|
@@ -12625,6 +12667,7 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
|
|
|
12625
12667
|
}
|
|
12626
12668
|
|
|
12627
12669
|
const { pattern, message, data, compare } = policy;
|
|
12670
|
+
const normalizedCompare = typeof compare === 'string' ? compare.toUpperCase() : compare;
|
|
12628
12671
|
|
|
12629
12672
|
if ((!pattern && !compare) || !message) {
|
|
12630
12673
|
return results;
|
|
@@ -12638,9 +12681,23 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
|
|
|
12638
12681
|
if (pattern) {
|
|
12639
12682
|
const exp = new RegExp(interpolateString(pattern, data));
|
|
12640
12683
|
validationResult.valid = exp.test(this.value);
|
|
12684
|
+
} else if (normalizedCompare === 'STR_NEQ_CI') {
|
|
12685
|
+
// Compare the live password against the configured string AND its
|
|
12686
|
+
// local-part (before '@'), case-insensitively. Used by the
|
|
12687
|
+
// disallowemail policy.
|
|
12688
|
+
const expected = (data?.expected ?? '').toLowerCase();
|
|
12689
|
+
const actual = (this.value ?? '').toLowerCase();
|
|
12690
|
+
if (!expected || !actual) {
|
|
12691
|
+
// nothing to compare → mark valid so we don't block the flow
|
|
12692
|
+
validationResult.valid = true;
|
|
12693
|
+
} else {
|
|
12694
|
+
const at = expected.indexOf('@');
|
|
12695
|
+
const localPart = at > 0 ? expected.slice(0, at) : expected;
|
|
12696
|
+
validationResult.valid = actual !== expected && actual !== localPart;
|
|
12697
|
+
}
|
|
12641
12698
|
} else if (compare) {
|
|
12642
12699
|
validationResult.valid = this.compareValues(
|
|
12643
|
-
|
|
12700
|
+
normalizedCompare,
|
|
12644
12701
|
data?.expected ?? -1,
|
|
12645
12702
|
data?.actual ?? -1
|
|
12646
12703
|
);
|
|
@@ -12656,13 +12713,18 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
|
|
|
12656
12713
|
return !this.validate().some(({ valid }) => valid === false);
|
|
12657
12714
|
}
|
|
12658
12715
|
|
|
12659
|
-
|
|
12716
|
+
buildValidationItem({ valid, message }) {
|
|
12660
12717
|
const status = !this.value ? 'none' : valid;
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
12718
|
+
const li = document.createElement('li');
|
|
12719
|
+
li.className = 'item';
|
|
12720
|
+
li.dataset.valid = status;
|
|
12721
|
+
const span = document.createElement('span');
|
|
12722
|
+
span.className = 'message';
|
|
12723
|
+
// `textContent` handles any tenant-configured string in `message` safely
|
|
12724
|
+
// (e.g. the disallowedchars list) without needing to escape HTML.
|
|
12725
|
+
span.textContent = message ?? '';
|
|
12726
|
+
li.appendChild(span);
|
|
12727
|
+
return li;
|
|
12666
12728
|
}
|
|
12667
12729
|
|
|
12668
12730
|
renderItems(availablePolicies, activePolicies) {
|
|
@@ -12670,7 +12732,9 @@ class RawPolicyValidation extends createBaseClass({ componentName: componentName
|
|
|
12670
12732
|
return;
|
|
12671
12733
|
}
|
|
12672
12734
|
|
|
12673
|
-
this.list.
|
|
12735
|
+
this.list.replaceChildren(
|
|
12736
|
+
...this.validate().map(this.buildValidationItem.bind(this)),
|
|
12737
|
+
);
|
|
12674
12738
|
}
|
|
12675
12739
|
|
|
12676
12740
|
updateLabel(val) {
|
|
@@ -12771,6 +12835,8 @@ const customMixin$9 = (superclass) =>
|
|
|
12771
12835
|
'available-policies',
|
|
12772
12836
|
'data-password-policy-value-minlength',
|
|
12773
12837
|
'data-password-policy-value-passwordstrength',
|
|
12838
|
+
'data-password-policy-value-disallowedchars',
|
|
12839
|
+
'data-password-policy-value-email',
|
|
12774
12840
|
'label-type',
|
|
12775
12841
|
'manual-visibility-toggle',
|
|
12776
12842
|
],
|
|
@@ -12959,6 +13025,8 @@ const policyPanelAttrs = [
|
|
|
12959
13025
|
'active-policies',
|
|
12960
13026
|
'data-password-policy-value-minlength',
|
|
12961
13027
|
'data-password-policy-value-passwordstrength',
|
|
13028
|
+
'data-password-policy-value-disallowedchars',
|
|
13029
|
+
'data-password-policy-value-email',
|
|
12962
13030
|
'manual-visibility-toggle',
|
|
12963
13031
|
];
|
|
12964
13032
|
const commonAttrs$1 = [
|
|
@@ -29285,8 +29353,6 @@ class RawAnchored extends createBaseClass$1({
|
|
|
29285
29353
|
`;
|
|
29286
29354
|
|
|
29287
29355
|
this.defaultSlot = this.shadowRoot.querySelector('slot:not([name])');
|
|
29288
|
-
|
|
29289
|
-
this.#syncComponentState();
|
|
29290
29356
|
}
|
|
29291
29357
|
|
|
29292
29358
|
init() {
|
|
@@ -29344,7 +29410,7 @@ class RawAnchored extends createBaseClass$1({
|
|
|
29344
29410
|
// To support conditional components in flow, we need to sync the 'hidden' className to the root of the component.
|
|
29345
29411
|
// Ideally, this would happen in the SDK, but we resolved to this patch to fix the issue without forcing users to update SDKs.
|
|
29346
29412
|
#syncComponentState() {
|
|
29347
|
-
const hasHidden = this.#anchor
|
|
29413
|
+
const hasHidden = this.#anchor?.classList?.contains('hidden');
|
|
29348
29414
|
this.classList.toggle('hidden', hasHidden);
|
|
29349
29415
|
}
|
|
29350
29416
|
|
|
@@ -29409,6 +29475,7 @@ class RawAnchored extends createBaseClass$1({
|
|
|
29409
29475
|
// empty host rather than reserving its layout box.
|
|
29410
29476
|
#onAnchorChanged() {
|
|
29411
29477
|
this.toggleAttribute('has-anchor', !!this.#anchor);
|
|
29478
|
+
this.#syncComponentState();
|
|
29412
29479
|
}
|
|
29413
29480
|
}
|
|
29414
29481
|
|