ng-easycommerce 0.1.1 → 1.1.3

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.
Files changed (115) hide show
  1. package/README.md +14 -0
  2. package/assets/ec-i18n/ct.json +4 -0
  3. package/assets/ec-i18n/en.json +4 -0
  4. package/assets/ec-i18n/es.json +4 -0
  5. package/assets/ec-i18n/fr.json +4 -0
  6. package/assets/ec-i18n/gl.json +4 -0
  7. package/assets/ec-i18n/pr.json +4 -0
  8. package/bundles/ng-easycommerce.umd.js +5191 -3521
  9. package/bundles/ng-easycommerce.umd.js.map +1 -1
  10. package/bundles/ng-easycommerce.umd.min.js +1 -1
  11. package/bundles/ng-easycommerce.umd.min.js.map +1 -1
  12. package/esm2015/lib/api/connection.service.js +2 -2
  13. package/esm2015/lib/core.consts.js +4 -5
  14. package/esm2015/lib/ec-component/account-ec/order-ec/order-ec.component.js +2 -2
  15. package/esm2015/lib/ec-component/cart-bootstrap-navigation.js +27 -0
  16. package/esm2015/lib/ec-component/cart-ec/cart-ec.component.js +11 -1
  17. package/esm2015/lib/ec-component/checkout-ec/checkout-ec.component.js +28 -3
  18. package/esm2015/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +185 -13
  19. package/esm2015/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +6 -2
  20. package/esm2015/lib/ec-component/checkout-ec/payment-ec/payment-ec.component.js +26 -9
  21. package/esm2015/lib/ec-component/checkout-ec/payment-ec-single/payment-ec-single.component.js +11 -3
  22. package/esm2015/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.js +4 -2
  23. package/esm2015/lib/ec-component/coupon-ec/coupon-ec.component.js +6 -1
  24. package/esm2015/lib/guards/able-buyer-guard.service.js +2 -2
  25. package/esm2015/lib/guards/auth-guard.service.js +2 -2
  26. package/esm2015/lib/guards/checkout-ready.service.js +3 -3
  27. package/esm2015/lib/guards/loggedin-guard.service.js +2 -2
  28. package/esm2015/lib/guards/user-role-guard.service.js +2 -2
  29. package/esm2015/lib/interfaces/checkout-data.js +1 -1
  30. package/esm2015/lib/services/account/orders.service.js +6 -4
  31. package/esm2015/lib/services/auth.service.js +4 -3
  32. package/esm2015/lib/services/captcha.service.js +6 -4
  33. package/esm2015/lib/services/cart.service.js +1194 -74
  34. package/esm2015/lib/services/channel-config.service.js +4 -6
  35. package/esm2015/lib/services/checkout/addressing.service.js +65 -9
  36. package/esm2015/lib/services/checkout/checkout.service.js +58 -9
  37. package/esm2015/lib/services/checkout/error-handler.service.js +4 -3
  38. package/esm2015/lib/services/checkout/payment.service.js +35 -15
  39. package/esm2015/lib/services/checkout/shipment.service.js +54 -3
  40. package/esm2015/lib/services/concatenated-associations.service.js +4 -3
  41. package/esm2015/lib/services/currency.service.js +5 -3
  42. package/esm2015/lib/services/filters.service.js +2 -2
  43. package/esm2015/lib/services/footer/footer.service.js +4 -3
  44. package/esm2015/lib/services/gift-card.service.js +56 -5
  45. package/esm2015/lib/services/parameters.service.js +5 -3
  46. package/esm2015/lib/services/reviews.service.js +5 -4
  47. package/esm2015/lib/services/seo.service.js +4 -5
  48. package/esm2015/lib/services/stores.service.js +4 -3
  49. package/esm2015/lib/services/wishlist.service.js +3 -4
  50. package/esm2015/lib/utils/analytics/google-analytics.service.js +1 -1
  51. package/esm2015/lib/utils/order-util.service.js +22 -2
  52. package/esm2015/lib/utils/price-presentation.service.js +2 -3
  53. package/esm2015/lib/utils/shipping-price-display.service.js +2 -3
  54. package/esm5/lib/api/connection.service.js +2 -2
  55. package/esm5/lib/core.consts.js +4 -5
  56. package/esm5/lib/ec-component/account-ec/order-ec/order-ec.component.js +2 -2
  57. package/esm5/lib/ec-component/cart-bootstrap-navigation.js +27 -0
  58. package/esm5/lib/ec-component/cart-ec/cart-ec.component.js +11 -1
  59. package/esm5/lib/ec-component/checkout-ec/checkout-ec.component.js +28 -3
  60. package/esm5/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +206 -12
  61. package/esm5/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +6 -2
  62. package/esm5/lib/ec-component/checkout-ec/payment-ec/payment-ec.component.js +31 -14
  63. package/esm5/lib/ec-component/checkout-ec/payment-ec-single/payment-ec-single.component.js +11 -3
  64. package/esm5/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.js +5 -3
  65. package/esm5/lib/ec-component/coupon-ec/coupon-ec.component.js +6 -1
  66. package/esm5/lib/guards/able-buyer-guard.service.js +2 -2
  67. package/esm5/lib/guards/auth-guard.service.js +2 -2
  68. package/esm5/lib/guards/checkout-ready.service.js +3 -3
  69. package/esm5/lib/guards/loggedin-guard.service.js +2 -2
  70. package/esm5/lib/guards/user-role-guard.service.js +2 -2
  71. package/esm5/lib/interfaces/checkout-data.js +1 -1
  72. package/esm5/lib/services/account/orders.service.js +6 -4
  73. package/esm5/lib/services/auth.service.js +4 -3
  74. package/esm5/lib/services/captcha.service.js +6 -4
  75. package/esm5/lib/services/cart.service.js +1243 -94
  76. package/esm5/lib/services/channel-config.service.js +4 -6
  77. package/esm5/lib/services/checkout/addressing.service.js +65 -9
  78. package/esm5/lib/services/checkout/checkout.service.js +65 -13
  79. package/esm5/lib/services/checkout/error-handler.service.js +4 -3
  80. package/esm5/lib/services/checkout/payment.service.js +29 -11
  81. package/esm5/lib/services/checkout/shipment.service.js +58 -7
  82. package/esm5/lib/services/concatenated-associations.service.js +4 -3
  83. package/esm5/lib/services/currency.service.js +5 -3
  84. package/esm5/lib/services/filters.service.js +2 -2
  85. package/esm5/lib/services/footer/footer.service.js +4 -3
  86. package/esm5/lib/services/gift-card.service.js +59 -5
  87. package/esm5/lib/services/parameters.service.js +5 -3
  88. package/esm5/lib/services/reviews.service.js +5 -4
  89. package/esm5/lib/services/seo.service.js +4 -5
  90. package/esm5/lib/services/stores.service.js +4 -3
  91. package/esm5/lib/services/wishlist.service.js +3 -4
  92. package/esm5/lib/utils/analytics/google-analytics.service.js +1 -1
  93. package/esm5/lib/utils/order-util.service.js +22 -2
  94. package/esm5/lib/utils/price-presentation.service.js +2 -3
  95. package/esm5/lib/utils/shipping-price-display.service.js +2 -3
  96. package/fesm2015/ng-easycommerce.js +4360 -2745
  97. package/fesm2015/ng-easycommerce.js.map +1 -1
  98. package/fesm5/ng-easycommerce.js +5193 -3523
  99. package/fesm5/ng-easycommerce.js.map +1 -1
  100. package/lib/ec-component/cart-bootstrap-navigation.d.ts +7 -0
  101. package/lib/ec-component/cart-ec/cart-ec.component.d.ts +5 -2
  102. package/lib/ec-component/checkout-ec/checkout-ec.component.d.ts +6 -1
  103. package/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.d.ts +27 -3
  104. package/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.d.ts +1 -1
  105. package/lib/ec-component/checkout-ec/payment-ec/payment-ec.component.d.ts +3 -0
  106. package/lib/ec-component/checkout-ec/payment-ec-single/payment-ec-single.component.d.ts +3 -0
  107. package/lib/interfaces/checkout-data.d.ts +6 -1
  108. package/lib/services/cart.service.d.ts +123 -7
  109. package/lib/services/checkout/addressing.service.d.ts +1 -1
  110. package/lib/services/checkout/checkout.service.d.ts +3 -0
  111. package/lib/services/checkout/shipment.service.d.ts +2 -2
  112. package/lib/services/gift-card.service.d.ts +1 -0
  113. package/lib/utils/order-util.service.d.ts +1 -0
  114. package/ng-easycommerce.metadata.json +1 -1
  115. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ export declare type CartBootstrapRecoveryRoute = 'cart' | 'checkout' | null;
2
+ /** Identifica las rutas del core que deben salir al inicio tras reemplazar un token inactivo. */
3
+ export declare const cartBootstrapRecoveryRoute: (url: string) => CartBootstrapRecoveryRoute;
4
+ /** Ejecuta la navegación solo desde la ruta core correspondiente al consumidor. */
5
+ export declare const navigateHomeAfterCartBootstrapRecovery: (url: string, expectedRoute: CartBootstrapRecoveryRoute, consumeRecovery: () => boolean, navigateHome: () => any) => boolean;
6
+ /** Invalida el estado local y sale únicamente de una ruta de checkout. */
7
+ export declare const handleInvalidatedCheckoutNavigation: (url: string, invalidateCheckout: () => void, navigateHome: () => any) => boolean;
@@ -1,4 +1,4 @@
1
- import { OnInit, TemplateRef } from "@angular/core";
1
+ import { OnInit, OnDestroy, TemplateRef } from "@angular/core";
2
2
  import { Router } from "@angular/router";
3
3
  import { BsModalService } from "ngx-bootstrap/modal";
4
4
  import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
@@ -12,7 +12,7 @@ import { Observable } from "rxjs";
12
12
  import { AddressingService } from '../../services/checkout/addressing.service';
13
13
  import { ChannelConfigService } from '../../services/channel-config.service';
14
14
  import { SeoService } from '../../services/seo.service';
15
- export declare class CartEcComponent extends ComponentHelper implements OnInit {
15
+ export declare class CartEcComponent extends ComponentHelper implements OnInit, OnDestroy {
16
16
  cartService: CartService;
17
17
  authService: AuthService;
18
18
  protected consts: Constants;
@@ -48,10 +48,13 @@ export declare class CartEcComponent extends ComponentHelper implements OnInit {
48
48
  [key: string]: string;
49
49
  };
50
50
  supportsUnitPromotionHover: boolean;
51
+ private cartBootstrapRecoverySubscription;
52
+ private handleCartBootstrapRecovery;
51
53
  constructor(cartService: CartService, authService: AuthService, consts: Constants, productsService: ProductsService, router: Router, modalService: BsModalService, toastrService: ToastService, addressingService: AddressingService, channelConfigService: ChannelConfigService, seo: SeoService);
52
54
  ngOnChanges(): void;
53
55
  updateLoggedIn(): void;
54
56
  ngOnInit(): void;
57
+ ngOnDestroy(): void;
55
58
  private updateCartSeo;
56
59
  /**
57
60
  * Convierte un monto crudo al formato decimal esperado por la UI.
@@ -44,6 +44,11 @@ export declare class CheckoutEcComponent extends ComponentHelper implements OnIn
44
44
  private paymentAutoOpened;
45
45
  private autoClosedSteps;
46
46
  private manuallyOpenedSteps;
47
+ private cartBootstrapRecoverySubscription;
48
+ private cartCheckoutInvalidationSubscription;
49
+ private checkoutInvalidationHandled;
50
+ private handleCartBootstrapRecovery;
51
+ private handleCartCheckoutInvalidation;
47
52
  hideTaxes: boolean;
48
53
  showTaxLegend: boolean;
49
54
  shipmentSummary: {
@@ -97,7 +102,7 @@ export declare class CheckoutEcComponent extends ComponentHelper implements OnIn
97
102
  goToNextSection: (stepName: string) => void;
98
103
  goToNextFromAddress: () => void;
99
104
  isSectionOpen: (stepName: string) => boolean;
100
- getSummaryLabel: (type: import("../../interfaces/checkout-data").CheckoutDataType, item?: CheckoutData) => "total" | "subtotal" | "shipment" | "coupon" | "discount" | "taxes" | "clientTaxes" | "products-before-discounts" | "line-discounts" | "taxes-included-in-total" | "national-taxes";
105
+ getSummaryLabel: (type: import("../../interfaces/checkout-data").CheckoutDataType, item?: CheckoutData) => "total" | "subtotal" | "shipment" | "coupon" | "discount" | "taxes" | "clientTaxes" | "products-before-discounts" | "line-discounts" | "payment-method-discount" | "payment-method-surcharge" | "taxes-included-in-total" | "national-taxes";
101
106
  getSummaryData: (data: CheckoutData[]) => CheckoutData[];
102
107
  getSummaryAmountView: (item: CheckoutData) => import("../../utils/shipping-price-display.service").ShippingPriceViewModel;
103
108
  getTotalAmount: (data: CheckoutData[]) => number;
@@ -1,4 +1,4 @@
1
- import { EventEmitter, OnInit, TemplateRef } from '@angular/core';
1
+ import { EventEmitter, OnInit, OnDestroy, TemplateRef } from '@angular/core';
2
2
  import { FormBuilder, FormGroup } from '@angular/forms';
3
3
  import { BehaviorSubject } from 'rxjs';
4
4
  import { ComponentHelper } from '../../../classes/component-helper';
@@ -13,7 +13,7 @@ import { ParametersService } from '../../../services/parameters.service';
13
13
  import { ChannelConfigService } from '../../../services/channel-config.service';
14
14
  import { CheckoutService } from '../../../services/checkout/checkout.service';
15
15
  import { OrderUtilityService } from '../../../utils/order-util.service';
16
- export declare class DataFormEcComponent extends ComponentHelper implements OnInit {
16
+ export declare class DataFormEcComponent extends ComponentHelper implements OnInit, OnDestroy {
17
17
  authService: AuthService;
18
18
  fb: FormBuilder;
19
19
  toast: ToastService;
@@ -78,15 +78,36 @@ export declare class DataFormEcComponent extends ComponentHelper implements OnIn
78
78
  documentErrorMessage: string;
79
79
  documentErrorMessageFacturacion: string;
80
80
  customerHasCustomerTaxRate: boolean;
81
+ checkoutLoginPending: boolean;
82
+ checkoutLoginAddressSelectionRequired: boolean;
83
+ checkoutLoginAddressBookLoading: boolean;
84
+ checkoutLoginAddressBookLoadFailed: boolean;
81
85
  documentTypeDropdownOpen: boolean;
82
86
  documentTypeFactDropdownOpen: boolean;
83
87
  private lastSavedState;
84
88
  private isDirty;
85
89
  private suppressDirty;
86
90
  private addressSyncedForCompletion;
91
+ private checkoutLoginAttemptId;
92
+ private checkoutLoginSessionToken;
93
+ private checkoutLoginSessionEmail;
94
+ private checkoutLoginSubscription;
95
+ private checkoutLoginAuthSubscription;
96
+ private addressBookRequestId;
97
+ private destroyed$;
87
98
  private lastSummaryTotalsSnapshot;
88
99
  constructor(authService: AuthService, fb: FormBuilder, toast: ToastService, addressingService: AddressingService, cartService: CartService, checkoutService: CheckoutService, orderUtils: OrderUtilityService, modalService: BsModalService, paramsService: ParametersService, consts: Constants, channelConfig: ChannelConfigService);
89
100
  ngOnInit(): void;
101
+ ngOnDestroy(): void;
102
+ /** Espera el resumen autenticado antes de reutilizar una dirección ingresada como invitado. */
103
+ handleCheckoutLogin: (email: string) => void;
104
+ showNewAddressOptionDuringLogin: () => boolean;
105
+ private isNewAddressCreationBlocked;
106
+ retryCheckoutLoginAddressBook: () => void;
107
+ private getAuthenticatedEmail;
108
+ private isCheckoutLoginSessionCurrent;
109
+ private cancelCheckoutLoginWait;
110
+ private loadCheckoutLoginAddressBook;
90
111
  /**
91
112
  * @description filtra los paises de acuerdo al a los codigos retornados en la funcion getCountries.
92
113
  * Casos de usos: Si getCountries es vacio, retorna el arreglo que ingresa por parametro.
@@ -132,7 +153,7 @@ export declare class DataFormEcComponent extends ComponentHelper implements OnIn
132
153
  updatePostalCodeValidationFacturacion(selectedCountry: any): void;
133
154
  updateDocumentValidation(selectedDocumentType: any): void;
134
155
  updateDocumentValidationFacturacion(selectedDocumentType: any): void;
135
- selectAddress: (items: any, showNotesError?: boolean) => Promise<void>;
156
+ selectAddress: (items: any, showNotesError?: boolean, explicitConfirmation?: boolean) => Promise<void>;
136
157
  getMode: () => boolean;
137
158
  setMode: (mode: any) => void;
138
159
  getModeFacturacion: () => boolean;
@@ -146,6 +167,8 @@ export declare class DataFormEcComponent extends ComponentHelper implements OnIn
146
167
  toggleAddressDropdown: () => void;
147
168
  selectAddressFromDropdown: (address: any) => void;
148
169
  onSelectionNotesChange: () => void;
170
+ requiresExplicitAddressConfirmation: () => boolean;
171
+ confirmAddressStep: () => Promise<void>;
149
172
  getSelectedAddressLabel: () => any;
150
173
  getAddressOptionLabel: (address: any) => string;
151
174
  getDefaultSelectedLabel: () => any;
@@ -160,6 +183,7 @@ export declare class DataFormEcComponent extends ComponentHelper implements OnIn
160
183
  private applySelectedAddress;
161
184
  private setCheckoutFormReadonly;
162
185
  private shouldAutoSelectAddress;
186
+ private isAddressSelectionNotesRequired;
163
187
  private addTemporaryAddressFromForm;
164
188
  private removeTemporaryAddress;
165
189
  private buildCurrentState;
@@ -22,7 +22,7 @@ export declare class DetailCheckoutBlockEcComponent extends ComponentHelper impl
22
22
  constructor(checkoutService: CheckoutService, cartService: CartService, channelConfigService: ChannelConfigService, shippingPriceDisplay: ShippingPriceDisplayService);
23
23
  ngOnInit(): void;
24
24
  calcularTotales(): void;
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
+ 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-credit-card fa-2x" | "fas fa-shopping-basket fa-2x";
26
26
  getIcon2: (data_type: any) => "fas fa-ticket-alt fa-2x" | "fas fa-tags fa-2x" | "fas fa-percent fa-2x";
27
27
  getTypeLabel(type: string, item?: CheckoutData): string;
28
28
  shouldShowItem(type: string, item?: CheckoutData): boolean;
@@ -2,6 +2,7 @@ import { Renderer2, ElementRef, OnChanges, OnInit, EventEmitter } from '@angular
2
2
  import { Router } from '@angular/router';
3
3
  import { BehaviorSubject } from 'rxjs';
4
4
  import { ComponentHelper } from '../../../classes/component-helper';
5
+ import { PaymentMethodAdjustmentPreview } from '../../../interfaces/checkout-data';
5
6
  import { CheckoutService } from '../../../services/checkout/checkout.service';
6
7
  import { PaymentService } from '../../../services/checkout/payment.service';
7
8
  import { ToastService } from '../../../utils/toast.service';
@@ -57,6 +58,8 @@ export declare class PaymentEcComponent extends ComponentHelper implements OnCha
57
58
  setLoading: (estado?: boolean) => boolean;
58
59
  verifyValidate: () => void;
59
60
  setMethod: (method: any) => Promise<void>;
61
+ getPaymentMethodAdjustmentPreview: (method: any) => PaymentMethodAdjustmentPreview;
62
+ getPaymentMethodAdjustmentPreviewSign: (value: number) => "" | "+";
60
63
  private setDirtyState;
61
64
  private setSavedMethodCode;
62
65
  private evaluateDirtyForSelection;
@@ -1,4 +1,5 @@
1
1
  import { EventEmitter } from '@angular/core';
2
+ import { PaymentMethodAdjustmentPreview } from '../../../interfaces/checkout-data';
2
3
  export declare class PaymentEcSingleComponent {
3
4
  loadingInternal: boolean;
4
5
  loadingInternalMp: boolean;
@@ -10,6 +11,8 @@ export declare class PaymentEcSingleComponent {
10
11
  balanceMethodRejected: boolean;
11
12
  methods: any[];
12
13
  totalAmount: number | null;
14
+ getPaymentMethodAdjustmentPreview: (method: any) => PaymentMethodAdjustmentPreview | null;
15
+ getPaymentMethodAdjustmentPreviewSign: (value: number) => '+' | '';
13
16
  isMethodDisabled: (method: any) => boolean;
14
17
  isMP: (code: string) => boolean;
15
18
  isMPTarjetaDeCredito: (code: string) => boolean;
@@ -1,4 +1,9 @@
1
- export declare type CheckoutDataType = 'total' | 'subtotal' | 'productsBeforeDiscounts' | 'shipment' | 'coupon' | 'discount' | 'lineDiscount' | 'taxes' | 'clientTaxes';
1
+ export declare type CheckoutDataType = 'total' | 'subtotal' | 'productsBeforeDiscounts' | 'shipment' | 'coupon' | 'discount' | 'paymentMethodAdjustment' | 'lineDiscount' | 'taxes' | 'clientTaxes';
2
+ export declare type PaymentMethodChargeType = 'percentage' | 'fixed';
3
+ export interface PaymentMethodAdjustmentPreview {
4
+ type: PaymentMethodChargeType;
5
+ value: number;
6
+ }
2
7
  export interface CheckoutData {
3
8
  type: CheckoutDataType;
4
9
  amount: number;
@@ -1,6 +1,7 @@
1
+ import { OnDestroy } from '@angular/core';
1
2
  import { Product } from '../interfaces/product';
2
3
  import { CartItem, CartItemPricing } from '../interfaces/cart-item';
3
- import { Observable } from 'rxjs';
4
+ import { Observable, Subscription } from 'rxjs';
4
5
  import { ConnectionService } from '../api/connection.service';
5
6
  import { Constants } from '../core.consts';
6
7
  import { AuthService } from './auth.service';
@@ -9,11 +10,26 @@ import { OrderUtilityService } from '../utils/order-util.service';
9
10
  import { CheckoutData } from '../interfaces/checkout-data';
10
11
  import { CartAffordable } from '../interfaces/cart/cart-affordable';
11
12
  import { ChannelConfigService } from './channel-config.service';
12
- import { AnalyticsService } from '../../public-api';
13
+ import { AnalyticsService } from './analytics.service';
13
14
  import { Router } from '@angular/router';
14
15
  import { Channel } from '../interfaces/channel';
15
16
  import { CartItemPricePresentation, CartSummaryPricePresentation, PricePresentationService } from '../utils/price-presentation.service';
16
- export declare class CartService {
17
+ export interface CartResponseContext {
18
+ token: string | null;
19
+ generation: number;
20
+ requestId: number;
21
+ allowTokenChange: boolean;
22
+ }
23
+ export declare type CartSyncStatus = 'ready' | 'syncing' | 'invalidated' | 'error' | 'authentication-changed';
24
+ export interface CartSyncState {
25
+ status: CartSyncStatus;
26
+ reason?: 'checkout-interrupted' | 'network' | 'server' | 'token-unavailable' | 'authentication' | 'invalid-response' | 'cart-not-active';
27
+ }
28
+ export interface CartCheckoutInvalidation {
29
+ transitionId: string;
30
+ reason: 'checkout-completed' | 'cart-not-active';
31
+ }
32
+ export declare class CartService implements OnDestroy {
17
33
  private connection;
18
34
  private toastrService;
19
35
  private consts;
@@ -27,9 +43,17 @@ export declare class CartService {
27
43
  private couponSubject;
28
44
  private cartSubject;
29
45
  private requestInProcess;
46
+ private cartSyncStateSubject;
30
47
  private promotionsSubject;
48
+ private cartBootstrapRecoverySubject;
49
+ private cartCheckoutInvalidationSubject;
31
50
  private balanceCustomerSubject;
32
51
  private items;
52
+ private pendingBootstrapCartAdds;
53
+ private readonly maxPendingBootstrapCartAdds;
54
+ private pendingBootstrapCartAddsLimitNotified;
55
+ private pendingBootstrapCartAddInFlight;
56
+ private pendingBootstrapCartQueueGeneration;
33
57
  private count;
34
58
  private locale;
35
59
  private logged_in;
@@ -45,9 +69,53 @@ export declare class CartService {
45
69
  addressBookApi: () => string;
46
70
  taxesApi: () => string;
47
71
  cart_token: any;
72
+ private cartLifecycleGeneration;
73
+ private cartRequestId;
74
+ private lastAppliedCartRequestId;
75
+ private readonly cartSyncKey;
76
+ private readonly tabId;
77
+ private readonly seenCartSyncEvents;
78
+ private cartSyncBlocked;
79
+ private cartSyncReading;
80
+ private cartSyncReadAgain;
81
+ private cartSyncTimer;
82
+ private pendingCheckoutRecovery;
83
+ private cartNotActiveRecovery;
84
+ private cartNotActiveTransitionId;
85
+ private cartNotActiveToken;
86
+ private cartNotActiveRecoveryTimer;
87
+ private cartBootstrapLookupInFlight;
88
+ private cartBootstrapPickup;
89
+ private cartBootstrapAllowsPendingAdds;
90
+ private cartBootstrapLookupRequiredForRetry;
91
+ private cartBootstrapPickupRequiredForRetry;
92
+ private cartBootstrapRecoveryNavigation;
93
+ private lastRouterNavigationId;
94
+ private routerNavigationSubscription;
95
+ private activeCheckoutTransitionId;
96
+ private completedCheckoutTransitionId;
97
+ private authContextBlocked;
98
+ private checkoutRecoveryTimer;
99
+ private checkoutInvalidatedAt;
100
+ private readonly checkoutRecoveryTimeoutMs;
101
+ private readonly cartRequestTimeoutMs;
102
+ private authRetryAllowed;
103
+ private authContext;
104
+ private pendingGuestCartAssociationToken;
105
+ private readonly storageListener;
106
+ private readonly visibilityListener;
107
+ private readonly pageshowListener;
48
108
  cartItems: Observable<CartItem[]>;
49
109
  coupon: Observable<any>;
50
110
  loading: Observable<boolean>;
111
+ /** Estado que permite a los consumidores diferenciar el carrito listo de una recuperación pendiente o fallida. */
112
+ cartSyncState: Observable<CartSyncState>;
113
+ /** Emite únicamente si el bootstrap descartó un token inactivo y recuperó otro carrito correctamente. */
114
+ cartBootstrapRecovery: Observable<{
115
+ reason: "inactive-token-replaced";
116
+ }>;
117
+ /** Notifica al checkout montado cuando se invalida el token que su CartService estaba usando. */
118
+ cartCheckoutInvalidation: Observable<CartCheckoutInvalidation>;
51
119
  cart: Observable<any>;
52
120
  promotions: Observable<CheckoutData[]>;
53
121
  deleting: Boolean;
@@ -67,10 +135,49 @@ export declare class CartService {
67
135
  showMax$: Observable<boolean>;
68
136
  showPrice$: Observable<boolean>;
69
137
  constructor(connection: ConnectionService, toastrService: ToastService, consts: Constants, authService: AuthService, orderUtils: OrderUtilityService, analyticsService: AnalyticsService, channelConfigService: ChannelConfigService, router: Router, pricePresentationService: PricePresentationService);
138
+ ngOnDestroy(): void;
139
+ /** Consume el evento de bootstrap una sola vez y solo durante la navegación que inició la recuperación. */
140
+ consumeCartBootstrapRecovery(): boolean;
141
+ private getCurrentRouterNavigationId;
142
+ private markCartBootstrapRecoveryPending;
143
+ private completeCartBootstrapRecovery;
144
+ private createCartSyncId;
145
+ private getAuthContext;
146
+ private cartTransitionIdForToken;
147
+ private notifyCheckoutInvalidation;
148
+ private publishCartSync;
149
+ private handleStorageEvent;
150
+ private receiveCartSync;
151
+ private checkPendingCartSync;
152
+ private scheduleCartRefresh;
153
+ private refreshCartFromBackend;
154
+ private setCartSyncState;
155
+ private startCheckoutRecoveryWatchdog;
156
+ private markInterruptedCheckoutIfExpired;
157
+ private invalidateLocalCart;
158
+ /** Reintenta una lectura fallida. Si el token ya fue invalidado, no crea otro carrito. */
159
+ retryCartSync: () => boolean;
160
+ /** Reanuda explícitamente un checkout interrumpido consultando /carts sin token. */
161
+ recoverInterruptedCheckout: () => boolean;
162
+ /** Impide enviar nuevas mutaciones mientras la pestaña reconcilia una invalidación remota. */
163
+ canMutateCart: () => boolean;
164
+ /** Confirma que el resumen listo ya pertenece al contexto de autenticación vigente. */
165
+ isCartReadyForCurrentAuthContext: () => boolean;
166
+ private discardPendingBootstrapCartAdds;
167
+ private flushPendingBootstrapCartAdds;
168
+ /** Detecta el contrato de carrito finalizado sin tratar otros conflictos HTTP como invalidez del carrito. */
169
+ isCartNotActiveError: (error: any) => boolean;
170
+ /** Consume un CART_NOT_ACTIVE, invalida solo el token de esa solicitud e inicia una recuperación única. */
171
+ handleCartMutationError: (error: any, requestToken?: string) => boolean;
172
+ private startCartNotActiveRecovery;
173
+ private startCartNotActiveRecoveryWatchdog;
70
174
  getCart2(): CartItem[];
71
175
  getAddressBook: () => Promise<any>;
72
- getTaxes: () => Promise<import("rxjs").Subscription>;
176
+ getTaxes: () => Promise<Subscription>;
73
177
  private getCart;
178
+ private startCartBootstrapPickup;
179
+ private resumeCartBootstrapIfInvalidated;
180
+ private finishCheckoutCartRecovery;
74
181
  private getCartByToken;
75
182
  private getCartByCustomer;
76
183
  /**
@@ -78,6 +185,12 @@ export declare class CartService {
78
185
  * CART CRUD SERVER'S SYNCRONIZED
79
186
  */
80
187
  private initializeCart;
188
+ /** Captura la generación del ciclo del carrito y el orden de inicio de la petición. */
189
+ captureCartResponseContext: (allowTokenChange?: boolean) => CartResponseContext;
190
+ isCartResponseContextCurrent: (context: CartResponseContext) => boolean;
191
+ isCartBusinessError: (response: any) => boolean;
192
+ /** Adopta y sincroniza un resumen exitoso si todavía pertenece a la versión vigente del carrito. */
193
+ applyCartResponse: (response: any, context: CartResponseContext, emitEvent?: boolean, publishInvalidation?: boolean, flushPendingAdds?: boolean) => boolean;
81
194
  /**
82
195
  * Reasigna `product.price` al precio base legacy que espera el template histórico del carrito.
83
196
  *
@@ -109,12 +222,13 @@ export declare class CartService {
109
222
  private updateLocalCart;
110
223
  private resetCart;
111
224
  private updateCartObj;
225
+ updateCartAfterPaymentResponse: (cart: any) => boolean;
112
226
  private isItemInLocal;
113
227
  /**
114
228
  * @public
115
229
  * CART CRUD
116
230
  */
117
- addToCart: (product: Product, quantity: number, variant_id: any, comments?: string) => void;
231
+ addToCart: (product: Product, quantity: number, variant_id: any, comments?: string, fromBootstrapQueue?: boolean, queueGeneration?: number) => void;
118
232
  addToLot: (product: Product, quantity: number, variant_id: any, id?: any, order_item_id?: any, lot_quantity?: any, unit_price?: any, unit_total?: any, ajustement_total?: any, total_lot?: any, lot_status?: any, date_request?: any, notes?: any, shipping_address_id?: any, shipping_address_name?: any, action?: any) => void;
119
233
  addToCartPromise: (product: Product, quantity: number, variant_id: any, comments?: string) => Promise<{
120
234
  error: boolean;
@@ -133,7 +247,7 @@ export declare class CartService {
133
247
  clearAndResetCustomerCart(): void;
134
248
  handleError: (error: {
135
249
  error: string;
136
- }) => void;
250
+ }, requestToken?: string) => void;
137
251
  getCountFromItemInCart: (codeVariant: any) => number;
138
252
  findItemByIdVariant: (variant_id: any) => any;
139
253
  findItem: (product_id: any) => any;
@@ -141,6 +255,8 @@ export declare class CartService {
141
255
  getCartToken: () => any;
142
256
  getLocale: () => string;
143
257
  getTotalAmount: () => Observable<number>;
258
+ getPaymentMethodAdjustment: () => Observable<number>;
259
+ getPaymentMethodAdjustmentLabel: () => Observable<string>;
144
260
  /** Total para carrito/sidebar, sin envío persistido ni recargos de checkout. */
145
261
  getCartTotalAmount: () => Observable<number>;
146
262
  getCountCartItems: () => Observable<number>;
@@ -209,7 +325,7 @@ export declare class CartService {
209
325
  changeHaveToUpdate: (value: any) => any;
210
326
  readyForCheckout: (successCallback?: Function, errorCallback?: Function) => CartAffordable;
211
327
  updateItemsOnError: (itemsWithError: any[], code: string) => void;
212
- loadCartByToken: (token: string) => Promise<import("rxjs").Subscription>;
328
+ loadCartByToken: (token: string) => Promise<Subscription>;
213
329
  /**
214
330
  * UTILS
215
331
  */
@@ -241,7 +241,7 @@ export declare class AddressingService extends StepService {
241
241
  };
242
242
  };
243
243
  };
244
- setTypeSelectAddress: (type: typeSelectAddress) => void;
244
+ setTypeSelectAddress: (type: boolean | "ONLY_LOAD_ADDRESS" | "ONLY_ADDRESS_SELECTION" | "LOAD_ADDRESS_AND_SELECTION") => void;
245
245
  setTypeForms: (type: typeForms) => void;
246
246
  }
247
247
  export {};
@@ -40,6 +40,7 @@ export declare class CheckoutService implements OnInit {
40
40
  private asociatedDataSubject;
41
41
  private order;
42
42
  private checkout_data;
43
+ private checkoutStateGeneration;
43
44
  total: any;
44
45
  private cartLocal;
45
46
  private user;
@@ -61,6 +62,8 @@ export declare class CheckoutService implements OnInit {
61
62
  setSteps: (steps: StepI[], autohandle?: boolean) => void;
62
63
  setStepReady: (step_number: any, data: any, order?: any, automatic?: any) => Promise<boolean>;
63
64
  setStepDoing: (step_number: any) => Promise<boolean>;
65
+ /** Invalida de inmediato los datos y pasos del checkout asociado a un carrito finalizado. */
66
+ invalidateCheckoutState: () => void;
64
67
  restartAllStepsFrom: (step_number: any, included?: boolean, update?: boolean) => Step[];
65
68
  isCheckoutReady: () => boolean;
66
69
  isStepReady: (step_name: any) => any;
@@ -44,8 +44,8 @@ export declare class ShipmentService extends StepService {
44
44
  constructor(connection: ConnectionService, transformer: ShipmentDataTransformer, shippingPriceDisplay: ShippingPriceDisplayService, analyticsService: AnalyticsService, consts: Constants, cartService: CartService, storesService: StoresService, checkoutService: CheckoutService);
45
45
  getShipmentMethods: () => Promise<any[]>;
46
46
  getShippingOptions: () => Promise<any[]>;
47
- setMethod: (method: any) => Promise<void>;
48
- setMethodOnly: (method: any) => Promise<void>;
47
+ setMethod: (method: any) => Promise<boolean>;
48
+ setMethodOnly: (method: any) => Promise<boolean>;
49
49
  setShippingOption: (payload: {
50
50
  method: string;
51
51
  option: string;
@@ -14,6 +14,7 @@ export declare class GiftCardService {
14
14
  setCoupon: (coupon: any) => void;
15
15
  removeCoupon: () => void;
16
16
  deleteCoupon: () => void;
17
+ private setOperationError;
17
18
  handleResponse: (response: any, coupon: any) => void;
18
19
  avoidCoupon: () => void;
19
20
  }
@@ -18,6 +18,7 @@ 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
+ getPaymentMethodAdjustment: (cart: any) => CheckoutData;
21
22
  /**
22
23
  * Devuelve el monto de envío que debe mostrarse en el resumen.
23
24
  *