var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    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;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { combineLatest } from 'rxjs';
import { ComponentHelper } from '../../../classes/component-helper';
import { CartService } from '../../../services/cart.service';
import { CheckoutService } from '../../../services/checkout/checkout.service';
var CartLoadEcComponent = /** @class */ (function (_super) {
    __extends(CartLoadEcComponent, _super);
    function CartLoadEcComponent(activedRoute, router, checkoutService, cartService) {
        var _this = _super.call(this) || this;
        _this.activedRoute = activedRoute;
        _this.router = router;
        _this.checkoutService = checkoutService;
        _this.cartService = cartService;
        _this.message = '';
        _this.ecOnConstruct();
        return _this;
    }
    CartLoadEcComponent.prototype.ngOnInit = function () {
        var _this = this;
        var token;
        combineLatest([this.activedRoute.params, this.activedRoute.queryParams]).subscribe(function (_a) {
            var _b = __read(_a, 2), queryRouter = _b[0], queryParams = _b[1];
            token = queryRouter.token;
            console.log('PARAMETROS token  -> ', token);
            _this.cartService.loadCartByToken(token).then(function (res) {
                _this.router.navigateByUrl('/cart');
            });
        });
        this.ecOnInit();
    };
    CartLoadEcComponent.ctorParameters = function () { return [
        { type: ActivatedRoute },
        { type: Router },
        { type: CheckoutService },
        { type: CartService }
    ]; };
    CartLoadEcComponent = __decorate([
        Component({
            selector: 'app-cart-load-ec',
            template: "<div class=\"container\">\n    <div class=\"row\">\n        <div class=\"col align-self-center\">\n            <h4 class=\"titpage center-block text-center font-nexa font-lg my-3\">{{ 'retrieve-cart' | translate | uppercase }}</h4>\n        </div>\n    </div>\n    <div class=\"row\">\n        <div class=\"col align-self-center mt-2\">\n            <div class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n                <app-loading-full-ec></app-loading-full-ec>\n            </div>\n        </div>\n    </div>\n</div>",
            styles: [".loader{border:16px solid #f3f3f3;border-top:16px solid #dc3545;border-radius:50%;width:50px;height:50px;-webkit-animation:2s linear infinite spin;animation:2s linear infinite spin}@-webkit-keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.flex-container{display:flex;justify-content:center;align-items:center;height:80vh;width:100%}.flex-container>div{width:90%;height:100px}"]
        })
    ], CartLoadEcComponent);
    return CartLoadEcComponent;
}(ComponentHelper));
export { CartLoadEcComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FydC1sb2FkLWVjLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLWVhc3ljb21tZXJjZS8iLCJzb3VyY2VzIjpbImxpYi9lYy1jb21wb25lbnQvd2lkZ2V0cy1lYy9jYXJ0LWxvYWQtZWMvY2FydC1sb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