ng-easycommerce 0.0.685 → 0.0.686
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 +11 -0
- package/bundles/ng-easycommerce.umd.js +811 -641
- 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/checkout-ec/checkout-ec.component.js +22 -9
- package/esm2015/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +18 -5
- package/esm2015/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.js +11 -6
- package/esm2015/lib/ec-component/checkout-ec/shipment-ec-single/shipment-ec-single.component.js +13 -4
- package/esm2015/lib/interfaces/shipping-option.js +1 -0
- package/esm2015/lib/services/checkout/checkout.service.js +25 -12
- package/esm2015/lib/services/checkout/shipment.service.js +36 -8
- package/esm2015/lib/utils/order-util.service.js +41 -1
- package/esm2015/lib/utils/shipping-price-display.service.js +47 -0
- package/esm2015/public-api.js +2 -1
- package/esm5/lib/ec-component/checkout-ec/checkout-ec.component.js +22 -9
- package/esm5/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +18 -5
- package/esm5/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.js +13 -6
- package/esm5/lib/ec-component/checkout-ec/shipment-ec-single/shipment-ec-single.component.js +13 -4
- package/esm5/lib/interfaces/shipping-option.js +1 -0
- package/esm5/lib/services/checkout/checkout.service.js +27 -12
- package/esm5/lib/services/checkout/shipment.service.js +40 -10
- package/esm5/lib/utils/order-util.service.js +41 -1
- package/esm5/lib/utils/shipping-price-display.service.js +51 -0
- package/esm5/public-api.js +2 -1
- package/fesm2015/ng-easycommerce.js +775 -616
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +811 -642
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-component/checkout-ec/checkout-ec.component.d.ts +5 -1
- package/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.d.ts +5 -1
- package/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.d.ts +4 -1
- package/lib/ec-component/checkout-ec/shipment-ec-single/shipment-ec-single.component.d.ts +4 -0
- package/lib/interfaces/shipping-option.d.ts +53 -0
- package/lib/services/checkout/shipment.service.d.ts +6 -1
- package/lib/utils/order-util.service.d.ts +20 -0
- package/lib/utils/shipping-price-display.service.d.ts +16 -0
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -12,6 +12,7 @@ import { ComponentHelper } from '../../classes/component-helper';
|
|
|
12
12
|
import { ChannelConfigService } from '../../services/channel-config.service';
|
|
13
13
|
import { CheckoutViewType, Constants } from '../../core.consts';
|
|
14
14
|
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
|
|
15
|
+
import { ShippingPriceDisplayService } from '../../utils/shipping-price-display.service';
|
|
15
16
|
export declare class CheckoutEcComponent extends ComponentHelper implements OnInit, AfterViewInit, OnDestroy {
|
|
16
17
|
checkoutService: CheckoutService;
|
|
17
18
|
toastrService: ToastService;
|
|
@@ -22,6 +23,7 @@ export declare class CheckoutEcComponent extends ComponentHelper implements OnIn
|
|
|
22
23
|
consts: Constants;
|
|
23
24
|
private elementRef;
|
|
24
25
|
private modalService;
|
|
26
|
+
private shippingPriceDisplay;
|
|
25
27
|
stepper: Stepper;
|
|
26
28
|
loadingSubject: BehaviorSubject<boolean>;
|
|
27
29
|
canCheckout: boolean;
|
|
@@ -59,7 +61,7 @@ export declare class CheckoutEcComponent extends ComponentHelper implements OnIn
|
|
|
59
61
|
private dataformComponents;
|
|
60
62
|
private paymentComponents;
|
|
61
63
|
private unsavedChangesModal;
|
|
62
|
-
constructor(checkoutService: CheckoutService, toastrService: ToastService, router: Router, cartService: CartService, productsService: ProductsService, channelService: ChannelConfigService, consts: Constants, elementRef: ElementRef, modalService: BsModalService);
|
|
64
|
+
constructor(checkoutService: CheckoutService, toastrService: ToastService, router: Router, cartService: CartService, productsService: ProductsService, channelService: ChannelConfigService, consts: Constants, elementRef: ElementRef, modalService: BsModalService, shippingPriceDisplay: ShippingPriceDisplayService);
|
|
63
65
|
ngOnInit(): void;
|
|
64
66
|
ngAfterViewInit(): void;
|
|
65
67
|
ngOnDestroy(): void;
|
|
@@ -94,6 +96,7 @@ export declare class CheckoutEcComponent extends ComponentHelper implements OnIn
|
|
|
94
96
|
isSectionOpen: (stepName: string) => boolean;
|
|
95
97
|
getSummaryLabel: (type: import("../../interfaces/checkout-data").CheckoutDataType) => "total" | "subtotal" | "shipment" | "coupon" | "discount" | "taxes" | "clientTaxes" | "national-taxes";
|
|
96
98
|
getSummaryData: (data: CheckoutData[]) => CheckoutData[];
|
|
99
|
+
getSummaryAmountView: (item: CheckoutData) => import("../../utils/shipping-price-display.service").ShippingPriceViewModel;
|
|
97
100
|
getTotalAmount: (data: CheckoutData[]) => number;
|
|
98
101
|
shouldShowSummaryItem: (item: CheckoutData) => boolean;
|
|
99
102
|
getAddressSummaryLabel: () => string;
|
|
@@ -102,6 +105,7 @@ export declare class CheckoutEcComponent extends ComponentHelper implements OnIn
|
|
|
102
105
|
label?: string;
|
|
103
106
|
detail?: string;
|
|
104
107
|
}) => void;
|
|
108
|
+
private getShipmentOriginalAmount;
|
|
105
109
|
private aggregateDiscounts;
|
|
106
110
|
private shouldHideSummarySubtotal;
|
|
107
111
|
private scrollToSection;
|
|
@@ -4,10 +4,12 @@ import { CheckoutData } from '../../../interfaces/checkout-data';
|
|
|
4
4
|
import { CheckoutService } from '../../../services/checkout/checkout.service';
|
|
5
5
|
import { CartService } from '../../../services/cart.service';
|
|
6
6
|
import { ChannelConfigService } from '../../../services/channel-config.service';
|
|
7
|
+
import { ShippingPriceDisplayService } from '../../../utils/shipping-price-display.service';
|
|
7
8
|
export declare class DetailCheckoutBlockEcComponent extends ComponentHelper implements OnInit {
|
|
8
9
|
checkoutService: CheckoutService;
|
|
9
10
|
private cartService;
|
|
10
11
|
channelConfigService: ChannelConfigService;
|
|
12
|
+
private shippingPriceDisplay;
|
|
11
13
|
asociatedData: any;
|
|
12
14
|
data: any;
|
|
13
15
|
discountTotal: number;
|
|
@@ -17,7 +19,7 @@ export declare class DetailCheckoutBlockEcComponent extends ComponentHelper impl
|
|
|
17
19
|
hideTaxes: boolean;
|
|
18
20
|
showTaxLegend: boolean;
|
|
19
21
|
clientTaxes: number;
|
|
20
|
-
constructor(checkoutService: CheckoutService, cartService: CartService, channelConfigService: ChannelConfigService);
|
|
22
|
+
constructor(checkoutService: CheckoutService, cartService: CartService, channelConfigService: ChannelConfigService, shippingPriceDisplay: ShippingPriceDisplayService);
|
|
21
23
|
ngOnInit(): void;
|
|
22
24
|
calcularTotales(): void;
|
|
23
25
|
getIcon: (data_item: CheckoutData) => "fas fa-ticket-alt fa-2x" | "fas fa-tags fa-2x" | "fas fa-shipping-fast fa-2x" | "fas fa-boxes fa-2x" | "fas fa-file-invoice-dollar fa-2x" | "fas fa-shopping-basket fa-2x";
|
|
@@ -25,4 +27,6 @@ export declare class DetailCheckoutBlockEcComponent extends ComponentHelper impl
|
|
|
25
27
|
getTypeLabel(type: string): string;
|
|
26
28
|
shouldShowItem(type: string): boolean;
|
|
27
29
|
shouldHideSubtotal(item: any): boolean;
|
|
30
|
+
getAmountView(item: CheckoutData): import("../../../utils/shipping-price-display.service").ShippingPriceViewModel;
|
|
31
|
+
private getShipmentOriginalAmount;
|
|
28
32
|
}
|
|
@@ -5,12 +5,14 @@ import { ShipmentService } from '../../../services/checkout/shipment.service';
|
|
|
5
5
|
import { ProductsService } from '../../../services/products/products.service';
|
|
6
6
|
import { ToastService } from '../../../utils/toast.service';
|
|
7
7
|
import { TranslateService } from '@ngx-translate/core';
|
|
8
|
+
import { ShippingPriceDisplayService } from '../../../utils/shipping-price-display.service';
|
|
8
9
|
export declare class ShipmentEcComponent extends ComponentHelper implements OnInit, OnChanges {
|
|
9
10
|
shipmentService: ShipmentService;
|
|
10
11
|
protected toastrService: ToastService;
|
|
11
12
|
productsService: ProductsService;
|
|
12
13
|
checkoutService: CheckoutService;
|
|
13
14
|
private translateService;
|
|
15
|
+
private shippingPriceDisplay;
|
|
14
16
|
step_id: any;
|
|
15
17
|
compactShipmentView: boolean;
|
|
16
18
|
summaryChange: EventEmitter<{
|
|
@@ -39,7 +41,7 @@ export declare class ShipmentEcComponent extends ComponentHelper implements OnIn
|
|
|
39
41
|
options: any[];
|
|
40
42
|
}[];
|
|
41
43
|
contracts: any[];
|
|
42
|
-
constructor(shipmentService: ShipmentService, toastrService: ToastService, productsService: ProductsService, checkoutService: CheckoutService, translateService: TranslateService);
|
|
44
|
+
constructor(shipmentService: ShipmentService, toastrService: ToastService, productsService: ProductsService, checkoutService: CheckoutService, translateService: TranslateService, shippingPriceDisplay: ShippingPriceDisplayService);
|
|
43
45
|
emitResult: (method_name: any, contract_data: any) => Promise<unknown>;
|
|
44
46
|
verifyValidate: (contract: any, data: any) => Promise<unknown>;
|
|
45
47
|
ngOnInit(): void;
|
|
@@ -53,6 +55,7 @@ export declare class ShipmentEcComponent extends ComponentHelper implements OnIn
|
|
|
53
55
|
private getLegacyContractData;
|
|
54
56
|
setActive(e: any): void;
|
|
55
57
|
validName: (name: any) => boolean;
|
|
58
|
+
getContractPriceView: (contract: any) => import("../../../utils/shipping-price-display.service").ShippingPriceViewModel;
|
|
56
59
|
private buildGroupedOptions;
|
|
57
60
|
private resolveGroupLabel;
|
|
58
61
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { ShippingPriceDisplayService } from '../../../utils/shipping-price-display.service';
|
|
2
3
|
export declare class ShipmentEcSingleComponent {
|
|
4
|
+
private shippingPriceDisplay;
|
|
3
5
|
loadingInternal: boolean;
|
|
4
6
|
loadingPreload: boolean;
|
|
5
7
|
singleOptions: any[];
|
|
@@ -14,8 +16,10 @@ export declare class ShipmentEcSingleComponent {
|
|
|
14
16
|
shipmentErrorKey: string | null;
|
|
15
17
|
isFreeShipping: boolean;
|
|
16
18
|
selectOption: EventEmitter<any>;
|
|
19
|
+
constructor(shippingPriceDisplay: ShippingPriceDisplayService);
|
|
17
20
|
getDetailLines(detail: string | undefined | null): string[];
|
|
18
21
|
getOptionTypeLabel(option: any): "" | "Retiro en sucursal" | "Envío a domicilio";
|
|
22
|
+
getOptionPriceView(option: any): import("../../../utils/shipping-price-display.service").ShippingPriceViewModel;
|
|
19
23
|
shouldHideContractName(option: any): boolean;
|
|
20
24
|
trackByGroup: (_: number, group: {
|
|
21
25
|
key: string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface ShippingPriceSource {
|
|
2
|
+
price?: number | string | null;
|
|
3
|
+
originalPrice?: number | string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface ShippingContractAddress {
|
|
6
|
+
street?: string;
|
|
7
|
+
number?: string | number;
|
|
8
|
+
province?: string;
|
|
9
|
+
city?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ShippingBranchProperty {
|
|
12
|
+
code?: string;
|
|
13
|
+
number?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
address?: ShippingContractAddress;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export interface ShippingOptionContract extends ShippingPriceSource {
|
|
19
|
+
name?: string;
|
|
20
|
+
contract?: string;
|
|
21
|
+
selected?: boolean;
|
|
22
|
+
branch_property?: ShippingBranchProperty;
|
|
23
|
+
shipping_method_contract?: string;
|
|
24
|
+
shipping_method_branch_code?: string;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface ShippingOptionEntry {
|
|
28
|
+
name?: string;
|
|
29
|
+
contracts?: ShippingOptionContract[];
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export interface ShippingMethodEntry {
|
|
33
|
+
id?: number;
|
|
34
|
+
code?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
price?: {
|
|
38
|
+
current?: number | string | null;
|
|
39
|
+
};
|
|
40
|
+
trackingUrl?: string;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
export interface ShippingMethodsGroup {
|
|
44
|
+
method?: ShippingMethodEntry;
|
|
45
|
+
options?: ShippingOptionEntry[];
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
48
|
+
export interface ShippingOptionsResponse {
|
|
49
|
+
shipments?: Array<{
|
|
50
|
+
methods?: Record<string, ShippingMethodsGroup>;
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
}>;
|
|
53
|
+
}
|
|
@@ -8,9 +8,11 @@ import { StoresService } from '../stores.service';
|
|
|
8
8
|
import { CheckoutService } from './checkout.service';
|
|
9
9
|
import { StepService } from '../../classes/checkout/step-service';
|
|
10
10
|
import { AnalyticsService } from '../analytics.service';
|
|
11
|
+
import { ShippingPriceDisplayService } from '../../utils/shipping-price-display.service';
|
|
11
12
|
export declare class ShipmentService extends StepService {
|
|
12
13
|
private connection;
|
|
13
14
|
private transformer;
|
|
15
|
+
private shippingPriceDisplay;
|
|
14
16
|
private analyticsService;
|
|
15
17
|
private consts;
|
|
16
18
|
private cartService;
|
|
@@ -39,7 +41,7 @@ export declare class ShipmentService extends StepService {
|
|
|
39
41
|
putShipmentApi: () => string;
|
|
40
42
|
putContractApi: () => string;
|
|
41
43
|
calculatedCostsApi: () => string;
|
|
42
|
-
constructor(connection: ConnectionService, transformer: ShipmentDataTransformer, analyticsService: AnalyticsService, consts: Constants, cartService: CartService, storesService: StoresService, checkoutService: CheckoutService);
|
|
44
|
+
constructor(connection: ConnectionService, transformer: ShipmentDataTransformer, shippingPriceDisplay: ShippingPriceDisplayService, analyticsService: AnalyticsService, consts: Constants, cartService: CartService, storesService: StoresService, checkoutService: CheckoutService);
|
|
43
45
|
getShipmentMethods: () => Promise<any[]>;
|
|
44
46
|
getShippingOptions: () => Promise<any[]>;
|
|
45
47
|
setMethod: (method: any) => Promise<void>;
|
|
@@ -49,6 +51,7 @@ export declare class ShipmentService extends StepService {
|
|
|
49
51
|
option: string;
|
|
50
52
|
contract: string;
|
|
51
53
|
price: number;
|
|
54
|
+
originalPrice?: number;
|
|
52
55
|
}, stepData?: any) => Promise<boolean>;
|
|
53
56
|
private putShipment;
|
|
54
57
|
getCalculatedCosts: () => Promise<any>;
|
|
@@ -65,6 +68,8 @@ export declare class ShipmentService extends StepService {
|
|
|
65
68
|
responseToList: (response: any) => any[];
|
|
66
69
|
responseToShippingOptions: (response: any) => any[];
|
|
67
70
|
private normalizeShippingOptions;
|
|
71
|
+
private normalizeShippingContract;
|
|
72
|
+
private stripFrontendOnlyShippingFields;
|
|
68
73
|
otherParamsForContract: (contract: any) => {
|
|
69
74
|
shipping_method_contract: any;
|
|
70
75
|
shipping_method_branch_code: any;
|
|
@@ -18,6 +18,18 @@ export declare class OrderUtilityService {
|
|
|
18
18
|
* A diferencia de `getPromotions`, este método solo considera descuentos de orden.
|
|
19
19
|
*/
|
|
20
20
|
getSummaryPromotions: (cart: any, forCart?: boolean) => CheckoutData[];
|
|
21
|
+
/**
|
|
22
|
+
* Devuelve el monto de envío que debe mostrarse en el resumen.
|
|
23
|
+
*
|
|
24
|
+
* @param cart Carrito u orden con `totals`.
|
|
25
|
+
* @returns `number` cuando el envío debe mostrarse, o `null` cuando no corresponde renderizarlo.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* - Si el backend informa un shipping distinto de cero, ese valor se muestra tal cual.
|
|
29
|
+
* - Si `totals.shipping` es `0` pero existe una promoción de envío, se muestra `0` para que la UI lo interprete como gratis.
|
|
30
|
+
* - Si no hay datos suficientes, se devuelve `null` y se conserva el comportamiento previo de no mostrar la línea.
|
|
31
|
+
*/
|
|
32
|
+
getSummaryShipmentAmount: (cart: any) => number;
|
|
21
33
|
/**
|
|
22
34
|
* Obtiene el monto de descuento que corresponde al resumen de la orden.
|
|
23
35
|
*
|
|
@@ -52,6 +64,13 @@ export declare class OrderUtilityService {
|
|
|
52
64
|
* Un cupón puede afectar promociones unitarias y dejar `orderPromotions = 0`.
|
|
53
65
|
*/
|
|
54
66
|
hasAppliedCoupon: (cart: any) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Indica si el carrito tiene una promoción asociada al envío.
|
|
69
|
+
*
|
|
70
|
+
* @param cart Carrito actual.
|
|
71
|
+
* @returns `true` cuando alguna línea de descuento corresponde a shipping.
|
|
72
|
+
*/
|
|
73
|
+
hasShippingPromotion: (cart: any) => boolean;
|
|
55
74
|
/**
|
|
56
75
|
* Devuelve el monto efectivo de una línea de descuento/promoción.
|
|
57
76
|
*
|
|
@@ -67,4 +86,5 @@ export declare class OrderUtilityService {
|
|
|
67
86
|
* @returns Tipo normalizado consumido por los componentes del core.
|
|
68
87
|
*/
|
|
69
88
|
formatType: (type: string) => CheckoutDataType;
|
|
89
|
+
private normalizeAmount;
|
|
70
90
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ShippingPriceSource } from '../interfaces/shipping-option';
|
|
2
|
+
export interface ShippingPriceViewModel {
|
|
3
|
+
finalPrice: number | null;
|
|
4
|
+
originalPrice: number | null;
|
|
5
|
+
hasFinalPrice: boolean;
|
|
6
|
+
hasOriginalPrice: boolean;
|
|
7
|
+
hasDiscount: boolean;
|
|
8
|
+
isFree: boolean;
|
|
9
|
+
showOriginalPrice: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class ShippingPriceDisplayService {
|
|
12
|
+
normalizePriceValue: (value: string | number) => number;
|
|
13
|
+
getContractView: (contract: ShippingPriceSource) => ShippingPriceViewModel;
|
|
14
|
+
getAmountView: (amount: string | number) => ShippingPriceViewModel;
|
|
15
|
+
buildViewModel: (price: string | number, originalPrice: string | number) => ShippingPriceViewModel;
|
|
16
|
+
}
|