ng-easycommerce 0.0.681 → 0.0.682
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/README.md +14 -0
- package/bundles/ng-easycommerce.umd.js +870 -57
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/ec-component/cart-ec/cart-ec.component.js +230 -2
- package/esm2015/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +6 -3
- package/esm2015/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +13 -4
- package/esm2015/lib/ec-component/index.js +4 -1
- package/esm2015/lib/ec-component/sidebar-ec/sidebar-ec.component.js +61 -1
- package/esm2015/lib/ec-component/widgets-ec/unit-promotion-price-ec/unit-promotion-price-ec.component.js +268 -0
- package/esm2015/lib/interfaces/cart-item.js +1 -1
- package/esm2015/lib/services/cart.service.js +186 -14
- package/esm2015/lib/services/checkout/checkout.service.js +2 -2
- package/esm2015/lib/utils/order-util.service.js +87 -1
- package/esm2015/public-api.js +2 -1
- package/esm5/lib/ec-component/cart-ec/cart-ec.component.js +236 -2
- package/esm5/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +6 -3
- package/esm5/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +13 -4
- package/esm5/lib/ec-component/index.js +4 -1
- package/esm5/lib/ec-component/sidebar-ec/sidebar-ec.component.js +61 -1
- package/esm5/lib/ec-component/widgets-ec/unit-promotion-price-ec/unit-promotion-price-ec.component.js +248 -0
- package/esm5/lib/interfaces/cart-item.js +1 -1
- package/esm5/lib/services/cart.service.js +188 -14
- package/esm5/lib/services/checkout/checkout.service.js +2 -2
- package/esm5/lib/utils/order-util.service.js +88 -1
- package/esm5/public-api.js +2 -1
- package/fesm2015/ng-easycommerce.js +882 -59
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +871 -59
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-component/cart-ec/cart-ec.component.d.ts +139 -0
- package/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.d.ts +3 -1
- package/lib/ec-component/index.d.ts +1 -0
- package/lib/ec-component/sidebar-ec/sidebar-ec.component.d.ts +52 -0
- package/lib/ec-component/widgets-ec/unit-promotion-price-ec/unit-promotion-price-ec.component.d.ts +117 -0
- package/lib/interfaces/cart-item.d.ts +54 -0
- package/lib/services/cart.service.d.ts +98 -1
- package/lib/utils/order-util.service.d.ts +58 -0
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -2329,11 +2329,98 @@
|
|
|
2329
2329
|
!forCart && new_state.push(total);
|
|
2330
2330
|
return new_state;
|
|
2331
2331
|
};
|
|
2332
|
+
/**
|
|
2333
|
+
* Construye el resumen de promociones que debe mostrarse en checkout y resúmenes de compra.
|
|
2334
|
+
*
|
|
2335
|
+
* @param cart Carrito u orden con estructura `totals` compatible.
|
|
2336
|
+
* @param forCart Cuando es `true`, omite subtotal y total para devolver solo las líneas intermedias.
|
|
2337
|
+
* @returns Lista de líneas normalizadas para renderizar el resumen.
|
|
2338
|
+
*
|
|
2339
|
+
* @remarks
|
|
2340
|
+
* A diferencia de `getPromotions`, este método solo considera descuentos de orden.
|
|
2341
|
+
*/
|
|
2342
|
+
this.getSummaryPromotions = function (cart, forCart) {
|
|
2343
|
+
if (forCart === void 0) { forCart = false; }
|
|
2344
|
+
if (cart.checkoutState && cart.checkoutState == "completed")
|
|
2345
|
+
return;
|
|
2346
|
+
var new_state = [];
|
|
2347
|
+
var subtotal = { type: 'subtotal', name: 'subtotal', amount: cart.totals.subtotal };
|
|
2348
|
+
var total = { type: 'total', name: 'total', amount: cart.totals.total };
|
|
2349
|
+
var promotionAmount = _this.getSummaryPromotionAmount(cart);
|
|
2350
|
+
!forCart && new_state.push(subtotal);
|
|
2351
|
+
promotionAmount != 0 && new_state.push({
|
|
2352
|
+
type: 'discount',
|
|
2353
|
+
name: 'discount',
|
|
2354
|
+
amount: promotionAmount
|
|
2355
|
+
});
|
|
2356
|
+
!forCart && new_state.push(total);
|
|
2357
|
+
return new_state;
|
|
2358
|
+
};
|
|
2359
|
+
/**
|
|
2360
|
+
* Obtiene el monto de descuento que corresponde al resumen de la orden.
|
|
2361
|
+
*
|
|
2362
|
+
* @param cart Carrito u orden con `totals`.
|
|
2363
|
+
* @returns Monto de promociones de orden.
|
|
2364
|
+
*
|
|
2365
|
+
* @example
|
|
2366
|
+
* ```ts
|
|
2367
|
+
* const amount = this.orderUtils.getSummaryPromotionAmount(cart);
|
|
2368
|
+
* ```
|
|
2369
|
+
*
|
|
2370
|
+
* @remarks
|
|
2371
|
+
* Si el backend nuevo informa `promotionBreakdown.orderPromotions`, ese valor tiene prioridad.
|
|
2372
|
+
* Con backends viejos hace fallback a `totals.promotion` o `totals.discount`.
|
|
2373
|
+
*/
|
|
2374
|
+
this.getSummaryPromotionAmount = function (cart) {
|
|
2375
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2376
|
+
if (_this.hasOrderPromotionsBreakdown(cart)) {
|
|
2377
|
+
return Number(((_c = (_b = (_a = cart) === null || _a === void 0 ? void 0 : _a.totals) === null || _b === void 0 ? void 0 : _b.promotionBreakdown) === null || _c === void 0 ? void 0 : _c.orderPromotions) || 0);
|
|
2378
|
+
}
|
|
2379
|
+
return Number(((_e = (_d = cart) === null || _d === void 0 ? void 0 : _d.totals) === null || _e === void 0 ? void 0 : _e.promotion) || ((_g = (_f = cart) === null || _f === void 0 ? void 0 : _f.totals) === null || _g === void 0 ? void 0 : _g.discount) || 0);
|
|
2380
|
+
};
|
|
2381
|
+
/**
|
|
2382
|
+
* Indica si el backend ya informa el desglose nuevo de promociones.
|
|
2383
|
+
*
|
|
2384
|
+
* @param cart Carrito u orden con `totals`.
|
|
2385
|
+
* @returns `true` cuando existe `promotionBreakdown.orderPromotions`.
|
|
2386
|
+
*/
|
|
2387
|
+
this.hasOrderPromotionsBreakdown = function (cart) { var _a, _b; return Object.prototype.hasOwnProperty.call(((_b = (_a = cart) === null || _a === void 0 ? void 0 : _a.totals) === null || _b === void 0 ? void 0 : _b.promotionBreakdown) || {}, 'orderPromotions'); };
|
|
2388
|
+
/**
|
|
2389
|
+
* Indica si el carrito tiene un cupón aplicado, independientemente de cómo impacte en el resumen.
|
|
2390
|
+
*
|
|
2391
|
+
* @param cart Carrito actual.
|
|
2392
|
+
* @returns `true` cuando hay un código de cupón o una línea de descuento de tipo cupón.
|
|
2393
|
+
*
|
|
2394
|
+
* @remarks
|
|
2395
|
+
* Este helper evita atar la UI de `Quitar cupón` al monto de descuentos de orden.
|
|
2396
|
+
* Un cupón puede afectar promociones unitarias y dejar `orderPromotions = 0`.
|
|
2397
|
+
*/
|
|
2398
|
+
this.hasAppliedCoupon = function (cart) {
|
|
2399
|
+
var _a, _b;
|
|
2400
|
+
if (Boolean((_a = cart) === null || _a === void 0 ? void 0 : _a.couponCode)) {
|
|
2401
|
+
return true;
|
|
2402
|
+
}
|
|
2403
|
+
return Array.isArray((_b = cart) === null || _b === void 0 ? void 0 : _b.cartDiscounts)
|
|
2404
|
+
&& cart.cartDiscounts.some(function (discount) { var _a; return (((_a = discount) === null || _a === void 0 ? void 0 : _a.type) || '').toString().includes('coupon'); });
|
|
2405
|
+
};
|
|
2406
|
+
/**
|
|
2407
|
+
* Devuelve el monto efectivo de una línea de descuento/promoción.
|
|
2408
|
+
*
|
|
2409
|
+
* @param discount Línea cruda de descuento del backend.
|
|
2410
|
+
* @param cart Carrito asociado.
|
|
2411
|
+
* @returns Monto que debe mostrarse en UI.
|
|
2412
|
+
*/
|
|
2332
2413
|
this.getAmount = function (discount, cart) {
|
|
2333
2414
|
if (discount.type != 'shipment')
|
|
2334
2415
|
return discount.amount;
|
|
2335
2416
|
return cart.totals.shipping;
|
|
2336
2417
|
};
|
|
2418
|
+
/**
|
|
2419
|
+
* Homologa tipos crudos del backend al conjunto de tipos usado por checkout.
|
|
2420
|
+
*
|
|
2421
|
+
* @param type Tipo crudo (`order_promotion`, `order_coupon_promotion`, etc.).
|
|
2422
|
+
* @returns Tipo normalizado consumido por los componentes del core.
|
|
2423
|
+
*/
|
|
2337
2424
|
this.formatType = function (type) {
|
|
2338
2425
|
var result;
|
|
2339
2426
|
switch (type) {
|
|
@@ -3672,7 +3759,7 @@
|
|
|
3672
3759
|
}); };
|
|
3673
3760
|
this.updateAsociatedData = function (cart) {
|
|
3674
3761
|
var _a, _b, _c;
|
|
3675
|
-
var result = _this.orderUtils.
|
|
3762
|
+
var result = _this.orderUtils.getSummaryPromotions(cart);
|
|
3676
3763
|
var totals = (_a = cart) === null || _a === void 0 ? void 0 : _a.totals;
|
|
3677
3764
|
if (!totals) {
|
|
3678
3765
|
_this.asociatedDataSubject.next(result);
|
|
@@ -4808,11 +4895,23 @@
|
|
|
4808
4895
|
_this.requestInProcess.next(false);
|
|
4809
4896
|
return true;
|
|
4810
4897
|
};
|
|
4898
|
+
/**
|
|
4899
|
+
* Reasigna `product.price` al precio base legacy que espera el template histórico del carrito.
|
|
4900
|
+
*
|
|
4901
|
+
* @param items Ítems normalizados del carrito.
|
|
4902
|
+
* @returns Los mismos ítems con `product.price` alineado al precio base mostrado en la tabla.
|
|
4903
|
+
*
|
|
4904
|
+
* @remarks
|
|
4905
|
+
* Este método no modifica `pricing.finalPrice`. Solo preserva compatibilidad con templates
|
|
4906
|
+
* viejos que todavía leen `item.product.price` directamente.
|
|
4907
|
+
*/
|
|
4811
4908
|
this.switchPriceInCartItem = function (items) {
|
|
4812
|
-
//return items;
|
|
4813
4909
|
return items.map(function (item) {
|
|
4910
|
+
var _a, _b, _c, _d;
|
|
4814
4911
|
if (item.product) {
|
|
4815
|
-
|
|
4912
|
+
var pricing = _this.getItemPricing(item);
|
|
4913
|
+
var variant = (_a = item.product.variants) === null || _a === void 0 ? void 0 : _a[0];
|
|
4914
|
+
item.product.price = ((_b = pricing) === null || _b === void 0 ? void 0 : _b.basePrice) || ((_c = variant) === null || _c === void 0 ? void 0 : _c.saleprice) || ((_d = variant) === null || _d === void 0 ? void 0 : _d.price);
|
|
4816
4915
|
}
|
|
4817
4916
|
return item;
|
|
4818
4917
|
});
|
|
@@ -4828,6 +4927,29 @@
|
|
|
4828
4927
|
_this.updateLocalCart();
|
|
4829
4928
|
_this.requestInProcess.next(false);
|
|
4830
4929
|
};
|
|
4930
|
+
/**
|
|
4931
|
+
* Sincroniza `cartItemsSubject` con la última respuesta del backend.
|
|
4932
|
+
*
|
|
4933
|
+
* @param cart Respuesta de carrito recibida desde cualquier endpoint que devuelva `items`.
|
|
4934
|
+
* @returns `void`
|
|
4935
|
+
*
|
|
4936
|
+
* @remarks
|
|
4937
|
+
* Se reutiliza después de actualizar cantidades, aplicar cupón o remover productos para evitar
|
|
4938
|
+
* que la tabla quede con subtotales o promociones desactualizadas.
|
|
4939
|
+
*/
|
|
4940
|
+
this.syncCartItemsFromResponse = function (cart) {
|
|
4941
|
+
var _a;
|
|
4942
|
+
if (!((_a = cart) === null || _a === void 0 ? void 0 : _a.items)) {
|
|
4943
|
+
return;
|
|
4944
|
+
}
|
|
4945
|
+
var previousItems = _this.items || [];
|
|
4946
|
+
var nextItems = _this.transformItems(cart.items).map(function (item) {
|
|
4947
|
+
var _a, _b;
|
|
4948
|
+
var previousItem = previousItems.find(function (prev) { return prev.item_id == item.item_id; });
|
|
4949
|
+
return __assign$a(__assign$a(__assign$a({}, previousItem), item), { failed: (_a = previousItem) === null || _a === void 0 ? void 0 : _a.failed, error: (_b = previousItem) === null || _b === void 0 ? void 0 : _b.error });
|
|
4950
|
+
});
|
|
4951
|
+
_this.updateCartItems(nextItems);
|
|
4952
|
+
};
|
|
4831
4953
|
this.updateCartItemQuantity = function (variant_id, quantity, comments) {
|
|
4832
4954
|
var normalizedComments = comments !== undefined ? ((comments !== null && comments !== void 0 ? comments : '')).trim() : undefined;
|
|
4833
4955
|
var newItems = _this.items.map(function (it) {
|
|
@@ -4847,21 +4969,15 @@
|
|
|
4847
4969
|
};
|
|
4848
4970
|
this.appendToCart = function (cart) {
|
|
4849
4971
|
_this.updateCartObj(cart);
|
|
4850
|
-
_this.
|
|
4851
|
-
_this.count = _this.items.length;
|
|
4852
|
-
_this.requestInProcess.next(false);
|
|
4853
|
-
_this.updateLocalCart();
|
|
4972
|
+
_this.syncCartItemsFromResponse(cart);
|
|
4854
4973
|
// this.toastrService.show('product-added');
|
|
4855
|
-
_this.cartItemsSubject.next(_this.items);
|
|
4856
4974
|
};
|
|
4857
4975
|
this.removeCartItem = function (cart, product, toast) {
|
|
4858
4976
|
if (toast === void 0) { toast = true; }
|
|
4859
4977
|
_this.updateCartObj(cart, false);
|
|
4860
|
-
_this.
|
|
4861
|
-
_this.cartItemsSubject.next(_this.items);
|
|
4978
|
+
_this.syncCartItemsFromResponse(cart);
|
|
4862
4979
|
toast && _this.requestInProcess.next(false);
|
|
4863
4980
|
toast && _this.toastrService.show('product-removed');
|
|
4864
|
-
_this.updateLocalCart();
|
|
4865
4981
|
// this.googleAnalytics.removeFromCart(product);
|
|
4866
4982
|
_this.analyticsService.callEvent('remove_from_cart', __assign$a(__assign$a({}, product), { currency: _this.consts.currency.code }));
|
|
4867
4983
|
};
|
|
@@ -5030,7 +5146,11 @@
|
|
|
5030
5146
|
_this.connection
|
|
5031
5147
|
.put(_this.updateItemQuantityApi(_this.findItemByIdVariant(item.variant_id)), payload)
|
|
5032
5148
|
.pipe(operators.finalize(function () { return _this.requestInProcess.next(false); }))
|
|
5033
|
-
.subscribe(function (res) {
|
|
5149
|
+
.subscribe(function (res) {
|
|
5150
|
+
_this.updateCartObj(res);
|
|
5151
|
+
_this.syncCartItemsFromResponse(res);
|
|
5152
|
+
_this.toastrService.show('product-updated', { quantity: quantity });
|
|
5153
|
+
}, function (err) { return _this.handleError(err); });
|
|
5034
5154
|
}
|
|
5035
5155
|
};
|
|
5036
5156
|
this.validateQuantity = function (item, quantity) {
|
|
@@ -5133,7 +5253,50 @@
|
|
|
5133
5253
|
this.getSubTotalAmount = function () {
|
|
5134
5254
|
return _this.cart.pipe(operators.map(function (cart) { var _a, _b; return (_b = (_a = cart) === null || _a === void 0 ? void 0 : _a.totals) === null || _b === void 0 ? void 0 : _b.subtotal; }));
|
|
5135
5255
|
};
|
|
5256
|
+
/**
|
|
5257
|
+
* Devuelve el descuento que debe mostrarse en el resumen de compra.
|
|
5258
|
+
*
|
|
5259
|
+
* @returns Observable con el monto de promociones de orden.
|
|
5260
|
+
*
|
|
5261
|
+
* @example
|
|
5262
|
+
* ```ts
|
|
5263
|
+
* this.summaryPromotionAmount$ = this.cartService.getSummaryPromotionAmount();
|
|
5264
|
+
* ```
|
|
5265
|
+
*
|
|
5266
|
+
* @remarks
|
|
5267
|
+
* Si el backend nuevo informa `totals.promotionBreakdown.orderPromotions`, se usa ese valor.
|
|
5268
|
+
* Si todavía no existe, el método hace fallback a `totals.promotion` para mantener compatibilidad.
|
|
5269
|
+
*/
|
|
5270
|
+
this.getSummaryPromotionAmount = function () {
|
|
5271
|
+
return _this.cart.pipe(operators.map(function (cart) { return _this.orderUtils.getSummaryPromotionAmount(cart); }));
|
|
5272
|
+
};
|
|
5273
|
+
/**
|
|
5274
|
+
* Indica si existe un cupón aplicado en el carrito actual.
|
|
5275
|
+
*
|
|
5276
|
+
* @returns Observable booleano para controlar la visibilidad de `Quitar cupón`.
|
|
5277
|
+
*
|
|
5278
|
+
* @remarks
|
|
5279
|
+
* No debe atarse a `getSummaryPromotionAmount()`, porque un cupón puede afectar
|
|
5280
|
+
* solo promociones unitarias y dejar el descuento de orden en `0`.
|
|
5281
|
+
*/
|
|
5282
|
+
this.hasAppliedCoupon = function () {
|
|
5283
|
+
return _this.cart.pipe(operators.map(function (cart) { return _this.orderUtils.hasAppliedCoupon(cart); }));
|
|
5284
|
+
};
|
|
5136
5285
|
this.toDecimal = function (total) { return (total - Math.floor(total) == 0) ? total / 100 : total; };
|
|
5286
|
+
/**
|
|
5287
|
+
* Obtiene el precio normalizado de un ítem.
|
|
5288
|
+
*
|
|
5289
|
+
* @param item Ítem de carrito normalizado.
|
|
5290
|
+
* @returns Objeto `CartItemPricing` listo para renderizar precio base, tachado y final.
|
|
5291
|
+
*
|
|
5292
|
+
* @example
|
|
5293
|
+
* ```ts
|
|
5294
|
+
* const pricing = this.cartService.getItemPricing(item);
|
|
5295
|
+
* const showTooltip = pricing.hasUnitPromotions;
|
|
5296
|
+
* const finalPrice = pricing.finalPrice;
|
|
5297
|
+
* ```
|
|
5298
|
+
*/
|
|
5299
|
+
this.getItemPricing = function (item) { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.pricing) || _this.buildCartItemPricing(item); };
|
|
5137
5300
|
this.addCoupon = function (code) { return __awaiter$5(_this, void 0, void 0, function () {
|
|
5138
5301
|
var result, e_1;
|
|
5139
5302
|
return __generator$5(this, function (_a) {
|
|
@@ -5146,6 +5309,7 @@
|
|
|
5146
5309
|
if (result.error || result.errors)
|
|
5147
5310
|
return [2 /*return*/, { error: true, message: 'invalid-coupon' }];
|
|
5148
5311
|
this.updateCartObj(result, false);
|
|
5312
|
+
this.syncCartItemsFromResponse(result);
|
|
5149
5313
|
return [2 /*return*/, { error: false, message: 'ok' }];
|
|
5150
5314
|
case 2:
|
|
5151
5315
|
e_1 = _a.sent();
|
|
@@ -5157,7 +5321,11 @@
|
|
|
5157
5321
|
this.removeCoupon = function () { return __awaiter$5(_this, void 0, void 0, function () {
|
|
5158
5322
|
var _this = this;
|
|
5159
5323
|
return __generator$5(this, function (_a) {
|
|
5160
|
-
return [2 /*return*/, this.connection.delete(this.couponApi()).pipe(operators.map(function (res) {
|
|
5324
|
+
return [2 /*return*/, this.connection.delete(this.couponApi()).pipe(operators.map(function (res) {
|
|
5325
|
+
_this.updateCartObj(res, false);
|
|
5326
|
+
_this.syncCartItemsFromResponse(res);
|
|
5327
|
+
return true;
|
|
5328
|
+
})).toPromise()];
|
|
5161
5329
|
});
|
|
5162
5330
|
}); };
|
|
5163
5331
|
this.formatCoupon = function (cart) {
|
|
@@ -5220,6 +5388,18 @@
|
|
|
5220
5388
|
/**
|
|
5221
5389
|
* UTILS
|
|
5222
5390
|
*/
|
|
5391
|
+
/**
|
|
5392
|
+
* Transforma los ítems crudos del backend al contrato interno `CartItem`.
|
|
5393
|
+
*
|
|
5394
|
+
* @param server_item Respuesta `items` del endpoint de carrito.
|
|
5395
|
+
* @returns Arreglo de ítems normalizados, cada uno con `pricing` precomputado.
|
|
5396
|
+
*
|
|
5397
|
+
* @remarks
|
|
5398
|
+
* Este es el punto donde el core:
|
|
5399
|
+
* - preserva `unitPromotions`
|
|
5400
|
+
* - arma `pricing`
|
|
5401
|
+
* - mantiene la forma histórica del item consumido por los templates
|
|
5402
|
+
*/
|
|
5223
5403
|
this.transformItems = function (server_item) { return server_item.map(function (item) {
|
|
5224
5404
|
item = {
|
|
5225
5405
|
product: item.product,
|
|
@@ -5228,8 +5408,10 @@
|
|
|
5228
5408
|
quantity: item.quantity,
|
|
5229
5409
|
comments: item.comments || '',
|
|
5230
5410
|
item_id: item.id,
|
|
5231
|
-
total: item.total
|
|
5411
|
+
total: item.total,
|
|
5412
|
+
unitPromotions: Array.isArray(item.unitPromotions) ? item.unitPromotions : []
|
|
5232
5413
|
};
|
|
5414
|
+
item.pricing = _this.buildCartItemPricing(item);
|
|
5233
5415
|
// console.log(item.product.variants[0]);
|
|
5234
5416
|
// console.log(item.product.variants[0].saleprice);
|
|
5235
5417
|
// console.log(item.product.variants[0].price);
|
|
@@ -5239,6 +5421,85 @@
|
|
|
5239
5421
|
// }, 100);
|
|
5240
5422
|
return item;
|
|
5241
5423
|
}); };
|
|
5424
|
+
/**
|
|
5425
|
+
* Construye la normalización de precios para un ítem del carrito.
|
|
5426
|
+
*
|
|
5427
|
+
* @param item Ítem normalizado del carrito.
|
|
5428
|
+
* @returns Estructura `CartItemPricing` con precio base, tachado, final y flags de UI.
|
|
5429
|
+
*
|
|
5430
|
+
* @example
|
|
5431
|
+
* ```ts
|
|
5432
|
+
* const pricing = this.buildCartItemPricing(item);
|
|
5433
|
+
* // pricing.basePrice => saleprice si existe, si no price
|
|
5434
|
+
* // pricing.finalPrice => basePrice + unitPromotionTotal
|
|
5435
|
+
* // pricing.effectiveDiscountPercent => % total contra el precio de referencia
|
|
5436
|
+
* ```
|
|
5437
|
+
*/
|
|
5438
|
+
this.buildCartItemPricing = function (item) {
|
|
5439
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
5440
|
+
var variant = (_c = (_b = (_a = item) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.variants) === null || _c === void 0 ? void 0 : _c[0];
|
|
5441
|
+
var cartAndSidebarPrices = (_d = variant) === null || _d === void 0 ? void 0 : _d.cartAndSidebarPrices;
|
|
5442
|
+
// Si el backend nuevo informa `cartAndSidebarPrices`, ese es el precio correcto
|
|
5443
|
+
// para carrito/sidebar porque excluye impuestos de orden que no se listan por ítem.
|
|
5444
|
+
// Si no existe, se mantiene el fallback histórico.
|
|
5445
|
+
var basePrice = _this.parsePriceValue((_t = (_q = (_m = (_k = (_h = (_f = (_e = cartAndSidebarPrices) === null || _e === void 0 ? void 0 : _e.saleprice, (_f !== null && _f !== void 0 ? _f : (_g = cartAndSidebarPrices) === null || _g === void 0 ? void 0 : _g.price)), (_h !== null && _h !== void 0 ? _h : (_j = variant) === null || _j === void 0 ? void 0 : _j.saleprice)), (_k !== null && _k !== void 0 ? _k : (_l = variant) === null || _l === void 0 ? void 0 : _l.price)), (_m !== null && _m !== void 0 ? _m : (_p = (_o = item) === null || _o === void 0 ? void 0 : _o.product) === null || _p === void 0 ? void 0 : _p.saleprice)), (_q !== null && _q !== void 0 ? _q : (_s = (_r = item) === null || _r === void 0 ? void 0 : _r.product) === null || _s === void 0 ? void 0 : _s.price)), (_t !== null && _t !== void 0 ? _t : 0)));
|
|
5446
|
+
var strikePriceCandidate = _this.parsePriceValue((_0 = (_x = (_v = (_u = cartAndSidebarPrices) === null || _u === void 0 ? void 0 : _u.price, (_v !== null && _v !== void 0 ? _v : (_w = variant) === null || _w === void 0 ? void 0 : _w.price)), (_x !== null && _x !== void 0 ? _x : (_z = (_y = item) === null || _y === void 0 ? void 0 : _y.product) === null || _z === void 0 ? void 0 : _z.price)), (_0 !== null && _0 !== void 0 ? _0 : 0)));
|
|
5447
|
+
var normalizedBasePrice = isNaN(basePrice) ? 0 : basePrice;
|
|
5448
|
+
var normalizedStrikePrice = isNaN(strikePriceCandidate) ? 0 : strikePriceCandidate;
|
|
5449
|
+
var unitPromotionTotal = Array.isArray((_1 = item) === null || _1 === void 0 ? void 0 : _1.unitPromotions)
|
|
5450
|
+
? item.unitPromotions.reduce(function (total, promotion) { var _a; return total + Number(((_a = promotion) === null || _a === void 0 ? void 0 : _a.amount) || 0); }, 0)
|
|
5451
|
+
: 0;
|
|
5452
|
+
var hasStrikePrice = normalizedStrikePrice > normalizedBasePrice && normalizedBasePrice > 0;
|
|
5453
|
+
var hasUnitPromotions = Array.isArray((_2 = item) === null || _2 === void 0 ? void 0 : _2.unitPromotions) && item.unitPromotions.length > 0;
|
|
5454
|
+
var finalPrice = hasUnitPromotions ? normalizedBasePrice + unitPromotionTotal : normalizedBasePrice;
|
|
5455
|
+
var productDiscount = Number(((_4 = (_3 = item) === null || _3 === void 0 ? void 0 : _3.product) === null || _4 === void 0 ? void 0 : _4.discount) || 0);
|
|
5456
|
+
var discountPercent = !isNaN(productDiscount) && productDiscount > 0
|
|
5457
|
+
? Math.round(productDiscount)
|
|
5458
|
+
: hasStrikePrice
|
|
5459
|
+
? Math.round(((normalizedStrikePrice - normalizedBasePrice) / normalizedStrikePrice) * 100)
|
|
5460
|
+
: 0;
|
|
5461
|
+
var effectiveReferencePrice = hasStrikePrice ? normalizedStrikePrice : normalizedBasePrice;
|
|
5462
|
+
var effectiveDiscountPercent = effectiveReferencePrice > 0 && finalPrice > 0 && effectiveReferencePrice > finalPrice
|
|
5463
|
+
? Math.round(((effectiveReferencePrice - finalPrice) / effectiveReferencePrice) * 100)
|
|
5464
|
+
: discountPercent;
|
|
5465
|
+
return {
|
|
5466
|
+
basePrice: normalizedBasePrice,
|
|
5467
|
+
strikePrice: hasStrikePrice ? normalizedStrikePrice : null,
|
|
5468
|
+
finalPrice: finalPrice,
|
|
5469
|
+
unitPromotionTotal: unitPromotionTotal,
|
|
5470
|
+
hasStrikePrice: hasStrikePrice,
|
|
5471
|
+
hasUnitPromotions: hasUnitPromotions,
|
|
5472
|
+
discountPercent: discountPercent,
|
|
5473
|
+
effectiveDiscountPercent: effectiveDiscountPercent
|
|
5474
|
+
};
|
|
5475
|
+
};
|
|
5476
|
+
/**
|
|
5477
|
+
* Normaliza valores de precio provenientes del backend a `number`.
|
|
5478
|
+
*
|
|
5479
|
+
* @param value Valor numérico o string con formato local (`120.000`, `120000`, `120000-1`, etc.).
|
|
5480
|
+
* @returns Número parseado o `NaN` si el valor no es utilizable.
|
|
5481
|
+
*
|
|
5482
|
+
* @remarks
|
|
5483
|
+
* Se usa para soportar respuestas con separadores de miles, coma decimal o rangos.
|
|
5484
|
+
*/
|
|
5485
|
+
this.parsePriceValue = function (value) {
|
|
5486
|
+
if (value === null || typeof value === 'undefined') {
|
|
5487
|
+
return NaN;
|
|
5488
|
+
}
|
|
5489
|
+
if (typeof value === 'number') {
|
|
5490
|
+
return value;
|
|
5491
|
+
}
|
|
5492
|
+
var raw = value.toString().trim();
|
|
5493
|
+
if (!raw) {
|
|
5494
|
+
return NaN;
|
|
5495
|
+
}
|
|
5496
|
+
var firstValue = raw.includes('-') ? raw.split('-')[0].trim() : raw;
|
|
5497
|
+
var normalized = firstValue
|
|
5498
|
+
.replace(/\s/g, '')
|
|
5499
|
+
.replace(/\.(?=\d{3}(\D|$))/g, '')
|
|
5500
|
+
.replace(',', '.');
|
|
5501
|
+
return Number(normalized);
|
|
5502
|
+
};
|
|
5242
5503
|
this.getCreditAmount = function () {
|
|
5243
5504
|
return _this.balanceCustomerSubject.pipe(operators.map(function (balanceCustomer) { var _a, _b; return _b = (_a = balanceCustomer) === null || _a === void 0 ? void 0 : _a.creditAmount, (_b !== null && _b !== void 0 ? _b : null); }));
|
|
5244
5505
|
};
|
|
@@ -7852,7 +8113,209 @@
|
|
|
7852
8113
|
_this.showTaxLegend = false;
|
|
7853
8114
|
_this.cartLoading = false;
|
|
7854
8115
|
_this.enableFieldNotesInArticleFile = false;
|
|
8116
|
+
_this.activeUnitPromotionItemId = null;
|
|
8117
|
+
_this.activeUnitPromotionSummaryStyles = {};
|
|
8118
|
+
_this.supportsUnitPromotionHover = false;
|
|
8119
|
+
/**
|
|
8120
|
+
* Convierte un monto crudo al formato decimal esperado por la UI.
|
|
8121
|
+
*
|
|
8122
|
+
* @param amount Monto en centavos o entero crudo.
|
|
8123
|
+
* @returns Monto decimal.
|
|
8124
|
+
*/
|
|
7855
8125
|
_this.toDecimal = function (amount) { return _this.consts.toDecimal(amount); };
|
|
8126
|
+
/** @param item Ítem del carrito. @returns Porcentaje de descuento legacy para el badge `% OFF`. */
|
|
8127
|
+
_this.getItemDiscount = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.discountPercent) || 0); };
|
|
8128
|
+
/**
|
|
8129
|
+
* Devuelve el porcentaje efectivo total del ítem, considerando promociones unitarias.
|
|
8130
|
+
*
|
|
8131
|
+
* @param item Ítem del carrito.
|
|
8132
|
+
* @returns Porcentaje entero calculado contra el precio de referencia del ítem.
|
|
8133
|
+
*
|
|
8134
|
+
* @remarks
|
|
8135
|
+
* Si existe precio tachado, compara `finalPrice` contra `strikePrice`.
|
|
8136
|
+
* Si no existe, usa `basePrice` como referencia.
|
|
8137
|
+
* Esto permite mostrar un badge coherente cuando el precio visible ya incluye
|
|
8138
|
+
* descuentos/promociones unitarias adicionales.
|
|
8139
|
+
*
|
|
8140
|
+
* @example
|
|
8141
|
+
* ```ts
|
|
8142
|
+
* // strikePrice 240000, finalPrice 45000 => 81
|
|
8143
|
+
* this.getItemEffectiveDiscount(item);
|
|
8144
|
+
* ```
|
|
8145
|
+
*/
|
|
8146
|
+
_this.getItemEffectiveDiscount = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.effectiveDiscountPercent) || 0); };
|
|
8147
|
+
/** @param item Ítem del carrito. @returns Subtotal actual del renglón según backend. */
|
|
8148
|
+
_this.getDisplayedItemTotal = function (item) { var _a, _b; return Number((_b = (_a = item) === null || _a === void 0 ? void 0 : _a.total, (_b !== null && _b !== void 0 ? _b : 0))); };
|
|
8149
|
+
/** @param item Ítem del carrito. @returns `true` si el backend informó promociones unitarias. */
|
|
8150
|
+
_this.hasUnitPromotions = function (item) { var _a; return Boolean((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.hasUnitPromotions); };
|
|
8151
|
+
/** @param item Ítem del carrito. @returns `true` si el resumen activo pertenece a ese ítem. */
|
|
8152
|
+
_this.isUnitPromotionSummaryOpen = function (item) { var _a; return _this.activeUnitPromotionItemId === ((_a = item) === null || _a === void 0 ? void 0 : _a.item_id); };
|
|
8153
|
+
/**
|
|
8154
|
+
* Abre el resumen del ítem al entrar con el mouse en desktop.
|
|
8155
|
+
*
|
|
8156
|
+
* @param item Ítem del carrito.
|
|
8157
|
+
* @param anchor Elemento usado como ancla visual.
|
|
8158
|
+
* @returns `void`
|
|
8159
|
+
*/
|
|
8160
|
+
_this.handleUnitPromotionMouseEnter = function (item, anchor) {
|
|
8161
|
+
if (!_this.supportsUnitPromotionHover) {
|
|
8162
|
+
return;
|
|
8163
|
+
}
|
|
8164
|
+
_this.openUnitPromotionSummary(item, anchor);
|
|
8165
|
+
};
|
|
8166
|
+
/**
|
|
8167
|
+
* Cierra el resumen al salir con el mouse en desktop.
|
|
8168
|
+
*
|
|
8169
|
+
* @param item Ítem asociado al resumen.
|
|
8170
|
+
* @returns `void`
|
|
8171
|
+
*/
|
|
8172
|
+
_this.handleUnitPromotionMouseLeave = function (item) {
|
|
8173
|
+
if (!_this.supportsUnitPromotionHover) {
|
|
8174
|
+
return;
|
|
8175
|
+
}
|
|
8176
|
+
_this.closeUnitPromotionSummary(item);
|
|
8177
|
+
};
|
|
8178
|
+
/**
|
|
8179
|
+
* Abre el resumen de promociones unitarias para un ítem puntual.
|
|
8180
|
+
*
|
|
8181
|
+
* @param item Ítem del carrito.
|
|
8182
|
+
* @param anchor Elemento de referencia para posicionamiento.
|
|
8183
|
+
* @returns `void`
|
|
8184
|
+
*/
|
|
8185
|
+
_this.openUnitPromotionSummary = function (item, anchor) {
|
|
8186
|
+
var _a, _b;
|
|
8187
|
+
if (!_this.hasUnitPromotions(item)) {
|
|
8188
|
+
return;
|
|
8189
|
+
}
|
|
8190
|
+
_this.activeUnitPromotionItemId = (_b = (_a = item) === null || _a === void 0 ? void 0 : _a.item_id, (_b !== null && _b !== void 0 ? _b : null));
|
|
8191
|
+
_this.updateUnitPromotionSummaryStyles(anchor);
|
|
8192
|
+
};
|
|
8193
|
+
/**
|
|
8194
|
+
* Cierra el resumen activo.
|
|
8195
|
+
*
|
|
8196
|
+
* @param item Si se envía, solo cierra cuando coincide con el ítem activo.
|
|
8197
|
+
* @returns `void`
|
|
8198
|
+
*/
|
|
8199
|
+
_this.closeUnitPromotionSummary = function (item) {
|
|
8200
|
+
var _a;
|
|
8201
|
+
if (!item || _this.activeUnitPromotionItemId === ((_a = item) === null || _a === void 0 ? void 0 : _a.item_id)) {
|
|
8202
|
+
_this.activeUnitPromotionItemId = null;
|
|
8203
|
+
_this.activeUnitPromotionSummaryStyles = {};
|
|
8204
|
+
}
|
|
8205
|
+
};
|
|
8206
|
+
/**
|
|
8207
|
+
* Alterna manualmente la apertura del resumen para un ítem.
|
|
8208
|
+
*
|
|
8209
|
+
* @param item Ítem del carrito.
|
|
8210
|
+
* @param anchor Elemento de referencia.
|
|
8211
|
+
* @param event Evento del puntero.
|
|
8212
|
+
* @returns `void`
|
|
8213
|
+
*/
|
|
8214
|
+
_this.toggleUnitPromotionSummary = function (item, anchor, event) {
|
|
8215
|
+
event.preventDefault();
|
|
8216
|
+
event.stopPropagation();
|
|
8217
|
+
if (!_this.hasUnitPromotions(item)) {
|
|
8218
|
+
return;
|
|
8219
|
+
}
|
|
8220
|
+
if (_this.isUnitPromotionSummaryOpen(item)) {
|
|
8221
|
+
_this.closeUnitPromotionSummary(item);
|
|
8222
|
+
return;
|
|
8223
|
+
}
|
|
8224
|
+
_this.openUnitPromotionSummary(item, anchor);
|
|
8225
|
+
};
|
|
8226
|
+
/**
|
|
8227
|
+
* Maneja el click/tap sobre el precio en dispositivos sin hover.
|
|
8228
|
+
*
|
|
8229
|
+
* @param item Ítem del carrito.
|
|
8230
|
+
* @param anchor Elemento usado como trigger.
|
|
8231
|
+
* @param event Evento de click/tap.
|
|
8232
|
+
* @returns `void`
|
|
8233
|
+
*/
|
|
8234
|
+
_this.handleUnitPromotionPriceClick = function (item, anchor, event) {
|
|
8235
|
+
if (_this.supportsUnitPromotionHover) {
|
|
8236
|
+
return;
|
|
8237
|
+
}
|
|
8238
|
+
_this.toggleUnitPromotionSummary(item, anchor, event);
|
|
8239
|
+
};
|
|
8240
|
+
/**
|
|
8241
|
+
* Evita que eventos dentro del resumen se propaguen al documento.
|
|
8242
|
+
*
|
|
8243
|
+
* @param event Evento del puntero.
|
|
8244
|
+
* @returns `void`
|
|
8245
|
+
*/
|
|
8246
|
+
_this.stopUnitPromotionSummaryEvent = function (event) {
|
|
8247
|
+
event.stopPropagation();
|
|
8248
|
+
};
|
|
8249
|
+
/** @param item Ítem del carrito. @returns Precio unitario base (`saleprice` o `price`). */
|
|
8250
|
+
_this.getOriginalUnitPrice = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.basePrice) || 0); };
|
|
8251
|
+
/** @param item Ítem del carrito. @returns Precio tachado legacy o `0`. */
|
|
8252
|
+
_this.getStrikeThroughUnitPrice = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.strikePrice) || 0); };
|
|
8253
|
+
/** @param item Ítem del carrito. @returns Suma de promociones unitarias aplicadas. */
|
|
8254
|
+
_this.getUnitPromotionTotal = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.unitPromotionTotal) || 0); };
|
|
8255
|
+
/** @param item Ítem del carrito. @returns Precio final unitario luego de promociones. */
|
|
8256
|
+
_this.getFinalUnitPrice = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.finalPrice) || 0); };
|
|
8257
|
+
/** @param item Ítem del carrito. @returns Precio principal a mostrar junto al trigger. */
|
|
8258
|
+
_this.getDisplayedUnitPrice = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.finalPrice) || 0); };
|
|
8259
|
+
/** @param item Ítem del carrito. @returns `true` si debe mostrarse el precio base junto al final. */
|
|
8260
|
+
_this.shouldShowOriginalUnitPrice = function (item) {
|
|
8261
|
+
return _this.hasUnitPromotions(item) && _this.getFinalUnitPrice(item) !== _this.getOriginalUnitPrice(item);
|
|
8262
|
+
};
|
|
8263
|
+
/** @param item Ítem del carrito. @returns `true` si además del base price existe tachado legacy. */
|
|
8264
|
+
_this.shouldShowLegacyPriceOrigin = function (item) {
|
|
8265
|
+
return _this.getStrikeThroughUnitPrice(item) > _this.getOriginalUnitPrice(item);
|
|
8266
|
+
};
|
|
8267
|
+
/** @param item Ítem del carrito. @returns Etiqueta final del resumen. */
|
|
8268
|
+
_this.getUnitPromotionFinalPriceLabel = function (item) {
|
|
8269
|
+
return _this.hasUnitPromotions(item) ? 'Precio final' : 'Precio unitario';
|
|
8270
|
+
};
|
|
8271
|
+
/**
|
|
8272
|
+
* Busca dentro de una lista el ítem que tiene actualmente el resumen abierto.
|
|
8273
|
+
*
|
|
8274
|
+
* @param items Lista de ítems del carrito.
|
|
8275
|
+
* @returns Ítem activo o `null`.
|
|
8276
|
+
*/
|
|
8277
|
+
_this.getActiveUnitPromotionItem = function (items) { var _a; return ((_a = items) === null || _a === void 0 ? void 0 : _a.find(function (item) { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.item_id) === _this.activeUnitPromotionItemId; })) || null; };
|
|
8278
|
+
/** @param item Ítem del carrito. @returns Promociones unitarias crudas del backend. */
|
|
8279
|
+
_this.getUnitPromotions = function (item) { var _a; return Array.isArray((_a = item) === null || _a === void 0 ? void 0 : _a.unitPromotions) ? item.unitPromotions : []; };
|
|
8280
|
+
/**
|
|
8281
|
+
* Detecta si el dispositivo soporta `hover` real y debe comportarse como desktop.
|
|
8282
|
+
*
|
|
8283
|
+
* @returns `void`
|
|
8284
|
+
*/
|
|
8285
|
+
_this.updateUnitPromotionViewportMode = function () {
|
|
8286
|
+
_this.supportsUnitPromotionHover = typeof window !== 'undefined'
|
|
8287
|
+
&& typeof window.matchMedia === 'function'
|
|
8288
|
+
&& window.matchMedia('(hover: hover) and (pointer: fine)').matches
|
|
8289
|
+
&& window.innerWidth >= 768;
|
|
8290
|
+
};
|
|
8291
|
+
/**
|
|
8292
|
+
* Calcula estilos inline para mantener el resumen mobile dentro del viewport.
|
|
8293
|
+
*
|
|
8294
|
+
* @param anchor Elemento usado como ancla visual.
|
|
8295
|
+
* @returns `void`
|
|
8296
|
+
*/
|
|
8297
|
+
_this.updateUnitPromotionSummaryStyles = function (anchor) {
|
|
8298
|
+
if (_this.supportsUnitPromotionHover || !anchor || typeof window === 'undefined') {
|
|
8299
|
+
_this.activeUnitPromotionSummaryStyles = {};
|
|
8300
|
+
return;
|
|
8301
|
+
}
|
|
8302
|
+
var viewportPadding = 12;
|
|
8303
|
+
var rect = anchor.getBoundingClientRect();
|
|
8304
|
+
var estimatedPopupHeight = 260;
|
|
8305
|
+
var nextTop = rect.bottom + 8;
|
|
8306
|
+
var maxTop = window.innerHeight - estimatedPopupHeight - viewportPadding;
|
|
8307
|
+
var top = Math.max(viewportPadding, Math.min(nextTop, maxTop));
|
|
8308
|
+
_this.activeUnitPromotionSummaryStyles = {
|
|
8309
|
+
left: viewportPadding + "px",
|
|
8310
|
+
right: viewportPadding + "px",
|
|
8311
|
+
top: top + "px",
|
|
8312
|
+
width: 'auto',
|
|
8313
|
+
'max-width': 'none',
|
|
8314
|
+
'max-height': "calc(100vh - " + (top + viewportPadding) + "px)",
|
|
8315
|
+
overflow: 'auto',
|
|
8316
|
+
position: 'fixed'
|
|
8317
|
+
};
|
|
8318
|
+
};
|
|
7856
8319
|
_this.cartItemPlus = function (item) {
|
|
7857
8320
|
var _a, _b;
|
|
7858
8321
|
var multipleQty = ((_a = item.product.variants[0]) === null || _a === void 0 ? void 0 : _a.multipleQuantity) || 0;
|
|
@@ -7941,6 +8404,8 @@
|
|
|
7941
8404
|
_this.ecOnConstruct();
|
|
7942
8405
|
_this.isLoggedIn = _this.authService.isAuthenticated();
|
|
7943
8406
|
_this.mediaUrl = _this.consts.mediaUrl();
|
|
8407
|
+
_this.summaryPromotionAmount$ = _this.cartService.getSummaryPromotionAmount();
|
|
8408
|
+
_this.hasAppliedCoupon$ = _this.cartService.hasAppliedCoupon();
|
|
7944
8409
|
return _this;
|
|
7945
8410
|
}
|
|
7946
8411
|
CartEcComponent.prototype.ngOnChanges = function () {
|
|
@@ -7952,6 +8417,7 @@
|
|
|
7952
8417
|
CartEcComponent.prototype.ngOnInit = function () {
|
|
7953
8418
|
var _this = this;
|
|
7954
8419
|
window.scroll(0, 0);
|
|
8420
|
+
this.updateUnitPromotionViewportMode();
|
|
7955
8421
|
this.cartService.promotions.subscribe(function (promotions) { return _this.promotions = promotions; });
|
|
7956
8422
|
// console.log(this.cartService.getTaxes());
|
|
7957
8423
|
this.channelConfigService.channelConfig$.subscribe(function (channel) {
|
|
@@ -7973,6 +8439,26 @@
|
|
|
7973
8439
|
});
|
|
7974
8440
|
this.ecOnInit();
|
|
7975
8441
|
};
|
|
8442
|
+
/** Cierra el resumen al hacer click fuera en desktop. */
|
|
8443
|
+
CartEcComponent.prototype.handleDocumentClick = function () {
|
|
8444
|
+
if (!this.supportsUnitPromotionHover) {
|
|
8445
|
+
return;
|
|
8446
|
+
}
|
|
8447
|
+
this.activeUnitPromotionItemId = null;
|
|
8448
|
+
this.activeUnitPromotionSummaryStyles = {};
|
|
8449
|
+
};
|
|
8450
|
+
/** Recalcula el modo de interacción y cierra el resumen al cambiar el viewport. */
|
|
8451
|
+
CartEcComponent.prototype.handleWindowResize = function () {
|
|
8452
|
+
this.updateUnitPromotionViewportMode();
|
|
8453
|
+
this.closeUnitPromotionSummary();
|
|
8454
|
+
};
|
|
8455
|
+
/** Cierra el resumen en mobile al hacer scroll para evitar desalineación visual. */
|
|
8456
|
+
CartEcComponent.prototype.handleWindowScroll = function () {
|
|
8457
|
+
if (this.supportsUnitPromotionHover) {
|
|
8458
|
+
return;
|
|
8459
|
+
}
|
|
8460
|
+
this.closeUnitPromotionSummary();
|
|
8461
|
+
};
|
|
7976
8462
|
CartEcComponent.prototype.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
7977
8463
|
var _this = this;
|
|
7978
8464
|
var _a, _b, _c;
|
|
@@ -8292,6 +8778,15 @@
|
|
|
8292
8778
|
{ type: AddressingService },
|
|
8293
8779
|
{ type: ChannelConfigService }
|
|
8294
8780
|
]; };
|
|
8781
|
+
__decorate$O([
|
|
8782
|
+
core.HostListener('document:click')
|
|
8783
|
+
], CartEcComponent.prototype, "handleDocumentClick", null);
|
|
8784
|
+
__decorate$O([
|
|
8785
|
+
core.HostListener('window:resize')
|
|
8786
|
+
], CartEcComponent.prototype, "handleWindowResize", null);
|
|
8787
|
+
__decorate$O([
|
|
8788
|
+
core.HostListener('window:scroll')
|
|
8789
|
+
], CartEcComponent.prototype, "handleWindowScroll", null);
|
|
8295
8790
|
CartEcComponent = __decorate$O([
|
|
8296
8791
|
core.Component({
|
|
8297
8792
|
selector: 'app-cart-ec',
|
|
@@ -8390,7 +8885,7 @@
|
|
|
8390
8885
|
};
|
|
8391
8886
|
var DataFormEcComponent = /** @class */ (function (_super) {
|
|
8392
8887
|
__extends$h(DataFormEcComponent, _super);
|
|
8393
|
-
function DataFormEcComponent(authService, fb, toast, addressingService, cartService, checkoutService, modalService, paramsService, consts, channelConfig) {
|
|
8888
|
+
function DataFormEcComponent(authService, fb, toast, addressingService, cartService, checkoutService, orderUtils, modalService, paramsService, consts, channelConfig) {
|
|
8394
8889
|
var _this = _super.call(this) || this;
|
|
8395
8890
|
_this.authService = authService;
|
|
8396
8891
|
_this.fb = fb;
|
|
@@ -8398,6 +8893,7 @@
|
|
|
8398
8893
|
_this.addressingService = addressingService;
|
|
8399
8894
|
_this.cartService = cartService;
|
|
8400
8895
|
_this.checkoutService = checkoutService;
|
|
8896
|
+
_this.orderUtils = orderUtils;
|
|
8401
8897
|
_this.modalService = modalService;
|
|
8402
8898
|
_this.paramsService = paramsService;
|
|
8403
8899
|
_this.consts = consts;
|
|
@@ -9116,7 +9612,7 @@
|
|
|
9116
9612
|
shipping: Number(totals.shipping || 0),
|
|
9117
9613
|
total: Number(totals.total || 0),
|
|
9118
9614
|
clientTaxes: Number(totals.clientTaxes || 0),
|
|
9119
|
-
promotion:
|
|
9615
|
+
promotion: _this.orderUtils.getSummaryPromotionAmount(order),
|
|
9120
9616
|
items: Number(totals.items || 0)
|
|
9121
9617
|
};
|
|
9122
9618
|
};
|
|
@@ -9320,6 +9816,7 @@
|
|
|
9320
9816
|
{ type: AddressingService },
|
|
9321
9817
|
{ type: CartService },
|
|
9322
9818
|
{ type: CheckoutService },
|
|
9819
|
+
{ type: OrderUtilityService },
|
|
9323
9820
|
{ type: modal.BsModalService },
|
|
9324
9821
|
{ type: ParametersService },
|
|
9325
9822
|
{ type: Constants },
|
|
@@ -17712,9 +18209,16 @@
|
|
|
17712
18209
|
}
|
|
17713
18210
|
DetailCheckoutBlockEcComponent.prototype.ngOnInit = function () {
|
|
17714
18211
|
var _this = this;
|
|
17715
|
-
|
|
17716
|
-
this.
|
|
17717
|
-
|
|
18212
|
+
if (this.asociatedData) {
|
|
18213
|
+
this.data = this.asociatedData;
|
|
18214
|
+
this.calcularTotales();
|
|
18215
|
+
}
|
|
18216
|
+
else {
|
|
18217
|
+
this.checkoutService.asociatedData$.subscribe(function (data) {
|
|
18218
|
+
_this.data = data;
|
|
18219
|
+
_this.calcularTotales();
|
|
18220
|
+
});
|
|
18221
|
+
}
|
|
17718
18222
|
this.ecOnInit();
|
|
17719
18223
|
this.cartService.showPrice$.subscribe(function (showPrice) {
|
|
17720
18224
|
_this.creditAccountShowPrices = showPrice;
|
|
@@ -17730,6 +18234,8 @@
|
|
|
17730
18234
|
});
|
|
17731
18235
|
};
|
|
17732
18236
|
DetailCheckoutBlockEcComponent.prototype.calcularTotales = function () {
|
|
18237
|
+
this.discountTotal = 0;
|
|
18238
|
+
this.couponTotal = 0;
|
|
17733
18239
|
if (this.data) {
|
|
17734
18240
|
this.discountTotal = this.data
|
|
17735
18241
|
.filter(function (item) { return item.type === 'discount'; })
|
|
@@ -22361,7 +22867,60 @@
|
|
|
22361
22867
|
return null;
|
|
22362
22868
|
}
|
|
22363
22869
|
};
|
|
22870
|
+
/**
|
|
22871
|
+
* Devuelve el porcentaje de descuento a mostrar para un ítem del sidebar.
|
|
22872
|
+
*
|
|
22873
|
+
* @param item Ítem del carrito.
|
|
22874
|
+
* @returns Porcentaje entero de descuento.
|
|
22875
|
+
*/
|
|
22876
|
+
this.getItemDiscount = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.discountPercent) || 0); };
|
|
22877
|
+
/**
|
|
22878
|
+
* Devuelve el porcentaje efectivo total del ítem, considerando promociones unitarias.
|
|
22879
|
+
*
|
|
22880
|
+
* @param item Ítem del carrito.
|
|
22881
|
+
* @returns Porcentaje entero calculado contra el precio de referencia del ítem.
|
|
22882
|
+
*
|
|
22883
|
+
* @remarks
|
|
22884
|
+
* Si el frontend muestra el precio final unitario junto con un precio tachado legacy,
|
|
22885
|
+
* este helper evita inconsistencias visuales en el badge `% OFF`.
|
|
22886
|
+
*
|
|
22887
|
+
* @example
|
|
22888
|
+
* ```ts
|
|
22889
|
+
* // strikePrice 240000, finalPrice 45000 => 81
|
|
22890
|
+
* this.getItemEffectiveDiscount(item);
|
|
22891
|
+
* ```
|
|
22892
|
+
*/
|
|
22893
|
+
this.getItemEffectiveDiscount = function (item) { var _a; return Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.effectiveDiscountPercent) || 0); };
|
|
22894
|
+
/**
|
|
22895
|
+
* Devuelve el precio tachado del renglón completo, escalado por cantidad.
|
|
22896
|
+
*
|
|
22897
|
+
* @param item Ítem del carrito.
|
|
22898
|
+
* @returns Total tachado del renglón o `0` cuando no corresponde mostrarlo.
|
|
22899
|
+
*
|
|
22900
|
+
* @remarks
|
|
22901
|
+
* Este helper es útil en sidebars que renderizan precios por renglón, no unitarios.
|
|
22902
|
+
* Ejemplo: si el precio tachado unitario es `15000` y la cantidad es `2`,
|
|
22903
|
+
* el valor mostrado debe ser `30000`.
|
|
22904
|
+
*/
|
|
22905
|
+
this.getDisplayedItemStrikeThroughTotal = function (item) {
|
|
22906
|
+
var _a, _b;
|
|
22907
|
+
var strikePrice = Number(((_a = _this.cartService.getItemPricing(item)) === null || _a === void 0 ? void 0 : _a.strikePrice) || 0);
|
|
22908
|
+
var quantity = Number(((_b = item) === null || _b === void 0 ? void 0 : _b.quantity) || 0);
|
|
22909
|
+
if (strikePrice <= 0 || quantity <= 0) {
|
|
22910
|
+
return 0;
|
|
22911
|
+
}
|
|
22912
|
+
return strikePrice * quantity;
|
|
22913
|
+
};
|
|
22914
|
+
/**
|
|
22915
|
+
* Devuelve el subtotal actual del renglón según backend.
|
|
22916
|
+
*
|
|
22917
|
+
* @param item Ítem del carrito.
|
|
22918
|
+
* @returns Monto total del renglón.
|
|
22919
|
+
*/
|
|
22920
|
+
this.getDisplayedItemTotal = function (item) { var _a, _b; return Number((_b = (_a = item) === null || _a === void 0 ? void 0 : _a.total, (_b !== null && _b !== void 0 ? _b : 0))); };
|
|
22364
22921
|
this.mediaUrl = this.consts.mediaUrl();
|
|
22922
|
+
this.summaryPromotionAmount$ = this.cartService.getSummaryPromotionAmount();
|
|
22923
|
+
this.hasAppliedCoupon$ = this.cartService.hasAppliedCoupon();
|
|
22365
22924
|
}
|
|
22366
22925
|
SidebarEcComponent.prototype.ngOnInit = function () {
|
|
22367
22926
|
var _this = this;
|
|
@@ -22435,6 +22994,13 @@
|
|
|
22435
22994
|
path += variant.options.length ? "?variant=true" : "";
|
|
22436
22995
|
this.router.navigateByUrl(path);
|
|
22437
22996
|
};
|
|
22997
|
+
/**
|
|
22998
|
+
* Construye el badge `% OFF` legacy a partir de `price` y `saleprice`.
|
|
22999
|
+
*
|
|
23000
|
+
* @param saleprice Precio de venta actual.
|
|
23001
|
+
* @param price Precio original tachado.
|
|
23002
|
+
* @returns Texto del badge o string vacío cuando no corresponde mostrar descuento.
|
|
23003
|
+
*/
|
|
22438
23004
|
SidebarEcComponent.prototype.createDiscountMessage = function (saleprice, price) {
|
|
22439
23005
|
if (isNaN(saleprice) || isNaN(price) || saleprice >= price || saleprice <= 0 || price <= 0) {
|
|
22440
23006
|
return '';
|
|
@@ -22683,6 +23249,251 @@
|
|
|
22683
23249
|
return BlockRenderEcComponent;
|
|
22684
23250
|
}(ComponentHelper));
|
|
22685
23251
|
|
|
23252
|
+
var __decorate$26 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23253
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23254
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23255
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
23256
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23257
|
+
};
|
|
23258
|
+
var UnitPromotionPriceEcComponent = /** @class */ (function () {
|
|
23259
|
+
function UnitPromotionPriceEcComponent(cartService) {
|
|
23260
|
+
var _this = this;
|
|
23261
|
+
this.cartService = cartService;
|
|
23262
|
+
/** Indica si el componente se está usando en un layout mobile. */
|
|
23263
|
+
this.mobile = false;
|
|
23264
|
+
this.summaryOpen = false;
|
|
23265
|
+
this.summaryStyles = {};
|
|
23266
|
+
this.supportsHover = false;
|
|
23267
|
+
/** @returns `true` cuando el ítem tiene promociones unitarias informadas por backend. */
|
|
23268
|
+
this.hasUnitPromotions = function () { var _a; return Boolean((_a = _this.cartService.getItemPricing(_this.item)) === null || _a === void 0 ? void 0 : _a.hasUnitPromotions); };
|
|
23269
|
+
/** @returns `true` cuando el popover/resumen está abierto. */
|
|
23270
|
+
this.isSummaryOpen = function () { return _this.summaryOpen; };
|
|
23271
|
+
/** @returns El precio base histórico del ítem (`saleprice` si existe, si no `price`). */
|
|
23272
|
+
this.getOriginalUnitPrice = function () { var _a; return Number(((_a = _this.cartService.getItemPricing(_this.item)) === null || _a === void 0 ? void 0 : _a.basePrice) || 0); };
|
|
23273
|
+
/** @returns La suma de los descuentos/promociones unitarios aplicados al ítem. */
|
|
23274
|
+
this.getUnitPromotionTotal = function () { var _a; return Number(((_a = _this.cartService.getItemPricing(_this.item)) === null || _a === void 0 ? void 0 : _a.unitPromotionTotal) || 0); };
|
|
23275
|
+
/** @returns El precio unitario final luego de aplicar promociones unitarias. */
|
|
23276
|
+
this.getFinalUnitPrice = function () { var _a; return Number(((_a = _this.cartService.getItemPricing(_this.item)) === null || _a === void 0 ? void 0 : _a.finalPrice) || 0); };
|
|
23277
|
+
/** @returns El precio principal que se renderiza junto al icono de ayuda. */
|
|
23278
|
+
this.getDisplayedUnitPrice = function () { var _a; return Number(((_a = _this.cartService.getItemPricing(_this.item)) === null || _a === void 0 ? void 0 : _a.finalPrice) || 0); };
|
|
23279
|
+
/** @returns Etiqueta del bloque final dentro del popover. */
|
|
23280
|
+
this.getUnitPromotionFinalPriceLabel = function () { return _this.hasUnitPromotions() ? 'Precio final' : 'Precio unitario'; };
|
|
23281
|
+
/** @returns Lista cruda de promociones unitarias a mostrar en el detalle. */
|
|
23282
|
+
this.getUnitPromotions = function () { var _a; return Array.isArray((_a = _this.item) === null || _a === void 0 ? void 0 : _a.unitPromotions) ? _this.item.unitPromotions : []; };
|
|
23283
|
+
/**
|
|
23284
|
+
* Abre el popover al pasar el mouse en dispositivos con hover real.
|
|
23285
|
+
*
|
|
23286
|
+
* @param anchor Elemento usado como referencia visual del popover.
|
|
23287
|
+
* @returns `void`
|
|
23288
|
+
*/
|
|
23289
|
+
this.handleMouseEnter = function (anchor) {
|
|
23290
|
+
if (!_this.supportsHover) {
|
|
23291
|
+
return;
|
|
23292
|
+
}
|
|
23293
|
+
_this.openSummary(anchor);
|
|
23294
|
+
};
|
|
23295
|
+
/**
|
|
23296
|
+
* Cierra el popover al salir con el mouse en desktop.
|
|
23297
|
+
*
|
|
23298
|
+
* @returns `void`
|
|
23299
|
+
*/
|
|
23300
|
+
this.handleMouseLeave = function () {
|
|
23301
|
+
if (!_this.supportsHover) {
|
|
23302
|
+
return;
|
|
23303
|
+
}
|
|
23304
|
+
_this.closeSummary();
|
|
23305
|
+
};
|
|
23306
|
+
/**
|
|
23307
|
+
* Alterna la apertura del popover con click/tap en dispositivos sin hover.
|
|
23308
|
+
*
|
|
23309
|
+
* @param anchor Elemento usado como ancla para posicionar el detalle.
|
|
23310
|
+
* @param event Evento del click/tap sobre el bloque de precio.
|
|
23311
|
+
* @returns `void`
|
|
23312
|
+
*/
|
|
23313
|
+
this.handlePriceClick = function (anchor, event) {
|
|
23314
|
+
if (_this.supportsHover) {
|
|
23315
|
+
return;
|
|
23316
|
+
}
|
|
23317
|
+
_this.toggleSummary(anchor, event);
|
|
23318
|
+
};
|
|
23319
|
+
/**
|
|
23320
|
+
* Alterna manualmente el estado del resumen.
|
|
23321
|
+
*
|
|
23322
|
+
* @param anchor Elemento usado como ancla visual del popover.
|
|
23323
|
+
* @param event Evento que dispara la interacción.
|
|
23324
|
+
* @returns `void`
|
|
23325
|
+
*/
|
|
23326
|
+
this.toggleSummary = function (anchor, event) {
|
|
23327
|
+
event.preventDefault();
|
|
23328
|
+
event.stopPropagation();
|
|
23329
|
+
if (!_this.hasUnitPromotions()) {
|
|
23330
|
+
return;
|
|
23331
|
+
}
|
|
23332
|
+
if (_this.isSummaryOpen()) {
|
|
23333
|
+
_this.closeSummary();
|
|
23334
|
+
return;
|
|
23335
|
+
}
|
|
23336
|
+
_this.openSummary(anchor);
|
|
23337
|
+
};
|
|
23338
|
+
/**
|
|
23339
|
+
* Cierra el popover y limpia los estilos calculados para mobile.
|
|
23340
|
+
*
|
|
23341
|
+
* @returns `void`
|
|
23342
|
+
*/
|
|
23343
|
+
this.closeSummary = function () {
|
|
23344
|
+
_this.summaryOpen = false;
|
|
23345
|
+
_this.summaryStyles = {};
|
|
23346
|
+
};
|
|
23347
|
+
/**
|
|
23348
|
+
* Evita que un click dentro del popover se propague y lo cierre.
|
|
23349
|
+
*
|
|
23350
|
+
* @param event Evento del puntero.
|
|
23351
|
+
* @returns `void`
|
|
23352
|
+
*/
|
|
23353
|
+
this.stopSummaryEvent = function (event) {
|
|
23354
|
+
event.stopPropagation();
|
|
23355
|
+
};
|
|
23356
|
+
/**
|
|
23357
|
+
* Abre el resumen y recalcula su posición.
|
|
23358
|
+
*
|
|
23359
|
+
* @param anchor Elemento de referencia para el posicionamiento.
|
|
23360
|
+
* @returns `void`
|
|
23361
|
+
*/
|
|
23362
|
+
this.openSummary = function (anchor) {
|
|
23363
|
+
if (!_this.hasUnitPromotions()) {
|
|
23364
|
+
return;
|
|
23365
|
+
}
|
|
23366
|
+
_this.summaryOpen = true;
|
|
23367
|
+
_this.updateSummaryStyles(anchor);
|
|
23368
|
+
};
|
|
23369
|
+
/**
|
|
23370
|
+
* Detecta si la interacción debe comportarse como desktop (`hover`) o mobile (`click`).
|
|
23371
|
+
*
|
|
23372
|
+
* @returns `void`
|
|
23373
|
+
*/
|
|
23374
|
+
this.updateViewportMode = function () {
|
|
23375
|
+
_this.supportsHover = typeof window !== 'undefined'
|
|
23376
|
+
&& typeof window.matchMedia === 'function'
|
|
23377
|
+
&& window.matchMedia('(hover: hover) and (pointer: fine)').matches
|
|
23378
|
+
&& window.innerWidth >= 768;
|
|
23379
|
+
};
|
|
23380
|
+
/**
|
|
23381
|
+
* Calcula estilos inline para que el resumen mobile quede dentro del viewport.
|
|
23382
|
+
*
|
|
23383
|
+
* @param anchor Elemento tocado por el usuario.
|
|
23384
|
+
* @returns `void`
|
|
23385
|
+
*/
|
|
23386
|
+
this.updateSummaryStyles = function (anchor) {
|
|
23387
|
+
if (_this.supportsHover || !anchor || typeof window === 'undefined') {
|
|
23388
|
+
_this.summaryStyles = {};
|
|
23389
|
+
return;
|
|
23390
|
+
}
|
|
23391
|
+
var viewportPadding = 12;
|
|
23392
|
+
var rect = anchor.getBoundingClientRect();
|
|
23393
|
+
var estimatedPopupHeight = 260;
|
|
23394
|
+
var nextTop = rect.bottom + 8;
|
|
23395
|
+
var maxTop = window.innerHeight - estimatedPopupHeight - viewportPadding;
|
|
23396
|
+
var top = Math.max(viewportPadding, Math.min(nextTop, maxTop));
|
|
23397
|
+
_this.summaryStyles = {
|
|
23398
|
+
left: viewportPadding + "px",
|
|
23399
|
+
right: viewportPadding + "px",
|
|
23400
|
+
top: top + "px",
|
|
23401
|
+
width: 'auto',
|
|
23402
|
+
'max-width': 'none',
|
|
23403
|
+
'max-height': "calc(100vh - " + (top + viewportPadding) + "px)",
|
|
23404
|
+
overflow: 'auto',
|
|
23405
|
+
position: 'fixed'
|
|
23406
|
+
};
|
|
23407
|
+
};
|
|
23408
|
+
}
|
|
23409
|
+
/**
|
|
23410
|
+
* Inicializa el modo de interacción según el dispositivo actual.
|
|
23411
|
+
*
|
|
23412
|
+
* @returns `void`
|
|
23413
|
+
*/
|
|
23414
|
+
UnitPromotionPriceEcComponent.prototype.ngOnInit = function () {
|
|
23415
|
+
this.updateViewportMode();
|
|
23416
|
+
};
|
|
23417
|
+
/**
|
|
23418
|
+
* Cierra el resumen cuando se hace click fuera del componente en desktop.
|
|
23419
|
+
*
|
|
23420
|
+
* @returns `void`
|
|
23421
|
+
*/
|
|
23422
|
+
UnitPromotionPriceEcComponent.prototype.handleDocumentClick = function () {
|
|
23423
|
+
if (!this.supportsHover) {
|
|
23424
|
+
return;
|
|
23425
|
+
}
|
|
23426
|
+
this.closeSummary();
|
|
23427
|
+
};
|
|
23428
|
+
/**
|
|
23429
|
+
* Recalcula el modo de interacción al cambiar el viewport.
|
|
23430
|
+
*
|
|
23431
|
+
* @returns `void`
|
|
23432
|
+
*/
|
|
23433
|
+
UnitPromotionPriceEcComponent.prototype.handleWindowResize = function () {
|
|
23434
|
+
this.updateViewportMode();
|
|
23435
|
+
this.closeSummary();
|
|
23436
|
+
};
|
|
23437
|
+
/**
|
|
23438
|
+
* Cierra el resumen en mobile al hacer scroll para evitar que quede desacoplado del trigger.
|
|
23439
|
+
*
|
|
23440
|
+
* @returns `void`
|
|
23441
|
+
*/
|
|
23442
|
+
UnitPromotionPriceEcComponent.prototype.handleWindowScroll = function () {
|
|
23443
|
+
if (this.supportsHover) {
|
|
23444
|
+
return;
|
|
23445
|
+
}
|
|
23446
|
+
this.closeSummary();
|
|
23447
|
+
};
|
|
23448
|
+
UnitPromotionPriceEcComponent.ctorParameters = function () { return [
|
|
23449
|
+
{ type: CartService }
|
|
23450
|
+
]; };
|
|
23451
|
+
__decorate$26([
|
|
23452
|
+
core.Input()
|
|
23453
|
+
], UnitPromotionPriceEcComponent.prototype, "item", void 0);
|
|
23454
|
+
__decorate$26([
|
|
23455
|
+
core.Input()
|
|
23456
|
+
], UnitPromotionPriceEcComponent.prototype, "mobile", void 0);
|
|
23457
|
+
__decorate$26([
|
|
23458
|
+
core.HostListener('document:click')
|
|
23459
|
+
], UnitPromotionPriceEcComponent.prototype, "handleDocumentClick", null);
|
|
23460
|
+
__decorate$26([
|
|
23461
|
+
core.HostListener('window:resize')
|
|
23462
|
+
], UnitPromotionPriceEcComponent.prototype, "handleWindowResize", null);
|
|
23463
|
+
__decorate$26([
|
|
23464
|
+
core.HostListener('window:scroll')
|
|
23465
|
+
], UnitPromotionPriceEcComponent.prototype, "handleWindowScroll", null);
|
|
23466
|
+
UnitPromotionPriceEcComponent = __decorate$26([
|
|
23467
|
+
core.Component({
|
|
23468
|
+
selector: 'app-unit-promotion-price-ec',
|
|
23469
|
+
template: "<div\n class=\"ec-unit-promotion-price\"\n [class.ec-unit-promotion-price--mobile]=\"mobile\"\n [class.ec-unit-promotion-price--desktop]=\"!mobile\"\n>\n <div class=\"ec-unit-promotion-price__detail\">\n <div\n class=\"ec-unit-promotion-price__current-wrapper\"\n #priceAnchor\n (mouseenter)=\"handleMouseEnter(priceAnchor)\"\n (mouseleave)=\"handleMouseLeave()\"\n (click)=\"handlePriceClick(priceAnchor, $event)\"\n >\n <span\n class=\"ec-unit-promotion-price__current\"\n [class.ec-unit-promotion-price__current--clickable]=\"hasUnitPromotions() && !supportsHover\"\n >\n <strong class=\"ec-unit-promotion-price__value\">{{ getDisplayedUnitPrice() | ecCurrencySymbol }}</strong>\n\n <button\n *ngIf=\"hasUnitPromotions()\"\n type=\"button\"\n class=\"ec-unit-promotion-price__trigger\"\n [attr.aria-expanded]=\"isSummaryOpen()\"\n aria-label=\"Ver detalle de promociones unitarias\"\n (click)=\"toggleSummary(priceAnchor, $event)\"\n >\n <i class=\"bi bi-info-circle ec-unit-promotion-price__icon\"></i>\n </button>\n </span>\n\n <ng-container *ngIf=\"supportsHover && isSummaryOpen()\">\n <ng-container *ngTemplateOutlet=\"summaryTemplate\"></ng-container>\n </ng-container>\n </div>\n </div>\n\n <ng-container *ngIf=\"mobile && !supportsHover && isSummaryOpen()\">\n <button\n type=\"button\"\n class=\"ec-unit-promotion-price__backdrop\"\n aria-label=\"Cerrar detalle de promociones unitarias\"\n (click)=\"closeSummary()\"\n ></button>\n\n <ng-container *ngTemplateOutlet=\"summaryTemplate\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #summaryTemplate>\n <div\n class=\"ec-unit-promotion-price__summary\"\n [class.ec-unit-promotion-price__summary--mobile]=\"mobile\"\n [ngStyle]=\"summaryStyles\"\n (click)=\"stopSummaryEvent($event)\"\n >\n <div class=\"ec-unit-promotion-price__row ec-unit-promotion-price__row--original\">\n <span>Precio original</span>\n <span>{{ getOriginalUnitPrice() | ecCurrencySymbol }}</span>\n </div>\n\n <div class=\"ec-unit-promotion-price__row\" *ngFor=\"let promotion of getUnitPromotions()\">\n <span>{{ promotion.name }}</span>\n <span>{{ promotion.amount | ecCurrencySymbol }}</span>\n </div>\n\n <div class=\"ec-unit-promotion-price__divider\"></div>\n\n <div class=\"ec-unit-promotion-price__row ec-unit-promotion-price__row--total\">\n <span>Total descuentos</span>\n <span>{{ getUnitPromotionTotal() | ecCurrencySymbol }}</span>\n </div>\n\n <div class=\"ec-unit-promotion-price__row ec-unit-promotion-price__row--final\">\n <span>{{ getUnitPromotionFinalPriceLabel() }}</span>\n <span>{{ getFinalUnitPrice() | ecCurrencySymbol }}</span>\n </div>\n </div>\n</ng-template>\n",
|
|
23470
|
+
styles: [":host{display:inline-block;--ec-unit-promotion-current-gap:0.35rem;--ec-unit-promotion-current-font-size:1.25rem;--ec-unit-promotion-current-font-weight:700;--ec-unit-promotion-current-color:inherit;--ec-unit-promotion-icon-color:#6c757d;--ec-unit-promotion-icon-size:0.95rem;--ec-unit-promotion-summary-bg:#ffffff;--ec-unit-promotion-summary-shadow:0 12px 28px rgba(0, 0, 0, 0.18);--ec-unit-promotion-summary-padding:1rem 1.1rem;--ec-unit-promotion-summary-min-width:18rem;--ec-unit-promotion-summary-width:22rem;--ec-unit-promotion-summary-max-width:84vw;--ec-unit-promotion-summary-z-index:20;--ec-unit-promotion-row-color:#333333;--ec-unit-promotion-row-font-size:0.95rem;--ec-unit-promotion-row-line-height:1.35;--ec-unit-promotion-original-color:#c24a2a;--ec-unit-promotion-total-color:#16347a;--ec-unit-promotion-divider-color:#d9d9d9}.ec-unit-promotion-price{display:inline-flex;align-items:center}.ec-unit-promotion-price__detail{position:relative;display:inline-flex;flex-direction:column;align-items:flex-start}.ec-unit-promotion-price__current-wrapper{position:relative}.ec-unit-promotion-price__current{display:inline-flex;align-items:center;gap:var(--ec-unit-promotion-current-gap);color:var(--ec-unit-promotion-current-color);font-size:var(--ec-unit-promotion-current-font-size)}.ec-unit-promotion-price__current--clickable{cursor:pointer}.ec-unit-promotion-price__value{display:inline-flex}.ec-unit-promotion-price__current strong{font-weight:var(--ec-unit-promotion-current-font-weight)}.ec-unit-promotion-price__trigger{align-items:center;background:0 0;border:0;cursor:pointer;display:inline-flex;justify-content:center;padding:0}.ec-unit-promotion-price__icon{color:var(--ec-unit-promotion-icon-color);cursor:pointer;font-size:var(--ec-unit-promotion-icon-size);line-height:1}.ec-unit-promotion-price__summary{background:var(--ec-unit-promotion-summary-bg);box-shadow:var(--ec-unit-promotion-summary-shadow);min-width:var(--ec-unit-promotion-summary-min-width);padding:var(--ec-unit-promotion-summary-padding);position:absolute;right:0;top:calc(100% + .35rem);width:var(--ec-unit-promotion-summary-width);max-width:var(--ec-unit-promotion-summary-max-width);z-index:var(--ec-unit-promotion-summary-z-index)}.ec-unit-promotion-price__summary::before{background:var(--ec-unit-promotion-summary-bg);content:'';height:.9rem;position:absolute;right:.9rem;top:-.35rem;transform:rotate(45deg);width:.9rem}.ec-unit-promotion-price__summary--mobile{position:fixed;max-width:none;min-width:0;width:auto}.ec-unit-promotion-price__summary--mobile::before{display:none}.ec-unit-promotion-price__backdrop{background:0 0;border:0;inset:0;padding:0;position:fixed;z-index:calc(var(--ec-unit-promotion-summary-z-index) - 1)}.ec-unit-promotion-price__row{align-items:flex-start;color:var(--ec-unit-promotion-row-color);-moz-column-gap:.75rem;column-gap:.75rem;display:flex;font-size:var(--ec-unit-promotion-row-font-size);justify-content:space-between;line-height:var(--ec-unit-promotion-row-line-height)}.ec-unit-promotion-price__row+.ec-unit-promotion-price__row{margin-top:.65rem}.ec-unit-promotion-price__row span:first-child{flex:1 1 auto;font-weight:500}.ec-unit-promotion-price__row span:last-child{flex:0 0 auto;text-align:right;white-space:nowrap}.ec-unit-promotion-price__row--original{color:var(--ec-unit-promotion-original-color)}.ec-unit-promotion-price__row--final,.ec-unit-promotion-price__row--total{color:var(--ec-unit-promotion-total-color);font-weight:700}.ec-unit-promotion-price__divider{border-top:1px solid var(--ec-unit-promotion-divider-color);margin:.85rem 0}"]
|
|
23471
|
+
})
|
|
23472
|
+
/**
|
|
23473
|
+
* Renderiza el precio unitario final de un ítem con soporte para promociones unitarias.
|
|
23474
|
+
*
|
|
23475
|
+
* @remarks
|
|
23476
|
+
* Este componente resuelve la UX del precio neto con promociones unitarias:
|
|
23477
|
+
* - precio final unitario visible
|
|
23478
|
+
* - icono de información
|
|
23479
|
+
* - popover desktop/mobile con el desglose de descuentos
|
|
23480
|
+
*
|
|
23481
|
+
* El badge `% OFF` y el precio tachado legacy quedan fuera del componente
|
|
23482
|
+
* para que cada frontend pueda ubicarlos donde quiera.
|
|
23483
|
+
*
|
|
23484
|
+
* @example
|
|
23485
|
+
* ```html
|
|
23486
|
+
* <div class="price-block">
|
|
23487
|
+
* <div class="discount-badge" *ngIf="getItemDiscount(item) as discount">{{ discount }}% OFF</div>
|
|
23488
|
+
* <del *ngIf="shouldShowLegacyPriceOrigin(item)">{{ getStrikeThroughUnitPrice(item) | ecCurrencySymbol }}</del>
|
|
23489
|
+
* <app-unit-promotion-price-ec [item]="item" [mobile]="true"></app-unit-promotion-price-ec>
|
|
23490
|
+
* </div>
|
|
23491
|
+
* ```
|
|
23492
|
+
*/
|
|
23493
|
+
], UnitPromotionPriceEcComponent);
|
|
23494
|
+
return UnitPromotionPriceEcComponent;
|
|
23495
|
+
}());
|
|
23496
|
+
|
|
22686
23497
|
// //Component base
|
|
22687
23498
|
var components = [
|
|
22688
23499
|
BlockBannerBoxesEcComponent,
|
|
@@ -22725,6 +23536,7 @@
|
|
|
22725
23536
|
LoadingSectionEcComponent,
|
|
22726
23537
|
MPCreditEcComponent,
|
|
22727
23538
|
PriceEcComponent,
|
|
23539
|
+
UnitPromotionPriceEcComponent,
|
|
22728
23540
|
RedsysCatchEcComponent,
|
|
22729
23541
|
RedSysProEcComponent,
|
|
22730
23542
|
RedSysRedirectEcComponent,
|
|
@@ -22771,7 +23583,7 @@
|
|
|
22771
23583
|
SidebarEcComponent
|
|
22772
23584
|
];
|
|
22773
23585
|
|
|
22774
|
-
var __decorate$
|
|
23586
|
+
var __decorate$27 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
22775
23587
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22776
23588
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22777
23589
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -22878,16 +23690,16 @@
|
|
|
22878
23690
|
{ type: BlocksService },
|
|
22879
23691
|
{ type: router.Router }
|
|
22880
23692
|
]; };
|
|
22881
|
-
__decorate$
|
|
23693
|
+
__decorate$27([
|
|
22882
23694
|
core.Input()
|
|
22883
23695
|
], AddActionRedirectDirective.prototype, "ecAddActionRedirect", null);
|
|
22884
|
-
__decorate$
|
|
23696
|
+
__decorate$27([
|
|
22885
23697
|
core.Input()
|
|
22886
23698
|
], AddActionRedirectDirective.prototype, "classStrSpacing", null);
|
|
22887
|
-
__decorate$
|
|
23699
|
+
__decorate$27([
|
|
22888
23700
|
core.Input()
|
|
22889
23701
|
], AddActionRedirectDirective.prototype, "isTransparent", null);
|
|
22890
|
-
AddActionRedirectDirective = __decorate$
|
|
23702
|
+
AddActionRedirectDirective = __decorate$27([
|
|
22891
23703
|
core.Directive({
|
|
22892
23704
|
selector: "[ecAddActionRedirect]",
|
|
22893
23705
|
}),
|
|
@@ -22896,7 +23708,7 @@
|
|
|
22896
23708
|
return AddActionRedirectDirective;
|
|
22897
23709
|
}());
|
|
22898
23710
|
|
|
22899
|
-
var __decorate$
|
|
23711
|
+
var __decorate$28 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
22900
23712
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22901
23713
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22902
23714
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -22961,13 +23773,13 @@
|
|
|
22961
23773
|
{ type: core.TemplateRef },
|
|
22962
23774
|
{ type: core.ViewContainerRef }
|
|
22963
23775
|
]; };
|
|
22964
|
-
__decorate$
|
|
23776
|
+
__decorate$28([
|
|
22965
23777
|
core.Input()
|
|
22966
23778
|
], ProductStockDirective.prototype, "ecProductStockElse", void 0);
|
|
22967
|
-
__decorate$
|
|
23779
|
+
__decorate$28([
|
|
22968
23780
|
core.Input()
|
|
22969
23781
|
], ProductStockDirective.prototype, "ecProductStock", null);
|
|
22970
|
-
ProductStockDirective = __decorate$
|
|
23782
|
+
ProductStockDirective = __decorate$28([
|
|
22971
23783
|
core.Directive({
|
|
22972
23784
|
selector: "[ecProductStock]"
|
|
22973
23785
|
})
|
|
@@ -22975,7 +23787,7 @@
|
|
|
22975
23787
|
return ProductStockDirective;
|
|
22976
23788
|
}());
|
|
22977
23789
|
|
|
22978
|
-
var __decorate$
|
|
23790
|
+
var __decorate$29 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
22979
23791
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22980
23792
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22981
23793
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23116,16 +23928,16 @@
|
|
|
23116
23928
|
{ type: core.ElementRef },
|
|
23117
23929
|
{ type: core.Renderer2 }
|
|
23118
23930
|
]; };
|
|
23119
|
-
__decorate$
|
|
23931
|
+
__decorate$29([
|
|
23120
23932
|
core.Input()
|
|
23121
23933
|
], ProductOffDirective.prototype, "ecProductOff", null);
|
|
23122
|
-
__decorate$
|
|
23934
|
+
__decorate$29([
|
|
23123
23935
|
core.Input()
|
|
23124
23936
|
], ProductOffDirective.prototype, "classStrSpacing", null);
|
|
23125
|
-
__decorate$
|
|
23937
|
+
__decorate$29([
|
|
23126
23938
|
core.Input()
|
|
23127
23939
|
], ProductOffDirective.prototype, "customMessage", null);
|
|
23128
|
-
ProductOffDirective = __decorate$
|
|
23940
|
+
ProductOffDirective = __decorate$29([
|
|
23129
23941
|
core.Directive({
|
|
23130
23942
|
selector: "[ecProductOff]",
|
|
23131
23943
|
}),
|
|
@@ -23134,7 +23946,7 @@
|
|
|
23134
23946
|
return ProductOffDirective;
|
|
23135
23947
|
}());
|
|
23136
23948
|
|
|
23137
|
-
var __decorate$
|
|
23949
|
+
var __decorate$2a = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23138
23950
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23139
23951
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23140
23952
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23192,10 +24004,10 @@
|
|
|
23192
24004
|
{ type: core.Renderer2 },
|
|
23193
24005
|
{ type: Constants }
|
|
23194
24006
|
]; };
|
|
23195
|
-
__decorate$
|
|
24007
|
+
__decorate$2a([
|
|
23196
24008
|
core.Input()
|
|
23197
24009
|
], ProductMiniStandardDirective.prototype, "ecProductMiniStandard", null);
|
|
23198
|
-
ProductMiniStandardDirective = __decorate$
|
|
24010
|
+
ProductMiniStandardDirective = __decorate$2a([
|
|
23199
24011
|
core.Directive({
|
|
23200
24012
|
selector: '[ecProductMiniStandard]'
|
|
23201
24013
|
})
|
|
@@ -23203,7 +24015,7 @@
|
|
|
23203
24015
|
return ProductMiniStandardDirective;
|
|
23204
24016
|
}());
|
|
23205
24017
|
|
|
23206
|
-
var __decorate$
|
|
24018
|
+
var __decorate$2b = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23207
24019
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23208
24020
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23209
24021
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23246,13 +24058,13 @@
|
|
|
23246
24058
|
{ type: core.ViewContainerRef },
|
|
23247
24059
|
{ type: AuthService }
|
|
23248
24060
|
]; };
|
|
23249
|
-
__decorate$
|
|
24061
|
+
__decorate$2b([
|
|
23250
24062
|
core.Input()
|
|
23251
24063
|
], AuthWholesalerDirective.prototype, "ecAuthWholesalerElse", void 0);
|
|
23252
|
-
__decorate$
|
|
24064
|
+
__decorate$2b([
|
|
23253
24065
|
core.Input()
|
|
23254
24066
|
], AuthWholesalerDirective.prototype, "ecAuthWholesaler", null);
|
|
23255
|
-
AuthWholesalerDirective = __decorate$
|
|
24067
|
+
AuthWholesalerDirective = __decorate$2b([
|
|
23256
24068
|
core.Directive({
|
|
23257
24069
|
selector: "[ecAuthWholesaler]"
|
|
23258
24070
|
})
|
|
@@ -23260,7 +24072,7 @@
|
|
|
23260
24072
|
return AuthWholesalerDirective;
|
|
23261
24073
|
}());
|
|
23262
24074
|
|
|
23263
|
-
var __decorate$
|
|
24075
|
+
var __decorate$2c = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23264
24076
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23265
24077
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23266
24078
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23282,10 +24094,10 @@
|
|
|
23282
24094
|
{ type: core.TemplateRef },
|
|
23283
24095
|
{ type: core.ViewContainerRef }
|
|
23284
24096
|
]; };
|
|
23285
|
-
__decorate$
|
|
24097
|
+
__decorate$2c([
|
|
23286
24098
|
core.Input()
|
|
23287
24099
|
], ReloadViewDirective.prototype, "ecReloadView", void 0);
|
|
23288
|
-
ReloadViewDirective = __decorate$
|
|
24100
|
+
ReloadViewDirective = __decorate$2c([
|
|
23289
24101
|
core.Directive({
|
|
23290
24102
|
selector: '[ecReloadView]'
|
|
23291
24103
|
})
|
|
@@ -23308,7 +24120,7 @@
|
|
|
23308
24120
|
ReloadViewDirective,
|
|
23309
24121
|
];
|
|
23310
24122
|
|
|
23311
|
-
var __decorate$
|
|
24123
|
+
var __decorate$2d = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23312
24124
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23313
24125
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23314
24126
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23397,7 +24209,7 @@
|
|
|
23397
24209
|
{ type: CurrencyService },
|
|
23398
24210
|
{ type: core.Injector }
|
|
23399
24211
|
]; };
|
|
23400
|
-
ecCurrencySymbolPipe = __decorate$
|
|
24212
|
+
ecCurrencySymbolPipe = __decorate$2d([
|
|
23401
24213
|
core.Pipe({
|
|
23402
24214
|
name: 'ecCurrencySymbol',
|
|
23403
24215
|
pure: false
|
|
@@ -23406,7 +24218,7 @@
|
|
|
23406
24218
|
return ecCurrencySymbolPipe;
|
|
23407
24219
|
}());
|
|
23408
24220
|
|
|
23409
|
-
var __decorate$
|
|
24221
|
+
var __decorate$2e = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23410
24222
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23411
24223
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23412
24224
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23422,7 +24234,7 @@
|
|
|
23422
24234
|
EcSanitizerHtmlPipe.ctorParameters = function () { return [
|
|
23423
24235
|
{ type: platformBrowser.DomSanitizer }
|
|
23424
24236
|
]; };
|
|
23425
|
-
EcSanitizerHtmlPipe = __decorate$
|
|
24237
|
+
EcSanitizerHtmlPipe = __decorate$2e([
|
|
23426
24238
|
core.Pipe({
|
|
23427
24239
|
name: 'ecSanitizerHtml'
|
|
23428
24240
|
})
|
|
@@ -23430,7 +24242,7 @@
|
|
|
23430
24242
|
return EcSanitizerHtmlPipe;
|
|
23431
24243
|
}());
|
|
23432
24244
|
|
|
23433
|
-
var __decorate$
|
|
24245
|
+
var __decorate$2f = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23434
24246
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23435
24247
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23436
24248
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23446,7 +24258,7 @@
|
|
|
23446
24258
|
EcSanitizerUrlPipe.ctorParameters = function () { return [
|
|
23447
24259
|
{ type: platformBrowser.DomSanitizer }
|
|
23448
24260
|
]; };
|
|
23449
|
-
EcSanitizerUrlPipe = __decorate$
|
|
24261
|
+
EcSanitizerUrlPipe = __decorate$2f([
|
|
23450
24262
|
core.Pipe({
|
|
23451
24263
|
name: 'ecSanitizerUrl'
|
|
23452
24264
|
})
|
|
@@ -23461,7 +24273,7 @@
|
|
|
23461
24273
|
EcSanitizerUrlPipe
|
|
23462
24274
|
];
|
|
23463
24275
|
|
|
23464
|
-
var __decorate$
|
|
24276
|
+
var __decorate$2g = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23465
24277
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23466
24278
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23467
24279
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23548,7 +24360,7 @@
|
|
|
23548
24360
|
};
|
|
23549
24361
|
};
|
|
23550
24362
|
var NgEasycommerceModule_1;
|
|
23551
|
-
NgEasycommerceModule = NgEasycommerceModule_1 = __decorate$
|
|
24363
|
+
NgEasycommerceModule = NgEasycommerceModule_1 = __decorate$2g([
|
|
23552
24364
|
core.NgModule({
|
|
23553
24365
|
exports: [
|
|
23554
24366
|
OrderByPipe,
|
|
@@ -23589,7 +24401,7 @@
|
|
|
23589
24401
|
return NgEasycommerceModule;
|
|
23590
24402
|
}());
|
|
23591
24403
|
|
|
23592
|
-
var __decorate$
|
|
24404
|
+
var __decorate$2h = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23593
24405
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23594
24406
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23595
24407
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23637,7 +24449,7 @@
|
|
|
23637
24449
|
{ type: ConnectionService }
|
|
23638
24450
|
]; };
|
|
23639
24451
|
GiftCardService$1.ɵprov = core.ɵɵdefineInjectable({ factory: function GiftCardService_Factory() { return new GiftCardService(core.ɵɵinject(Constants), core.ɵɵinject(CartService), core.ɵɵinject(ConnectionService)); }, token: GiftCardService, providedIn: "root" });
|
|
23640
|
-
GiftCardService$1 = __decorate$
|
|
24452
|
+
GiftCardService$1 = __decorate$2h([
|
|
23641
24453
|
core.Injectable({
|
|
23642
24454
|
providedIn: 'root'
|
|
23643
24455
|
})
|
|
@@ -23645,7 +24457,7 @@
|
|
|
23645
24457
|
return GiftCardService$1;
|
|
23646
24458
|
}());
|
|
23647
24459
|
|
|
23648
|
-
var __decorate$
|
|
24460
|
+
var __decorate$2i = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23649
24461
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23650
24462
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23651
24463
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23701,7 +24513,7 @@
|
|
|
23701
24513
|
{ type: ngxToastr.ToastrService }
|
|
23702
24514
|
]; };
|
|
23703
24515
|
WishlistService$1.ɵprov = core.ɵɵdefineInjectable({ factory: function WishlistService_Factory() { return new WishlistService(core.ɵɵinject(ngxToastr.ToastrService)); }, token: WishlistService, providedIn: "root" });
|
|
23704
|
-
WishlistService$1 = __decorate$
|
|
24516
|
+
WishlistService$1 = __decorate$2i([
|
|
23705
24517
|
core.Injectable({
|
|
23706
24518
|
providedIn: 'root'
|
|
23707
24519
|
})
|
|
@@ -23709,7 +24521,7 @@
|
|
|
23709
24521
|
return WishlistService$1;
|
|
23710
24522
|
}());
|
|
23711
24523
|
|
|
23712
|
-
var __decorate$
|
|
24524
|
+
var __decorate$2j = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23713
24525
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23714
24526
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23715
24527
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -23744,7 +24556,7 @@
|
|
|
23744
24556
|
StandardReuseStrategy.ctorParameters = function () { return [
|
|
23745
24557
|
{ type: undefined, decorators: [{ type: core.Inject, args: ['env',] }] }
|
|
23746
24558
|
]; };
|
|
23747
|
-
StandardReuseStrategy = __decorate$
|
|
24559
|
+
StandardReuseStrategy = __decorate$2j([
|
|
23748
24560
|
core.Injectable(),
|
|
23749
24561
|
__param$e(0, core.Inject('env'))
|
|
23750
24562
|
], StandardReuseStrategy);
|
|
@@ -23875,6 +24687,7 @@
|
|
|
23875
24687
|
exports.SuccessEcComponent = SuccessEcComponent;
|
|
23876
24688
|
exports.ToastCookiesEcComponent = ToastCookiesEcComponent;
|
|
23877
24689
|
exports.ToastService = ToastService;
|
|
24690
|
+
exports.UnitPromotionPriceEcComponent = UnitPromotionPriceEcComponent;
|
|
23878
24691
|
exports.User = User;
|
|
23879
24692
|
exports.UserRoleGuardService = UserRoleGuardService;
|
|
23880
24693
|
exports.UtilsService = UtilsService;
|