codexly-ui 0.10.65 → 0.10.66
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/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -14492,12 +14492,18 @@ class ClxProductDetailComponent {
|
|
|
14492
14492
|
}
|
|
14493
14493
|
return 0;
|
|
14494
14494
|
}, ...(ngDevMode ? [{ debugName: "discount" }] : /* istanbul ignore next */ []));
|
|
14495
|
+
/** An option is available only if some variation matching it (combined with the rest of the
|
|
14496
|
+
* current selection) both exists AND has stock — a sold-out combination is treated the same
|
|
14497
|
+
* as a non-existent one and hidden, per the same "hide, don't disable" rule already applied to
|
|
14498
|
+
* invalid combinations, so the visitor never sees a spec they can't actually buy. */
|
|
14495
14499
|
isOptionAvailable(specTypeId, specOptionId) {
|
|
14496
14500
|
const variations = this.product()?.variations ?? [];
|
|
14497
14501
|
const currentSel = this.selectedSpecs();
|
|
14498
14502
|
return variations.some(v => {
|
|
14499
14503
|
if (v.specs[specTypeId] !== specOptionId)
|
|
14500
14504
|
return false;
|
|
14505
|
+
if (!v.in_stock)
|
|
14506
|
+
return false;
|
|
14501
14507
|
return Object.entries(currentSel).every(([tid, oid]) => tid === specTypeId || v.specs[tid] === oid);
|
|
14502
14508
|
});
|
|
14503
14509
|
}
|