@infrab4a/connect-angular 0.5.0-beta.19 → 0.5.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/infrab4a-connect-angular.umd.js +102 -138
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/lib/angular-connect.module.js +4 -7
- package/esm2015/lib/services/cart.service.js +36 -57
- package/esm2015/lib/services/checkout.service.js +10 -23
- package/fesm2015/infrab4a-connect-angular.js +44 -78
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/lib/angular-connect.module.d.ts +1 -2
- package/lib/services/cart.service.d.ts +6 -10
- package/lib/services/checkout.service.d.ts +4 -8
- package/package.json +7 -8
- package/esm2015/lib/consts/default-shop.const.js +0 -2
- package/esm2015/lib/consts/index.js +0 -2
- package/esm2015/lib/services/types/index.js +0 -2
- package/esm2015/lib/services/types/required-checkout-data.type.js +0 -2
- package/lib/consts/default-shop.const.d.ts +0 -1
- package/lib/consts/index.d.ts +0 -1
- package/lib/services/types/index.d.ts +0 -1
- package/lib/services/types/required-checkout-data.type.d.ts +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('@angular/fire'), require('@angular/fire/firestore')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', '@angular/fire', '@angular/fire/firestore'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global
|
|
5
|
-
})(this, (function (exports, i0, rxjs, operators, i1,
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global.connect, global.cookie, global.ng.fire, global.ng.fire.firestore));
|
|
5
|
+
})(this, (function (exports, i0, rxjs, operators, i1, connect, cookie, fire, firestore) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
28
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
-
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
30
29
|
var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
|
|
31
30
|
|
|
32
31
|
var AuthService = /** @class */ (function () {
|
|
@@ -54,8 +53,6 @@
|
|
|
54
53
|
}] }];
|
|
55
54
|
} });
|
|
56
55
|
|
|
57
|
-
var DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
58
|
-
|
|
59
56
|
/*! *****************************************************************************
|
|
60
57
|
Copyright (c) Microsoft Corporation.
|
|
61
58
|
|
|
@@ -375,37 +372,29 @@
|
|
|
375
372
|
}
|
|
376
373
|
|
|
377
374
|
var CheckoutService = /** @class */ (function () {
|
|
378
|
-
function CheckoutService(checkoutRepository, userRepository
|
|
375
|
+
function CheckoutService(checkoutRepository, userRepository) {
|
|
379
376
|
this.checkoutRepository = checkoutRepository;
|
|
380
377
|
this.userRepository = userRepository;
|
|
381
|
-
this.defaultShop = defaultShop;
|
|
382
378
|
}
|
|
383
|
-
CheckoutService.prototype.getCheckout = function (
|
|
379
|
+
CheckoutService.prototype.getCheckout = function () {
|
|
384
380
|
var checkoutId = cookie__default["default"].get('checkoutId');
|
|
385
|
-
if (!
|
|
381
|
+
if (!connect.isNil(checkoutId))
|
|
386
382
|
return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
|
|
387
|
-
return rxjs.from(this.createCheckout(
|
|
383
|
+
return rxjs.from(this.createCheckout());
|
|
388
384
|
};
|
|
389
385
|
CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
|
|
390
386
|
var _this = this;
|
|
391
|
-
return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.
|
|
387
|
+
return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.mergeMap(function (checkout) { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? rxjs.of(checkout.user) : rxjs.from(_this.userRepository.get({ id: checkout.user.id })); }), operators.mergeMap(function (user) { return rxjs.of(user) || rxjs.throwError(function () { return new connect.NotFoundError('User is not found'); }); }));
|
|
392
388
|
};
|
|
393
389
|
CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
|
|
394
|
-
return rxjs.from(this.checkoutRepository.update(
|
|
395
|
-
};
|
|
396
|
-
CheckoutService.prototype.updateCheckoutUser = function (checkout) {
|
|
397
|
-
return rxjs.from(this.checkoutRepository.update(i1$1.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
398
|
-
};
|
|
399
|
-
CheckoutService.prototype.clearCheckoutFromSession = function () {
|
|
400
|
-
cookie__default["default"].remove('checkoutId');
|
|
401
|
-
return rxjs.of();
|
|
390
|
+
return rxjs.from(this.checkoutRepository.update(connect.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
402
391
|
};
|
|
403
|
-
CheckoutService.prototype.createCheckout = function (
|
|
392
|
+
CheckoutService.prototype.createCheckout = function () {
|
|
404
393
|
return __awaiter(this, void 0, void 0, function () {
|
|
405
394
|
var checkout;
|
|
406
395
|
return __generator(this, function (_b) {
|
|
407
396
|
switch (_b.label) {
|
|
408
|
-
case 0: return [4 /*yield*/, this.checkoutRepository.create(
|
|
397
|
+
case 0: return [4 /*yield*/, this.checkoutRepository.create({ createdAt: new Date() })];
|
|
409
398
|
case 1:
|
|
410
399
|
checkout = _b.sent();
|
|
411
400
|
cookie__default["default"].set('checkoutId', checkout.id);
|
|
@@ -416,7 +405,7 @@
|
|
|
416
405
|
};
|
|
417
406
|
return CheckoutService;
|
|
418
407
|
}());
|
|
419
|
-
CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: 'CheckoutRepository' }, { token: 'UserRepository' }
|
|
408
|
+
CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: 'CheckoutRepository' }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
420
409
|
CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CheckoutService });
|
|
421
410
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CheckoutService, decorators: [{
|
|
422
411
|
type: i0.Injectable
|
|
@@ -427,55 +416,45 @@
|
|
|
427
416
|
}] }, { type: undefined, decorators: [{
|
|
428
417
|
type: i0.Inject,
|
|
429
418
|
args: ['UserRepository']
|
|
430
|
-
}] }, { type: i1__namespace$1.Shops, decorators: [{
|
|
431
|
-
type: i0.Inject,
|
|
432
|
-
args: [DEFAULT_SHOP]
|
|
433
419
|
}] }];
|
|
434
420
|
} });
|
|
435
421
|
|
|
436
422
|
var CartService = /** @class */ (function () {
|
|
437
|
-
function CartService(authService, checkoutService
|
|
423
|
+
function CartService(authService, checkoutService) {
|
|
438
424
|
var _this = this;
|
|
439
425
|
this.authService = authService;
|
|
440
426
|
this.checkoutService = checkoutService;
|
|
441
|
-
this.
|
|
442
|
-
this.cartSubject = new rxjs.Subject();
|
|
443
|
-
this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i1$1.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
|
|
427
|
+
this.updateLineItemInCart = function (lineItem, quantity) { return _this.checkoutService.getCheckout().pipe(operators.mergeMap(function (checkoutLoaded) {
|
|
444
428
|
var _a;
|
|
445
429
|
var items = [];
|
|
446
430
|
var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
|
|
447
431
|
if (index > -1) {
|
|
448
432
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
449
|
-
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
450
433
|
}
|
|
451
434
|
else
|
|
452
435
|
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
453
436
|
return _this.checkoutService
|
|
454
437
|
.updateCheckoutLineItems(checkoutLoaded)
|
|
455
|
-
.pipe(operators.map(function (
|
|
438
|
+
.pipe(operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
|
|
456
439
|
})); };
|
|
457
440
|
this.generateCartObject = function (items) {
|
|
458
441
|
var cart = {};
|
|
459
442
|
items === null || items === void 0 ? void 0 : items.forEach(function (item) {
|
|
460
443
|
var _a;
|
|
461
|
-
return (cart[item.sku] =
|
|
444
|
+
return (cart[item.sku] = connect.LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
|
|
462
445
|
});
|
|
463
446
|
return cart;
|
|
464
447
|
};
|
|
465
|
-
this.buildLineItem = function (
|
|
466
|
-
var checkout =
|
|
467
|
-
var _a, _b
|
|
468
|
-
if (_this.checkMaxStock(item
|
|
448
|
+
this.buildLineItem = function (_c) {
|
|
449
|
+
var checkout = _c.checkout, item = _c.item, isSubscriber = _c.isSubscriber, quantity = _c.quantity;
|
|
450
|
+
var _a, _b;
|
|
451
|
+
if (_this.checkMaxStock(item))
|
|
469
452
|
throw new Error('Desculpe! Temos apenas ' + ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) + ' em estoque.');
|
|
470
453
|
var image = item.image || ((_b = item.images) === null || _b === void 0 ? void 0 : _b.shift());
|
|
471
|
-
var pricePaid = _this.getProductPrice({
|
|
472
|
-
product: item,
|
|
473
|
-
shop: checkout.shop || _this.defaultShop,
|
|
474
|
-
isSubscriber: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.isSubscriber,
|
|
475
|
-
});
|
|
454
|
+
var pricePaid = _this.getProductPrice({ product: item, shop: checkout.shop, isSubscriber: isSubscriber });
|
|
476
455
|
var id = item.id, name = item.name, brand = item.brand, slug = item.slug, stock = item.stock, price = item.price, weight = item.weight, categories = item.categories, sku = item.sku;
|
|
477
456
|
var isGift = item.isGift || null;
|
|
478
|
-
return
|
|
457
|
+
return connect.LineItem.toInstance({
|
|
479
458
|
id: id,
|
|
480
459
|
name: name,
|
|
481
460
|
brand: brand,
|
|
@@ -485,109 +464,91 @@
|
|
|
485
464
|
price: price,
|
|
486
465
|
image: image,
|
|
487
466
|
weight: weight,
|
|
488
|
-
quantity:
|
|
467
|
+
quantity: quantity,
|
|
489
468
|
pricePaid: pricePaid,
|
|
490
469
|
categories: categories,
|
|
491
470
|
isGift: isGift,
|
|
492
471
|
});
|
|
493
472
|
};
|
|
494
|
-
this.getProductPrice = function (
|
|
495
|
-
var product =
|
|
496
|
-
|
|
497
|
-
return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
|
|
473
|
+
this.getProductPrice = function (_c) {
|
|
474
|
+
var product = _c.product, shop = _c.shop, isSubscriber = _c.isSubscriber;
|
|
475
|
+
return product.getInfoByShop(shop)[isSubscriber ? 'subscriberPrice' : 'price'];
|
|
498
476
|
};
|
|
499
|
-
this.checkMaxStock = function (item
|
|
477
|
+
this.checkMaxStock = function (item) {
|
|
500
478
|
var _a;
|
|
501
479
|
var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
|
|
502
|
-
var
|
|
503
|
-
|
|
480
|
+
var quantity = item.quantity || 1;
|
|
481
|
+
var currentItemAmount = item.quantity;
|
|
482
|
+
return quantity > maxStock || currentItemAmount + quantity > maxStock;
|
|
504
483
|
};
|
|
505
484
|
}
|
|
506
|
-
CartService.prototype.addItem = function (item, quantity) {
|
|
485
|
+
CartService.prototype.addItem = function (item, quantity, checkout) {
|
|
507
486
|
var _this = this;
|
|
508
487
|
if (quantity === void 0) { quantity = 1; }
|
|
509
|
-
return
|
|
510
|
-
var
|
|
511
|
-
|
|
512
|
-
|
|
488
|
+
return rxjs.of(checkout).pipe(operators.mergeMap(function (checkout) { return (connect.isEmpty(checkout === null || checkout === void 0 ? void 0 : checkout.id) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)); }), operators.mergeMap(function (checkout) {
|
|
489
|
+
var _a;
|
|
490
|
+
quantity = quantity || 1;
|
|
491
|
+
return rxjs.of((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber).pipe(operators.mergeMap(function (isSubscriber) { return isSubscriber
|
|
492
|
+
? rxjs.of(isSubscriber)
|
|
493
|
+
: _this.checkoutService.getUserByCheckout(checkout.id).pipe(operators.catchError(function () { return rxjs.of({ isSubscriber: false }); }), operators.map(function (user) { return user.isSubscriber; })); }), operators.mergeMap(function (isSubscriber) {
|
|
494
|
+
return _this.getCart().pipe(operators.map(function () { return _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity, isSubscriber: isSubscriber }); }), operators.mergeMap(function (lineItem) { return _this.updateLineItemInCart(lineItem, quantity); }));
|
|
495
|
+
}));
|
|
496
|
+
}));
|
|
513
497
|
};
|
|
514
498
|
CartService.prototype.decreaseItem = function (item) {
|
|
515
499
|
var _this = this;
|
|
516
500
|
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
517
501
|
var _a;
|
|
518
502
|
var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
|
|
519
|
-
if (!
|
|
503
|
+
if (!connect.isNil(checkoutItem))
|
|
520
504
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
521
505
|
return checkout;
|
|
522
|
-
}), operators.
|
|
506
|
+
}), operators.mergeMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
|
|
523
507
|
};
|
|
524
|
-
CartService.prototype.getCart = function (
|
|
508
|
+
CartService.prototype.getCart = function () {
|
|
525
509
|
var _this = this;
|
|
526
|
-
this.
|
|
527
|
-
return this.cartSubject;
|
|
510
|
+
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.mergeMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
|
|
528
511
|
};
|
|
529
512
|
CartService.prototype.getDiscount = function (coupon) {
|
|
530
513
|
switch (coupon.type) {
|
|
531
|
-
case
|
|
514
|
+
case connect.CouponTypes.FINANCIAL:
|
|
532
515
|
return this.getFinancialDiscount(coupon);
|
|
533
|
-
case
|
|
516
|
+
case connect.CouponTypes.PRODUCT:
|
|
534
517
|
return function (subTotalPrice) { return subTotalPrice; };
|
|
535
|
-
case
|
|
518
|
+
case connect.CouponTypes.GIFTCARD:
|
|
536
519
|
return this.getFinancialDiscount(coupon);
|
|
537
|
-
case
|
|
520
|
+
case connect.CouponTypes.VOUCHER:
|
|
538
521
|
return function (subTotalPrice) { return subTotalPrice; };
|
|
539
522
|
}
|
|
540
523
|
};
|
|
541
524
|
CartService.prototype.getVariantPriceDiscount = function (item, shop) {
|
|
542
|
-
return this.authService.getUser().pipe(operators.
|
|
525
|
+
return this.authService.getUser().pipe(operators.mergeMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.getInfoByShop(shop).subscriberPrice; }, rxjs.of(item.getInfoByShop(shop).subscriberPrice), rxjs.of(item.getInfoByShop(shop).price)); }), operators.catchError(function () { return rxjs.of(item.getInfoByShop(shop).price); }));
|
|
543
526
|
};
|
|
544
527
|
CartService.prototype.removeItem = function (item) {
|
|
545
528
|
var _this = this;
|
|
546
529
|
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
547
|
-
|
|
548
|
-
if (index >= 0)
|
|
549
|
-
checkout.lineItems.splice(index, 1);
|
|
550
|
-
return checkout;
|
|
551
|
-
}), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
|
|
552
|
-
};
|
|
553
|
-
CartService.prototype.updateUserCart = function (user) {
|
|
554
|
-
var _this = this;
|
|
555
|
-
return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i1$1.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(i1$1.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: checkout.lineItems.map(function (item) { return _this.buildLineItem({ checkout: checkout, item: item }); }) }))); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
|
|
556
|
-
};
|
|
557
|
-
CartService.prototype.clearCart = function () {
|
|
558
|
-
var _this = this;
|
|
559
|
-
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
560
|
-
_this.checkoutService.clearCheckoutFromSession();
|
|
530
|
+
checkout.lineItems.splice(checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; }), 1);
|
|
561
531
|
return checkout;
|
|
562
|
-
}), operators.
|
|
563
|
-
};
|
|
564
|
-
CartService.prototype.buildCartFromCheckout = function (checkoutData) {
|
|
565
|
-
var _this = this;
|
|
566
|
-
return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
|
|
532
|
+
}), operators.mergeMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
|
|
567
533
|
};
|
|
568
534
|
CartService.prototype.getFinancialDiscount = function (coupon) {
|
|
569
535
|
return function (subTotalPrice) {
|
|
570
|
-
if (
|
|
536
|
+
if (connect.FinancialCoupon.isFinancialCoupon(coupon))
|
|
571
537
|
switch (coupon.subtype) {
|
|
572
|
-
case
|
|
538
|
+
case connect.CouponSubtypes.ABSOLUTE:
|
|
573
539
|
return subTotalPrice - coupon.discount * 100;
|
|
574
|
-
case
|
|
540
|
+
case connect.CouponSubtypes.PERCENTAGE:
|
|
575
541
|
return subTotalPrice * (1 - coupon.discount / 100);
|
|
576
542
|
}
|
|
577
543
|
};
|
|
578
544
|
};
|
|
579
545
|
return CartService;
|
|
580
546
|
}());
|
|
581
|
-
CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }
|
|
547
|
+
CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
582
548
|
CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService });
|
|
583
549
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService, decorators: [{
|
|
584
550
|
type: i0.Injectable
|
|
585
|
-
}], ctorParameters: function () {
|
|
586
|
-
return [{ type: AuthService }, { type: CheckoutService }, { type: i1__namespace$1.Shops, decorators: [{
|
|
587
|
-
type: i0.Inject,
|
|
588
|
-
args: [DEFAULT_SHOP]
|
|
589
|
-
}] }];
|
|
590
|
-
} });
|
|
551
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }]; } });
|
|
591
552
|
|
|
592
553
|
var AngularFirebaseAuthModule = /** @class */ (function () {
|
|
593
554
|
function AngularFirebaseAuthModule() {
|
|
@@ -609,21 +570,21 @@
|
|
|
609
570
|
{
|
|
610
571
|
provide: 'Authentication',
|
|
611
572
|
useFactory: function (authenticationService, userRepository) {
|
|
612
|
-
return new
|
|
573
|
+
return new connect.Authentication(authenticationService, userRepository);
|
|
613
574
|
},
|
|
614
575
|
deps: ['AuthenticationService', 'UserRepository'],
|
|
615
576
|
},
|
|
616
577
|
{
|
|
617
578
|
provide: 'AuthenticationService',
|
|
618
579
|
useFactory: function (angularFireAuth) {
|
|
619
|
-
return new
|
|
580
|
+
return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
620
581
|
},
|
|
621
582
|
deps: [i1.AngularFireAuth],
|
|
622
583
|
},
|
|
623
584
|
{
|
|
624
585
|
provide: 'SignOut',
|
|
625
586
|
useFactory: function (authenticationService) {
|
|
626
|
-
return new
|
|
587
|
+
return new connect.SignOut(authenticationService);
|
|
627
588
|
},
|
|
628
589
|
deps: ['AuthenticationService'],
|
|
629
590
|
},
|
|
@@ -636,21 +597,21 @@
|
|
|
636
597
|
{
|
|
637
598
|
provide: 'Authentication',
|
|
638
599
|
useFactory: function (authenticationService, userRepository) {
|
|
639
|
-
return new
|
|
600
|
+
return new connect.Authentication(authenticationService, userRepository);
|
|
640
601
|
},
|
|
641
602
|
deps: ['AuthenticationService', 'UserRepository'],
|
|
642
603
|
},
|
|
643
604
|
{
|
|
644
605
|
provide: 'AuthenticationService',
|
|
645
606
|
useFactory: function (angularFireAuth) {
|
|
646
|
-
return new
|
|
607
|
+
return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
647
608
|
},
|
|
648
609
|
deps: [i1.AngularFireAuth],
|
|
649
610
|
},
|
|
650
611
|
{
|
|
651
612
|
provide: 'SignOut',
|
|
652
613
|
useFactory: function (authenticationService) {
|
|
653
|
-
return new
|
|
614
|
+
return new connect.SignOut(authenticationService);
|
|
654
615
|
},
|
|
655
616
|
deps: ['AuthenticationService'],
|
|
656
617
|
},
|
|
@@ -678,126 +639,126 @@
|
|
|
678
639
|
{
|
|
679
640
|
provide: 'BeautyProfileRepository',
|
|
680
641
|
useFactory: function (firestore, userRepository) {
|
|
681
|
-
return new
|
|
642
|
+
return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
682
643
|
},
|
|
683
644
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
684
645
|
},
|
|
685
646
|
{
|
|
686
647
|
provide: 'Buy2WinRepository',
|
|
687
648
|
useFactory: function (firestore) {
|
|
688
|
-
return new
|
|
649
|
+
return new connect.Buy2WinFirestoreRepository(firestore.firestore);
|
|
689
650
|
},
|
|
690
651
|
deps: [firestore.AngularFirestore],
|
|
691
652
|
},
|
|
692
653
|
{
|
|
693
654
|
provide: 'CategoryRepository',
|
|
694
655
|
useFactory: function (firestore) {
|
|
695
|
-
return new
|
|
656
|
+
return new connect.CategoryFirestoreRepository(firestore.firestore);
|
|
696
657
|
},
|
|
697
658
|
deps: [firestore.AngularFirestore],
|
|
698
659
|
},
|
|
699
660
|
{
|
|
700
661
|
provide: 'CheckoutRepository',
|
|
701
662
|
useFactory: function (firestore) {
|
|
702
|
-
return new
|
|
663
|
+
return new connect.CheckoutFirestoreRepository(firestore.firestore);
|
|
703
664
|
},
|
|
704
665
|
deps: [firestore.AngularFirestore],
|
|
705
666
|
},
|
|
706
667
|
{
|
|
707
668
|
provide: 'CheckoutSubscriptionRepository',
|
|
708
669
|
useFactory: function (firestore) {
|
|
709
|
-
return new
|
|
670
|
+
return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
710
671
|
},
|
|
711
672
|
deps: [firestore.AngularFirestore],
|
|
712
673
|
},
|
|
713
674
|
{
|
|
714
675
|
provide: 'CouponRepository',
|
|
715
676
|
useFactory: function (firestore) {
|
|
716
|
-
return new
|
|
677
|
+
return new connect.CouponFirestoreRepository(firestore.firestore);
|
|
717
678
|
},
|
|
718
679
|
deps: [firestore.AngularFirestore],
|
|
719
680
|
},
|
|
720
681
|
{
|
|
721
682
|
provide: 'EditionRepository',
|
|
722
683
|
useFactory: function (firestore, subscriptionRepository) {
|
|
723
|
-
return new
|
|
684
|
+
return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
724
685
|
},
|
|
725
686
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
726
687
|
},
|
|
727
688
|
{
|
|
728
689
|
provide: 'HomeRepository',
|
|
729
690
|
useFactory: function (firestore) {
|
|
730
|
-
return new
|
|
691
|
+
return new connect.HomeFirestoreRepository(firestore.firestore);
|
|
731
692
|
},
|
|
732
693
|
deps: [firestore.AngularFirestore],
|
|
733
694
|
},
|
|
734
695
|
{
|
|
735
696
|
provide: 'ShopMenuRepository',
|
|
736
697
|
useFactory: function (firestore) {
|
|
737
|
-
return new
|
|
698
|
+
return new connect.ShopMenuFirestoreRepository(firestore.firestore);
|
|
738
699
|
},
|
|
739
700
|
deps: [firestore.AngularFirestore],
|
|
740
701
|
},
|
|
741
702
|
{
|
|
742
703
|
provide: 'OrderRepository',
|
|
743
704
|
useFactory: function (firestore) {
|
|
744
|
-
return new
|
|
705
|
+
return new connect.OrderFirestoreRepository(firestore.firestore);
|
|
745
706
|
},
|
|
746
707
|
deps: [firestore.AngularFirestore],
|
|
747
708
|
},
|
|
748
709
|
{
|
|
749
710
|
provide: 'PaymentRepository',
|
|
750
711
|
useFactory: function (firestore) {
|
|
751
|
-
return new
|
|
712
|
+
return new connect.PaymentFirestoreRepository(firestore.firestore);
|
|
752
713
|
},
|
|
753
714
|
deps: [firestore.AngularFirestore],
|
|
754
715
|
},
|
|
755
716
|
{
|
|
756
717
|
provide: 'ProductRepository',
|
|
757
718
|
useFactory: function (firestore) {
|
|
758
|
-
return new
|
|
719
|
+
return new connect.ProductFirestoreRepository(firestore.firestore);
|
|
759
720
|
},
|
|
760
721
|
deps: [firestore.AngularFirestore],
|
|
761
722
|
},
|
|
762
723
|
{
|
|
763
724
|
provide: 'SubscriptionPaymentRepository',
|
|
764
725
|
useFactory: function (firestore, subscriptionRepository) {
|
|
765
|
-
return new
|
|
726
|
+
return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
766
727
|
},
|
|
767
728
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
768
729
|
},
|
|
769
730
|
{
|
|
770
731
|
provide: 'SubscriptionPlanRepository',
|
|
771
732
|
useFactory: function (firestore) {
|
|
772
|
-
return new
|
|
733
|
+
return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
773
734
|
},
|
|
774
735
|
deps: [firestore.AngularFirestore],
|
|
775
736
|
},
|
|
776
737
|
{
|
|
777
738
|
provide: 'SubscriptionRepository',
|
|
778
739
|
useFactory: function (firestore) {
|
|
779
|
-
return new
|
|
740
|
+
return new connect.SubscriptionFirestoreRepository(firestore.firestore);
|
|
780
741
|
},
|
|
781
742
|
deps: [firestore.AngularFirestore],
|
|
782
743
|
},
|
|
783
744
|
{
|
|
784
745
|
provide: 'UserRepository',
|
|
785
746
|
useFactory: function (firestore) {
|
|
786
|
-
return new
|
|
747
|
+
return new connect.UserFirestoreRepository(firestore.firestore);
|
|
787
748
|
},
|
|
788
749
|
deps: [firestore.AngularFirestore],
|
|
789
750
|
},
|
|
790
751
|
{
|
|
791
752
|
provide: 'UserAddressRepository',
|
|
792
753
|
useFactory: function (firestore, userRepository) {
|
|
793
|
-
return new
|
|
754
|
+
return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
794
755
|
},
|
|
795
756
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
796
757
|
},
|
|
797
758
|
{
|
|
798
759
|
provide: 'VariantRepository',
|
|
799
760
|
useFactory: function (firestore, productRepository) {
|
|
800
|
-
return new
|
|
761
|
+
return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
801
762
|
},
|
|
802
763
|
deps: [firestore.AngularFirestore, 'ProductRepository'],
|
|
803
764
|
},
|
|
@@ -810,126 +771,126 @@
|
|
|
810
771
|
{
|
|
811
772
|
provide: 'BeautyProfileRepository',
|
|
812
773
|
useFactory: function (firestore, userRepository) {
|
|
813
|
-
return new
|
|
774
|
+
return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
814
775
|
},
|
|
815
776
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
816
777
|
},
|
|
817
778
|
{
|
|
818
779
|
provide: 'Buy2WinRepository',
|
|
819
780
|
useFactory: function (firestore) {
|
|
820
|
-
return new
|
|
781
|
+
return new connect.Buy2WinFirestoreRepository(firestore.firestore);
|
|
821
782
|
},
|
|
822
783
|
deps: [firestore.AngularFirestore],
|
|
823
784
|
},
|
|
824
785
|
{
|
|
825
786
|
provide: 'CategoryRepository',
|
|
826
787
|
useFactory: function (firestore) {
|
|
827
|
-
return new
|
|
788
|
+
return new connect.CategoryFirestoreRepository(firestore.firestore);
|
|
828
789
|
},
|
|
829
790
|
deps: [firestore.AngularFirestore],
|
|
830
791
|
},
|
|
831
792
|
{
|
|
832
793
|
provide: 'CheckoutRepository',
|
|
833
794
|
useFactory: function (firestore) {
|
|
834
|
-
return new
|
|
795
|
+
return new connect.CheckoutFirestoreRepository(firestore.firestore);
|
|
835
796
|
},
|
|
836
797
|
deps: [firestore.AngularFirestore],
|
|
837
798
|
},
|
|
838
799
|
{
|
|
839
800
|
provide: 'CheckoutSubscriptionRepository',
|
|
840
801
|
useFactory: function (firestore) {
|
|
841
|
-
return new
|
|
802
|
+
return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
842
803
|
},
|
|
843
804
|
deps: [firestore.AngularFirestore],
|
|
844
805
|
},
|
|
845
806
|
{
|
|
846
807
|
provide: 'CouponRepository',
|
|
847
808
|
useFactory: function (firestore) {
|
|
848
|
-
return new
|
|
809
|
+
return new connect.CouponFirestoreRepository(firestore.firestore);
|
|
849
810
|
},
|
|
850
811
|
deps: [firestore.AngularFirestore],
|
|
851
812
|
},
|
|
852
813
|
{
|
|
853
814
|
provide: 'EditionRepository',
|
|
854
815
|
useFactory: function (firestore, subscriptionRepository) {
|
|
855
|
-
return new
|
|
816
|
+
return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
856
817
|
},
|
|
857
818
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
858
819
|
},
|
|
859
820
|
{
|
|
860
821
|
provide: 'HomeRepository',
|
|
861
822
|
useFactory: function (firestore) {
|
|
862
|
-
return new
|
|
823
|
+
return new connect.HomeFirestoreRepository(firestore.firestore);
|
|
863
824
|
},
|
|
864
825
|
deps: [firestore.AngularFirestore],
|
|
865
826
|
},
|
|
866
827
|
{
|
|
867
828
|
provide: 'ShopMenuRepository',
|
|
868
829
|
useFactory: function (firestore) {
|
|
869
|
-
return new
|
|
830
|
+
return new connect.ShopMenuFirestoreRepository(firestore.firestore);
|
|
870
831
|
},
|
|
871
832
|
deps: [firestore.AngularFirestore],
|
|
872
833
|
},
|
|
873
834
|
{
|
|
874
835
|
provide: 'OrderRepository',
|
|
875
836
|
useFactory: function (firestore) {
|
|
876
|
-
return new
|
|
837
|
+
return new connect.OrderFirestoreRepository(firestore.firestore);
|
|
877
838
|
},
|
|
878
839
|
deps: [firestore.AngularFirestore],
|
|
879
840
|
},
|
|
880
841
|
{
|
|
881
842
|
provide: 'PaymentRepository',
|
|
882
843
|
useFactory: function (firestore) {
|
|
883
|
-
return new
|
|
844
|
+
return new connect.PaymentFirestoreRepository(firestore.firestore);
|
|
884
845
|
},
|
|
885
846
|
deps: [firestore.AngularFirestore],
|
|
886
847
|
},
|
|
887
848
|
{
|
|
888
849
|
provide: 'ProductRepository',
|
|
889
850
|
useFactory: function (firestore) {
|
|
890
|
-
return new
|
|
851
|
+
return new connect.ProductFirestoreRepository(firestore.firestore);
|
|
891
852
|
},
|
|
892
853
|
deps: [firestore.AngularFirestore],
|
|
893
854
|
},
|
|
894
855
|
{
|
|
895
856
|
provide: 'SubscriptionPaymentRepository',
|
|
896
857
|
useFactory: function (firestore, subscriptionRepository) {
|
|
897
|
-
return new
|
|
858
|
+
return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
898
859
|
},
|
|
899
860
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
900
861
|
},
|
|
901
862
|
{
|
|
902
863
|
provide: 'SubscriptionPlanRepository',
|
|
903
864
|
useFactory: function (firestore) {
|
|
904
|
-
return new
|
|
865
|
+
return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
905
866
|
},
|
|
906
867
|
deps: [firestore.AngularFirestore],
|
|
907
868
|
},
|
|
908
869
|
{
|
|
909
870
|
provide: 'SubscriptionRepository',
|
|
910
871
|
useFactory: function (firestore) {
|
|
911
|
-
return new
|
|
872
|
+
return new connect.SubscriptionFirestoreRepository(firestore.firestore);
|
|
912
873
|
},
|
|
913
874
|
deps: [firestore.AngularFirestore],
|
|
914
875
|
},
|
|
915
876
|
{
|
|
916
877
|
provide: 'UserRepository',
|
|
917
878
|
useFactory: function (firestore) {
|
|
918
|
-
return new
|
|
879
|
+
return new connect.UserFirestoreRepository(firestore.firestore);
|
|
919
880
|
},
|
|
920
881
|
deps: [firestore.AngularFirestore],
|
|
921
882
|
},
|
|
922
883
|
{
|
|
923
884
|
provide: 'UserAddressRepository',
|
|
924
885
|
useFactory: function (firestore, userRepository) {
|
|
925
|
-
return new
|
|
886
|
+
return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
926
887
|
},
|
|
927
888
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
928
889
|
},
|
|
929
890
|
{
|
|
930
891
|
provide: 'VariantRepository',
|
|
931
892
|
useFactory: function (firestore, productRepository) {
|
|
932
|
-
return new
|
|
893
|
+
return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
933
894
|
},
|
|
934
895
|
deps: [firestore.AngularFirestore, 'ProductRepository'],
|
|
935
896
|
},
|
|
@@ -940,10 +901,13 @@
|
|
|
940
901
|
var AngularConnectModule = /** @class */ (function () {
|
|
941
902
|
function AngularConnectModule() {
|
|
942
903
|
}
|
|
943
|
-
AngularConnectModule.initializeApp = function (
|
|
904
|
+
AngularConnectModule.initializeApp = function (options, nameOrConfig) {
|
|
944
905
|
return {
|
|
945
906
|
ngModule: AngularConnectModule,
|
|
946
|
-
providers:
|
|
907
|
+
providers: [
|
|
908
|
+
{ provide: fire.FIREBASE_OPTIONS, useValue: options },
|
|
909
|
+
{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
910
|
+
],
|
|
947
911
|
};
|
|
948
912
|
};
|
|
949
913
|
return AngularConnectModule;
|