codexly-ui 0.23.2 → 0.24.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/fesm2022/codexly-ui.mjs +12 -4
- package/fesm2022/codexly-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/codexly-ui.d.ts +32 -16
package/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -17436,12 +17436,16 @@ class ClxProductTagService {
|
|
|
17436
17436
|
badgesFor(ctx) {
|
|
17437
17437
|
const styles = this._styles() ?? [];
|
|
17438
17438
|
const manual = new Set(ctx.tags);
|
|
17439
|
+
const hidden = new Set(ctx.hiddenSystemTags ?? []);
|
|
17439
17440
|
const units = ctx.stockQuantity;
|
|
17440
17441
|
const low = styles.find(s => s.kind === 'LOW_STOCK');
|
|
17441
|
-
|
|
17442
|
-
|
|
17442
|
+
const threshold = ctx.lowStockThreshold ?? low?.stockThreshold ?? 0;
|
|
17443
|
+
// "Últimas unidades" replaces "N en stock" — both would say the same (unless it's hidden here).
|
|
17444
|
+
const isLow = !!low && !hidden.has('LOW_STOCK') && ctx.inStock && units != null && units > 0 && units <= threshold;
|
|
17443
17445
|
const out = [];
|
|
17444
17446
|
for (const s of styles) {
|
|
17447
|
+
if (s.kind !== 'MANUAL' && hidden.has(s.kind))
|
|
17448
|
+
continue;
|
|
17445
17449
|
let n = null;
|
|
17446
17450
|
switch (s.kind) {
|
|
17447
17451
|
case 'MANUAL':
|
|
@@ -17595,6 +17599,7 @@ class ClxProductComponent {
|
|
|
17595
17599
|
return p
|
|
17596
17600
|
? this._tagSvc.badgesFor({
|
|
17597
17601
|
tags: p.tags ?? [], inStock: p.in_stock, stockQuantity: p.stock_quantity, discountPercent: this._discountPct(),
|
|
17602
|
+
hiddenSystemTags: p.hidden_system_tags, lowStockThreshold: p.low_stock_threshold,
|
|
17598
17603
|
})
|
|
17599
17604
|
: [];
|
|
17600
17605
|
}, ...(ngDevMode ? [{ debugName: "_badges" }] : /* istanbul ignore next */ []));
|
|
@@ -18195,18 +18200,21 @@ class ClxProductDetailComponent {
|
|
|
18195
18200
|
}
|
|
18196
18201
|
return 0;
|
|
18197
18202
|
}, ...(ngDevMode ? [{ debugName: "discount" }] : /* istanbul ignore next */ []));
|
|
18198
|
-
/** The host's configured tags (ClxProductTagService) for the selected variation, over the gallery
|
|
18203
|
+
/** The host's configured tags (ClxProductTagService) for the selected variation, over the gallery —
|
|
18204
|
+
* the variation's own tags and settings when the host sends them, else the product's. */
|
|
18199
18205
|
_badges = computed(() => {
|
|
18200
18206
|
const p = this.product();
|
|
18201
18207
|
const v = this.activeVariation();
|
|
18202
18208
|
if (!p || !v)
|
|
18203
18209
|
return [];
|
|
18204
18210
|
return this._tagSvc.badgesFor({
|
|
18205
|
-
tags: p.tags ?? [],
|
|
18211
|
+
tags: v.tags ?? p.tags ?? [],
|
|
18206
18212
|
inStock: v.in_stock,
|
|
18207
18213
|
stockQuantity: v.stock_quantity,
|
|
18208
18214
|
showStockCount: true,
|
|
18209
18215
|
discountPercent: p.has_discount ? this.discount() : 0,
|
|
18216
|
+
hiddenSystemTags: v.hidden_system_tags ?? p.hidden_system_tags,
|
|
18217
|
+
lowStockThreshold: v.low_stock_threshold !== undefined ? v.low_stock_threshold : p.low_stock_threshold,
|
|
18210
18218
|
});
|
|
18211
18219
|
}, ...(ngDevMode ? [{ debugName: "_badges" }] : /* istanbul ignore next */ []));
|
|
18212
18220
|
/** An option is available if some in-stock variation matches it together with the rest of the
|