@infrab4a/connect-angular 0.5.0-beta.18 → 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 +104 -158
- 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 +38 -77
- package/esm2015/lib/services/checkout.service.js +10 -23
- package/fesm2015/infrab4a-connect-angular.js +46 -98
- 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,127 +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
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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
|
+
}));
|
|
517
497
|
};
|
|
518
498
|
CartService.prototype.decreaseItem = function (item) {
|
|
519
499
|
var _this = this;
|
|
520
|
-
this.checkoutService
|
|
521
|
-
.getCheckout()
|
|
522
|
-
.pipe(operators.map(function (checkout) {
|
|
500
|
+
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
523
501
|
var _a;
|
|
524
502
|
var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
|
|
525
|
-
if (!
|
|
503
|
+
if (!connect.isNil(checkoutItem))
|
|
526
504
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
527
505
|
return checkout;
|
|
528
|
-
}), operators.
|
|
529
|
-
.subscribe(function (cart) { return _this.cartSubject.next(cart); });
|
|
530
|
-
return this.cartSubject;
|
|
506
|
+
}), operators.mergeMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
|
|
531
507
|
};
|
|
532
|
-
CartService.prototype.getCart = function (
|
|
508
|
+
CartService.prototype.getCart = function () {
|
|
533
509
|
var _this = this;
|
|
534
|
-
this.
|
|
535
|
-
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)); }));
|
|
536
511
|
};
|
|
537
512
|
CartService.prototype.getDiscount = function (coupon) {
|
|
538
513
|
switch (coupon.type) {
|
|
539
|
-
case
|
|
514
|
+
case connect.CouponTypes.FINANCIAL:
|
|
540
515
|
return this.getFinancialDiscount(coupon);
|
|
541
|
-
case
|
|
516
|
+
case connect.CouponTypes.PRODUCT:
|
|
542
517
|
return function (subTotalPrice) { return subTotalPrice; };
|
|
543
|
-
case
|
|
518
|
+
case connect.CouponTypes.GIFTCARD:
|
|
544
519
|
return this.getFinancialDiscount(coupon);
|
|
545
|
-
case
|
|
520
|
+
case connect.CouponTypes.VOUCHER:
|
|
546
521
|
return function (subTotalPrice) { return subTotalPrice; };
|
|
547
522
|
}
|
|
548
523
|
};
|
|
549
524
|
CartService.prototype.getVariantPriceDiscount = function (item, shop) {
|
|
550
|
-
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); }));
|
|
551
526
|
};
|
|
552
527
|
CartService.prototype.removeItem = function (item) {
|
|
553
528
|
var _this = this;
|
|
554
|
-
this.checkoutService
|
|
555
|
-
.
|
|
556
|
-
.pipe(operators.map(function (checkout) {
|
|
557
|
-
var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; });
|
|
558
|
-
if (index >= 0)
|
|
559
|
-
checkout.lineItems.splice(index, 1);
|
|
560
|
-
return checkout;
|
|
561
|
-
}), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }))
|
|
562
|
-
.subscribe(function (cart) { return _this.cartSubject.next(cart); });
|
|
563
|
-
return this.cartSubject;
|
|
564
|
-
};
|
|
565
|
-
CartService.prototype.updateUserCart = function (user) {
|
|
566
|
-
var _this = this;
|
|
567
|
-
this.checkoutService
|
|
568
|
-
.getCheckout()
|
|
569
|
-
.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); }))
|
|
570
|
-
.subscribe(function (cart) { return _this.cartSubject.next(cart); });
|
|
571
|
-
return this.cartSubject;
|
|
572
|
-
};
|
|
573
|
-
CartService.prototype.clearCart = function () {
|
|
574
|
-
var _this = this;
|
|
575
|
-
var observable = this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
576
|
-
_this.checkoutService.clearCheckoutFromSession();
|
|
529
|
+
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
530
|
+
checkout.lineItems.splice(checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; }), 1);
|
|
577
531
|
return checkout;
|
|
578
|
-
}), operators.
|
|
579
|
-
observable.subscribe(function (cart) { return _this.cartSubject.next(cart); });
|
|
580
|
-
return observable;
|
|
581
|
-
};
|
|
582
|
-
CartService.prototype.buildCartFromCheckout = function (checkoutData) {
|
|
583
|
-
var _this = this;
|
|
584
|
-
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); }));
|
|
585
533
|
};
|
|
586
534
|
CartService.prototype.getFinancialDiscount = function (coupon) {
|
|
587
535
|
return function (subTotalPrice) {
|
|
588
|
-
if (
|
|
536
|
+
if (connect.FinancialCoupon.isFinancialCoupon(coupon))
|
|
589
537
|
switch (coupon.subtype) {
|
|
590
|
-
case
|
|
538
|
+
case connect.CouponSubtypes.ABSOLUTE:
|
|
591
539
|
return subTotalPrice - coupon.discount * 100;
|
|
592
|
-
case
|
|
540
|
+
case connect.CouponSubtypes.PERCENTAGE:
|
|
593
541
|
return subTotalPrice * (1 - coupon.discount / 100);
|
|
594
542
|
}
|
|
595
543
|
};
|
|
596
544
|
};
|
|
597
545
|
return CartService;
|
|
598
546
|
}());
|
|
599
|
-
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 });
|
|
600
548
|
CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService });
|
|
601
549
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService, decorators: [{
|
|
602
550
|
type: i0.Injectable
|
|
603
|
-
}], ctorParameters: function () {
|
|
604
|
-
return [{ type: AuthService }, { type: CheckoutService }, { type: i1__namespace$1.Shops, decorators: [{
|
|
605
|
-
type: i0.Inject,
|
|
606
|
-
args: [DEFAULT_SHOP]
|
|
607
|
-
}] }];
|
|
608
|
-
} });
|
|
551
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }]; } });
|
|
609
552
|
|
|
610
553
|
var AngularFirebaseAuthModule = /** @class */ (function () {
|
|
611
554
|
function AngularFirebaseAuthModule() {
|
|
@@ -627,21 +570,21 @@
|
|
|
627
570
|
{
|
|
628
571
|
provide: 'Authentication',
|
|
629
572
|
useFactory: function (authenticationService, userRepository) {
|
|
630
|
-
return new
|
|
573
|
+
return new connect.Authentication(authenticationService, userRepository);
|
|
631
574
|
},
|
|
632
575
|
deps: ['AuthenticationService', 'UserRepository'],
|
|
633
576
|
},
|
|
634
577
|
{
|
|
635
578
|
provide: 'AuthenticationService',
|
|
636
579
|
useFactory: function (angularFireAuth) {
|
|
637
|
-
return new
|
|
580
|
+
return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
638
581
|
},
|
|
639
582
|
deps: [i1.AngularFireAuth],
|
|
640
583
|
},
|
|
641
584
|
{
|
|
642
585
|
provide: 'SignOut',
|
|
643
586
|
useFactory: function (authenticationService) {
|
|
644
|
-
return new
|
|
587
|
+
return new connect.SignOut(authenticationService);
|
|
645
588
|
},
|
|
646
589
|
deps: ['AuthenticationService'],
|
|
647
590
|
},
|
|
@@ -654,21 +597,21 @@
|
|
|
654
597
|
{
|
|
655
598
|
provide: 'Authentication',
|
|
656
599
|
useFactory: function (authenticationService, userRepository) {
|
|
657
|
-
return new
|
|
600
|
+
return new connect.Authentication(authenticationService, userRepository);
|
|
658
601
|
},
|
|
659
602
|
deps: ['AuthenticationService', 'UserRepository'],
|
|
660
603
|
},
|
|
661
604
|
{
|
|
662
605
|
provide: 'AuthenticationService',
|
|
663
606
|
useFactory: function (angularFireAuth) {
|
|
664
|
-
return new
|
|
607
|
+
return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
665
608
|
},
|
|
666
609
|
deps: [i1.AngularFireAuth],
|
|
667
610
|
},
|
|
668
611
|
{
|
|
669
612
|
provide: 'SignOut',
|
|
670
613
|
useFactory: function (authenticationService) {
|
|
671
|
-
return new
|
|
614
|
+
return new connect.SignOut(authenticationService);
|
|
672
615
|
},
|
|
673
616
|
deps: ['AuthenticationService'],
|
|
674
617
|
},
|
|
@@ -696,126 +639,126 @@
|
|
|
696
639
|
{
|
|
697
640
|
provide: 'BeautyProfileRepository',
|
|
698
641
|
useFactory: function (firestore, userRepository) {
|
|
699
|
-
return new
|
|
642
|
+
return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
700
643
|
},
|
|
701
644
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
702
645
|
},
|
|
703
646
|
{
|
|
704
647
|
provide: 'Buy2WinRepository',
|
|
705
648
|
useFactory: function (firestore) {
|
|
706
|
-
return new
|
|
649
|
+
return new connect.Buy2WinFirestoreRepository(firestore.firestore);
|
|
707
650
|
},
|
|
708
651
|
deps: [firestore.AngularFirestore],
|
|
709
652
|
},
|
|
710
653
|
{
|
|
711
654
|
provide: 'CategoryRepository',
|
|
712
655
|
useFactory: function (firestore) {
|
|
713
|
-
return new
|
|
656
|
+
return new connect.CategoryFirestoreRepository(firestore.firestore);
|
|
714
657
|
},
|
|
715
658
|
deps: [firestore.AngularFirestore],
|
|
716
659
|
},
|
|
717
660
|
{
|
|
718
661
|
provide: 'CheckoutRepository',
|
|
719
662
|
useFactory: function (firestore) {
|
|
720
|
-
return new
|
|
663
|
+
return new connect.CheckoutFirestoreRepository(firestore.firestore);
|
|
721
664
|
},
|
|
722
665
|
deps: [firestore.AngularFirestore],
|
|
723
666
|
},
|
|
724
667
|
{
|
|
725
668
|
provide: 'CheckoutSubscriptionRepository',
|
|
726
669
|
useFactory: function (firestore) {
|
|
727
|
-
return new
|
|
670
|
+
return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
728
671
|
},
|
|
729
672
|
deps: [firestore.AngularFirestore],
|
|
730
673
|
},
|
|
731
674
|
{
|
|
732
675
|
provide: 'CouponRepository',
|
|
733
676
|
useFactory: function (firestore) {
|
|
734
|
-
return new
|
|
677
|
+
return new connect.CouponFirestoreRepository(firestore.firestore);
|
|
735
678
|
},
|
|
736
679
|
deps: [firestore.AngularFirestore],
|
|
737
680
|
},
|
|
738
681
|
{
|
|
739
682
|
provide: 'EditionRepository',
|
|
740
683
|
useFactory: function (firestore, subscriptionRepository) {
|
|
741
|
-
return new
|
|
684
|
+
return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
742
685
|
},
|
|
743
686
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
744
687
|
},
|
|
745
688
|
{
|
|
746
689
|
provide: 'HomeRepository',
|
|
747
690
|
useFactory: function (firestore) {
|
|
748
|
-
return new
|
|
691
|
+
return new connect.HomeFirestoreRepository(firestore.firestore);
|
|
749
692
|
},
|
|
750
693
|
deps: [firestore.AngularFirestore],
|
|
751
694
|
},
|
|
752
695
|
{
|
|
753
696
|
provide: 'ShopMenuRepository',
|
|
754
697
|
useFactory: function (firestore) {
|
|
755
|
-
return new
|
|
698
|
+
return new connect.ShopMenuFirestoreRepository(firestore.firestore);
|
|
756
699
|
},
|
|
757
700
|
deps: [firestore.AngularFirestore],
|
|
758
701
|
},
|
|
759
702
|
{
|
|
760
703
|
provide: 'OrderRepository',
|
|
761
704
|
useFactory: function (firestore) {
|
|
762
|
-
return new
|
|
705
|
+
return new connect.OrderFirestoreRepository(firestore.firestore);
|
|
763
706
|
},
|
|
764
707
|
deps: [firestore.AngularFirestore],
|
|
765
708
|
},
|
|
766
709
|
{
|
|
767
710
|
provide: 'PaymentRepository',
|
|
768
711
|
useFactory: function (firestore) {
|
|
769
|
-
return new
|
|
712
|
+
return new connect.PaymentFirestoreRepository(firestore.firestore);
|
|
770
713
|
},
|
|
771
714
|
deps: [firestore.AngularFirestore],
|
|
772
715
|
},
|
|
773
716
|
{
|
|
774
717
|
provide: 'ProductRepository',
|
|
775
718
|
useFactory: function (firestore) {
|
|
776
|
-
return new
|
|
719
|
+
return new connect.ProductFirestoreRepository(firestore.firestore);
|
|
777
720
|
},
|
|
778
721
|
deps: [firestore.AngularFirestore],
|
|
779
722
|
},
|
|
780
723
|
{
|
|
781
724
|
provide: 'SubscriptionPaymentRepository',
|
|
782
725
|
useFactory: function (firestore, subscriptionRepository) {
|
|
783
|
-
return new
|
|
726
|
+
return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
784
727
|
},
|
|
785
728
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
786
729
|
},
|
|
787
730
|
{
|
|
788
731
|
provide: 'SubscriptionPlanRepository',
|
|
789
732
|
useFactory: function (firestore) {
|
|
790
|
-
return new
|
|
733
|
+
return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
791
734
|
},
|
|
792
735
|
deps: [firestore.AngularFirestore],
|
|
793
736
|
},
|
|
794
737
|
{
|
|
795
738
|
provide: 'SubscriptionRepository',
|
|
796
739
|
useFactory: function (firestore) {
|
|
797
|
-
return new
|
|
740
|
+
return new connect.SubscriptionFirestoreRepository(firestore.firestore);
|
|
798
741
|
},
|
|
799
742
|
deps: [firestore.AngularFirestore],
|
|
800
743
|
},
|
|
801
744
|
{
|
|
802
745
|
provide: 'UserRepository',
|
|
803
746
|
useFactory: function (firestore) {
|
|
804
|
-
return new
|
|
747
|
+
return new connect.UserFirestoreRepository(firestore.firestore);
|
|
805
748
|
},
|
|
806
749
|
deps: [firestore.AngularFirestore],
|
|
807
750
|
},
|
|
808
751
|
{
|
|
809
752
|
provide: 'UserAddressRepository',
|
|
810
753
|
useFactory: function (firestore, userRepository) {
|
|
811
|
-
return new
|
|
754
|
+
return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
812
755
|
},
|
|
813
756
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
814
757
|
},
|
|
815
758
|
{
|
|
816
759
|
provide: 'VariantRepository',
|
|
817
760
|
useFactory: function (firestore, productRepository) {
|
|
818
|
-
return new
|
|
761
|
+
return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
819
762
|
},
|
|
820
763
|
deps: [firestore.AngularFirestore, 'ProductRepository'],
|
|
821
764
|
},
|
|
@@ -828,126 +771,126 @@
|
|
|
828
771
|
{
|
|
829
772
|
provide: 'BeautyProfileRepository',
|
|
830
773
|
useFactory: function (firestore, userRepository) {
|
|
831
|
-
return new
|
|
774
|
+
return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
832
775
|
},
|
|
833
776
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
834
777
|
},
|
|
835
778
|
{
|
|
836
779
|
provide: 'Buy2WinRepository',
|
|
837
780
|
useFactory: function (firestore) {
|
|
838
|
-
return new
|
|
781
|
+
return new connect.Buy2WinFirestoreRepository(firestore.firestore);
|
|
839
782
|
},
|
|
840
783
|
deps: [firestore.AngularFirestore],
|
|
841
784
|
},
|
|
842
785
|
{
|
|
843
786
|
provide: 'CategoryRepository',
|
|
844
787
|
useFactory: function (firestore) {
|
|
845
|
-
return new
|
|
788
|
+
return new connect.CategoryFirestoreRepository(firestore.firestore);
|
|
846
789
|
},
|
|
847
790
|
deps: [firestore.AngularFirestore],
|
|
848
791
|
},
|
|
849
792
|
{
|
|
850
793
|
provide: 'CheckoutRepository',
|
|
851
794
|
useFactory: function (firestore) {
|
|
852
|
-
return new
|
|
795
|
+
return new connect.CheckoutFirestoreRepository(firestore.firestore);
|
|
853
796
|
},
|
|
854
797
|
deps: [firestore.AngularFirestore],
|
|
855
798
|
},
|
|
856
799
|
{
|
|
857
800
|
provide: 'CheckoutSubscriptionRepository',
|
|
858
801
|
useFactory: function (firestore) {
|
|
859
|
-
return new
|
|
802
|
+
return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
860
803
|
},
|
|
861
804
|
deps: [firestore.AngularFirestore],
|
|
862
805
|
},
|
|
863
806
|
{
|
|
864
807
|
provide: 'CouponRepository',
|
|
865
808
|
useFactory: function (firestore) {
|
|
866
|
-
return new
|
|
809
|
+
return new connect.CouponFirestoreRepository(firestore.firestore);
|
|
867
810
|
},
|
|
868
811
|
deps: [firestore.AngularFirestore],
|
|
869
812
|
},
|
|
870
813
|
{
|
|
871
814
|
provide: 'EditionRepository',
|
|
872
815
|
useFactory: function (firestore, subscriptionRepository) {
|
|
873
|
-
return new
|
|
816
|
+
return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
874
817
|
},
|
|
875
818
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
876
819
|
},
|
|
877
820
|
{
|
|
878
821
|
provide: 'HomeRepository',
|
|
879
822
|
useFactory: function (firestore) {
|
|
880
|
-
return new
|
|
823
|
+
return new connect.HomeFirestoreRepository(firestore.firestore);
|
|
881
824
|
},
|
|
882
825
|
deps: [firestore.AngularFirestore],
|
|
883
826
|
},
|
|
884
827
|
{
|
|
885
828
|
provide: 'ShopMenuRepository',
|
|
886
829
|
useFactory: function (firestore) {
|
|
887
|
-
return new
|
|
830
|
+
return new connect.ShopMenuFirestoreRepository(firestore.firestore);
|
|
888
831
|
},
|
|
889
832
|
deps: [firestore.AngularFirestore],
|
|
890
833
|
},
|
|
891
834
|
{
|
|
892
835
|
provide: 'OrderRepository',
|
|
893
836
|
useFactory: function (firestore) {
|
|
894
|
-
return new
|
|
837
|
+
return new connect.OrderFirestoreRepository(firestore.firestore);
|
|
895
838
|
},
|
|
896
839
|
deps: [firestore.AngularFirestore],
|
|
897
840
|
},
|
|
898
841
|
{
|
|
899
842
|
provide: 'PaymentRepository',
|
|
900
843
|
useFactory: function (firestore) {
|
|
901
|
-
return new
|
|
844
|
+
return new connect.PaymentFirestoreRepository(firestore.firestore);
|
|
902
845
|
},
|
|
903
846
|
deps: [firestore.AngularFirestore],
|
|
904
847
|
},
|
|
905
848
|
{
|
|
906
849
|
provide: 'ProductRepository',
|
|
907
850
|
useFactory: function (firestore) {
|
|
908
|
-
return new
|
|
851
|
+
return new connect.ProductFirestoreRepository(firestore.firestore);
|
|
909
852
|
},
|
|
910
853
|
deps: [firestore.AngularFirestore],
|
|
911
854
|
},
|
|
912
855
|
{
|
|
913
856
|
provide: 'SubscriptionPaymentRepository',
|
|
914
857
|
useFactory: function (firestore, subscriptionRepository) {
|
|
915
|
-
return new
|
|
858
|
+
return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
916
859
|
},
|
|
917
860
|
deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
|
|
918
861
|
},
|
|
919
862
|
{
|
|
920
863
|
provide: 'SubscriptionPlanRepository',
|
|
921
864
|
useFactory: function (firestore) {
|
|
922
|
-
return new
|
|
865
|
+
return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
923
866
|
},
|
|
924
867
|
deps: [firestore.AngularFirestore],
|
|
925
868
|
},
|
|
926
869
|
{
|
|
927
870
|
provide: 'SubscriptionRepository',
|
|
928
871
|
useFactory: function (firestore) {
|
|
929
|
-
return new
|
|
872
|
+
return new connect.SubscriptionFirestoreRepository(firestore.firestore);
|
|
930
873
|
},
|
|
931
874
|
deps: [firestore.AngularFirestore],
|
|
932
875
|
},
|
|
933
876
|
{
|
|
934
877
|
provide: 'UserRepository',
|
|
935
878
|
useFactory: function (firestore) {
|
|
936
|
-
return new
|
|
879
|
+
return new connect.UserFirestoreRepository(firestore.firestore);
|
|
937
880
|
},
|
|
938
881
|
deps: [firestore.AngularFirestore],
|
|
939
882
|
},
|
|
940
883
|
{
|
|
941
884
|
provide: 'UserAddressRepository',
|
|
942
885
|
useFactory: function (firestore, userRepository) {
|
|
943
|
-
return new
|
|
886
|
+
return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
944
887
|
},
|
|
945
888
|
deps: [firestore.AngularFirestore, 'UserRepository'],
|
|
946
889
|
},
|
|
947
890
|
{
|
|
948
891
|
provide: 'VariantRepository',
|
|
949
892
|
useFactory: function (firestore, productRepository) {
|
|
950
|
-
return new
|
|
893
|
+
return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
951
894
|
},
|
|
952
895
|
deps: [firestore.AngularFirestore, 'ProductRepository'],
|
|
953
896
|
},
|
|
@@ -958,10 +901,13 @@
|
|
|
958
901
|
var AngularConnectModule = /** @class */ (function () {
|
|
959
902
|
function AngularConnectModule() {
|
|
960
903
|
}
|
|
961
|
-
AngularConnectModule.initializeApp = function (
|
|
904
|
+
AngularConnectModule.initializeApp = function (options, nameOrConfig) {
|
|
962
905
|
return {
|
|
963
906
|
ngModule: AngularConnectModule,
|
|
964
|
-
providers:
|
|
907
|
+
providers: [
|
|
908
|
+
{ provide: fire.FIREBASE_OPTIONS, useValue: options },
|
|
909
|
+
{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
910
|
+
],
|
|
965
911
|
};
|
|
966
912
|
};
|
|
967
913
|
return AngularConnectModule;
|