codexly-ui 0.23.1 → 0.23.2

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.
@@ -18972,6 +18972,12 @@ class ClxCartComponent {
18972
18972
  : c.value;
18973
18973
  }, ...(ngDevMode ? [{ debugName: "_couponDiscount" }] : /* istanbul ignore next */ []));
18974
18974
  _total = computed(() => Math.max(0, this._subtotal() - this._couponDiscount()), ...(ngDevMode ? [{ debugName: "_total" }] : /* istanbul ignore next */ []));
18975
+ _exceedsStock(item) {
18976
+ return item.in_stock && item.max_quantity != null && item.quantity > item.max_quantity;
18977
+ }
18978
+ /** Lines that can't be bought as they are — out of stock, or more units than are left. While any
18979
+ * exists the checkout button stays disabled. */
18980
+ _blockedItems = computed(() => this.items().filter(i => !i.in_stock || this._exceedsStock(i)), ...(ngDevMode ? [{ debugName: "_blockedItems" }] : /* istanbul ignore next */ []));
18975
18981
  _totalUnits = computed(() => this.items().reduce((s, i) => s + i.quantity, 0), ...(ngDevMode ? [{ debugName: "_totalUnits" }] : /* istanbul ignore next */ []));
18976
18982
  applyCoupon() {
18977
18983
  const code = this._couponCode.trim();
@@ -19090,6 +19096,17 @@ class ClxCartComponent {
19090
19096
  <p class="text-sm text-clx-text-subtle truncate">{{ item.trademark }}</p>
19091
19097
  <h3 class="text-sm font-semibold text-clx-text-label leading-snug line-clamp-2">{{ item.name }}</h3>
19092
19098
  <p class="text-sm font-mono text-clx-text-subtle mt-0.5">{{ item.sku }}</p>
19099
+ @if (!item.in_stock) {
19100
+ <p class="flex items-center gap-1 text-xs font-medium text-red-600 mt-1">
19101
+ <span clx-icon name="block" size="xs"></span>
19102
+ Agotado — quítalo para continuar con tu compra
19103
+ </p>
19104
+ } @else if (_exceedsStock(item)) {
19105
+ <p class="flex items-center gap-1 text-xs font-medium text-amber-600 mt-1">
19106
+ <span clx-icon name="warning" size="xs"></span>
19107
+ Solo {{ item.max_quantity === 1 ? 'queda 1 disponible' : 'quedan ' + item.max_quantity + ' disponibles' }} — ajusta la cantidad
19108
+ </p>
19109
+ }
19093
19110
  </div>
19094
19111
 
19095
19112
  <!-- Price + Quantity row -->
@@ -19223,11 +19240,23 @@ class ClxCartComponent {
19223
19240
  </div>
19224
19241
  </dl>
19225
19242
 
19243
+ <!-- Stock problems block the checkout: the order would be rejected anyway -->
19244
+ @if (_blockedItems().length) {
19245
+ <div class="flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-xs text-amber-800">
19246
+ <span clx-icon name="warning" size="sm" class="shrink-0 mt-px"></span>
19247
+ <span>
19248
+ {{ _blockedItems().length === 1 ? 'Un producto de tu carrito no está disponible' : _blockedItems().length + ' productos de tu carrito no están disponibles' }}
19249
+ en la cantidad elegida. Quítalo o ajusta la cantidad para continuar.
19250
+ </span>
19251
+ </div>
19252
+ }
19253
+
19226
19254
  <!-- Checkout -->
19227
19255
  <button
19228
19256
  clx-button type="button" [color]="color()" variant="solid" size="md"
19229
19257
  icon="arrow_forward" iconPosition="right" [block]="true"
19230
- (click)="onCheckout.emit()">
19258
+ [disabled]="_blockedItems().length > 0"
19259
+ (click)="_blockedItems().length === 0 && onCheckout.emit()">
19231
19260
  Proceder al pago
19232
19261
  </button>
19233
19262
 
@@ -19371,6 +19400,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
19371
19400
  <p class="text-sm text-clx-text-subtle truncate">{{ item.trademark }}</p>
19372
19401
  <h3 class="text-sm font-semibold text-clx-text-label leading-snug line-clamp-2">{{ item.name }}</h3>
19373
19402
  <p class="text-sm font-mono text-clx-text-subtle mt-0.5">{{ item.sku }}</p>
19403
+ @if (!item.in_stock) {
19404
+ <p class="flex items-center gap-1 text-xs font-medium text-red-600 mt-1">
19405
+ <span clx-icon name="block" size="xs"></span>
19406
+ Agotado — quítalo para continuar con tu compra
19407
+ </p>
19408
+ } @else if (_exceedsStock(item)) {
19409
+ <p class="flex items-center gap-1 text-xs font-medium text-amber-600 mt-1">
19410
+ <span clx-icon name="warning" size="xs"></span>
19411
+ Solo {{ item.max_quantity === 1 ? 'queda 1 disponible' : 'quedan ' + item.max_quantity + ' disponibles' }} — ajusta la cantidad
19412
+ </p>
19413
+ }
19374
19414
  </div>
19375
19415
 
19376
19416
  <!-- Price + Quantity row -->
@@ -19504,11 +19544,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
19504
19544
  </div>
19505
19545
  </dl>
19506
19546
 
19547
+ <!-- Stock problems block the checkout: the order would be rejected anyway -->
19548
+ @if (_blockedItems().length) {
19549
+ <div class="flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-xs text-amber-800">
19550
+ <span clx-icon name="warning" size="sm" class="shrink-0 mt-px"></span>
19551
+ <span>
19552
+ {{ _blockedItems().length === 1 ? 'Un producto de tu carrito no está disponible' : _blockedItems().length + ' productos de tu carrito no están disponibles' }}
19553
+ en la cantidad elegida. Quítalo o ajusta la cantidad para continuar.
19554
+ </span>
19555
+ </div>
19556
+ }
19557
+
19507
19558
  <!-- Checkout -->
19508
19559
  <button
19509
19560
  clx-button type="button" [color]="color()" variant="solid" size="md"
19510
19561
  icon="arrow_forward" iconPosition="right" [block]="true"
19511
- (click)="onCheckout.emit()">
19562
+ [disabled]="_blockedItems().length > 0"
19563
+ (click)="_blockedItems().length === 0 && onCheckout.emit()">
19512
19564
  Proceder al pago
19513
19565
  </button>
19514
19566