@infrab4a/connect-angular 0.10.0 → 0.11.0
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 +258 -164
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/lib/angular-connect.module.js +4 -4
- package/esm2015/lib/services/auth.service.js +15 -6
- package/esm2015/lib/services/cart.service.js +7 -1
- package/esm2015/lib/services/checkout.service.js +28 -6
- package/esm2015/lib/services/coupon.service.js +51 -0
- package/esm2015/lib/services/errors/index.js +2 -0
- package/esm2015/lib/services/errors/invalid-coupon.error.js +7 -0
- package/esm2015/lib/services/index.js +2 -1
- package/fesm2015/infrab4a-connect-angular.js +103 -18
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/lib/services/auth.service.d.ts +4 -1
- package/lib/services/cart.service.d.ts +6 -0
- package/lib/services/checkout.service.d.ts +6 -2
- package/lib/services/coupon.service.d.ts +13 -0
- package/lib/services/errors/index.d.ts +1 -0
- package/lib/services/errors/invalid-coupon.error.d.ts +4 -0
- package/lib/services/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
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/firestore'), require('@angular/fire')) :
|
|
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/firestore', '@angular/fire'], factory) :
|
|
4
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["@infrab4a/connect"], global["js-cookie"], global.ng.fire.firestore, global.ng.fire));
|
|
5
|
-
})(this, (function (exports, i0, rxjs, operators, i1,
|
|
5
|
+
})(this, (function (exports, i0, rxjs, operators, i1, i2, cookie, i1$1, fire) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -26,43 +26,9 @@
|
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
28
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
-
var
|
|
29
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
30
30
|
var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
|
|
31
|
-
var i1__namespace$
|
|
32
|
-
|
|
33
|
-
var AuthService = /** @class */ (function () {
|
|
34
|
-
function AuthService(angularFireAuth, userRepository) {
|
|
35
|
-
this.angularFireAuth = angularFireAuth;
|
|
36
|
-
this.userRepository = userRepository;
|
|
37
|
-
}
|
|
38
|
-
AuthService.prototype.getAuthstate = function () {
|
|
39
|
-
var _this = this;
|
|
40
|
-
return this.angularFireAuth.authState.pipe(operators.mergeMap(function () { return _this.getUser(); }));
|
|
41
|
-
};
|
|
42
|
-
AuthService.prototype.getUser = function () {
|
|
43
|
-
var _this = this;
|
|
44
|
-
return this.getFireUser().pipe(operators.map(function (user) { return user.uid || rxjs.throwError(function () { return new Error('Usuário não logado'); }); }), operators.mergeMap(function (id) { return _this.userRepository.get({ id: id }); }));
|
|
45
|
-
};
|
|
46
|
-
AuthService.prototype.getTokenId = function () {
|
|
47
|
-
return this.angularFireAuth.idToken;
|
|
48
|
-
};
|
|
49
|
-
AuthService.prototype.getFireUser = function () {
|
|
50
|
-
return this.angularFireAuth.user;
|
|
51
|
-
};
|
|
52
|
-
return AuthService;
|
|
53
|
-
}());
|
|
54
|
-
AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.AngularFireAuth }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
55
|
-
AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
|
|
56
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
|
|
57
|
-
type: i0.Injectable
|
|
58
|
-
}], ctorParameters: function () {
|
|
59
|
-
return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
|
|
60
|
-
type: i0.Inject,
|
|
61
|
-
args: ['UserRepository']
|
|
62
|
-
}] }];
|
|
63
|
-
} });
|
|
64
|
-
|
|
65
|
-
var DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
31
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
66
32
|
|
|
67
33
|
/*! *****************************************************************************
|
|
68
34
|
Copyright (c) Microsoft Corporation.
|
|
@@ -382,40 +348,158 @@
|
|
|
382
348
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
383
349
|
}
|
|
384
350
|
|
|
351
|
+
var AuthService = /** @class */ (function () {
|
|
352
|
+
function AuthService(angularFireAuth, userRepository) {
|
|
353
|
+
this.angularFireAuth = angularFireAuth;
|
|
354
|
+
this.userRepository = userRepository;
|
|
355
|
+
}
|
|
356
|
+
AuthService.prototype.getAuthstate = function () {
|
|
357
|
+
var observables = [
|
|
358
|
+
this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
|
|
359
|
+
this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
|
|
360
|
+
];
|
|
361
|
+
return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
|
|
362
|
+
var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
|
|
363
|
+
return {
|
|
364
|
+
user: user,
|
|
365
|
+
isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
|
|
366
|
+
};
|
|
367
|
+
}));
|
|
368
|
+
};
|
|
369
|
+
AuthService.prototype.getUser = function () {
|
|
370
|
+
var _this = this;
|
|
371
|
+
return this.getFireUser().pipe(operators.map(function (user) { return user === null || user === void 0 ? void 0 : user.uid; }), operators.mergeMap(function (id) { return (id ? _this.userRepository.get({ id: id }) : rxjs.of(null)); }));
|
|
372
|
+
};
|
|
373
|
+
AuthService.prototype.getTokenId = function () {
|
|
374
|
+
return this.angularFireAuth.idToken;
|
|
375
|
+
};
|
|
376
|
+
AuthService.prototype.getFireUser = function () {
|
|
377
|
+
return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
|
|
378
|
+
};
|
|
379
|
+
return AuthService;
|
|
380
|
+
}());
|
|
381
|
+
AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.AngularFireAuth }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
382
|
+
AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
|
|
383
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
|
|
384
|
+
type: i0.Injectable
|
|
385
|
+
}], ctorParameters: function () {
|
|
386
|
+
return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
|
|
387
|
+
type: i0.Inject,
|
|
388
|
+
args: ['UserRepository']
|
|
389
|
+
}] }];
|
|
390
|
+
} });
|
|
391
|
+
|
|
392
|
+
var DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
393
|
+
|
|
394
|
+
var InvalidCouponError = /** @class */ (function (_super) {
|
|
395
|
+
__extends(InvalidCouponError, _super);
|
|
396
|
+
function InvalidCouponError(message) {
|
|
397
|
+
var _this = _super.call(this, message) || this;
|
|
398
|
+
_this.message = message;
|
|
399
|
+
return _this;
|
|
400
|
+
}
|
|
401
|
+
return InvalidCouponError;
|
|
402
|
+
}(Error));
|
|
403
|
+
|
|
404
|
+
var CouponService = /** @class */ (function () {
|
|
405
|
+
function CouponService(couponRepository, defaultShop) {
|
|
406
|
+
this.couponRepository = couponRepository;
|
|
407
|
+
this.defaultShop = defaultShop;
|
|
408
|
+
this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
|
|
409
|
+
}
|
|
410
|
+
CouponService.prototype.checkCoupon = function (nickname, userEmail) {
|
|
411
|
+
var _this = this;
|
|
412
|
+
return rxjs.from(this.couponRepository.find([
|
|
413
|
+
{
|
|
414
|
+
nickname: { operator: i2.Where.EQUALS, value: nickname },
|
|
415
|
+
shopAvailability: { operator: i2.Where.EQUALS, value: this.defaultShop },
|
|
416
|
+
},
|
|
417
|
+
])).pipe(operators.concatMap(function (coupons) { return coupons.count < 1 ? rxjs.throwError(function () { return new i2.NotFoundError('Coupon not found'); }) : rxjs.of(coupons.data[0]); }), operators.concatMap(function (coupon) { return i2.FinancialCoupon.isFinancialCoupon(coupon) && _this.isValidCoupon(coupon, userEmail)
|
|
418
|
+
? rxjs.of(coupon)
|
|
419
|
+
: rxjs.throwError(function () { return new InvalidCouponError('Coupon is not valid'); }); }));
|
|
420
|
+
};
|
|
421
|
+
CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
|
|
422
|
+
if (coupon.checkoutType !== i2.CheckoutTypes.ECOMMERCE)
|
|
423
|
+
throw new InvalidCouponError('Coupon is not ecommerce valid');
|
|
424
|
+
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i2.Exclusivities.COLLABORATORS)
|
|
425
|
+
throw new InvalidCouponError('User is not a collaborator');
|
|
426
|
+
if (coupon.exclusivityType === i2.Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
|
|
427
|
+
throw new InvalidCouponError('Coupon is not valid for user');
|
|
428
|
+
if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
|
|
429
|
+
throw new InvalidCouponError('Coupon is expired');
|
|
430
|
+
return true;
|
|
431
|
+
};
|
|
432
|
+
return CouponService;
|
|
433
|
+
}());
|
|
434
|
+
CouponService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
435
|
+
CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
|
|
436
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
|
|
437
|
+
type: i0.Injectable,
|
|
438
|
+
args: [{
|
|
439
|
+
providedIn: 'root',
|
|
440
|
+
}]
|
|
441
|
+
}], ctorParameters: function () {
|
|
442
|
+
return [{ type: undefined, decorators: [{
|
|
443
|
+
type: i0.Inject,
|
|
444
|
+
args: ['CouponRepository']
|
|
445
|
+
}] }, { type: i2__namespace.Shops, decorators: [{
|
|
446
|
+
type: i0.Inject,
|
|
447
|
+
args: [DEFAULT_SHOP]
|
|
448
|
+
}] }];
|
|
449
|
+
} });
|
|
450
|
+
|
|
385
451
|
var CheckoutService = /** @class */ (function () {
|
|
386
|
-
function CheckoutService(checkoutRepository, userRepository, defaultShop) {
|
|
452
|
+
function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
|
|
453
|
+
this.couponService = couponService;
|
|
387
454
|
this.checkoutRepository = checkoutRepository;
|
|
455
|
+
this.orderRepository = orderRepository;
|
|
388
456
|
this.userRepository = userRepository;
|
|
389
457
|
this.defaultShop = defaultShop;
|
|
390
458
|
}
|
|
391
459
|
CheckoutService.prototype.getCheckout = function (checkoutData) {
|
|
392
460
|
var checkoutId = cookie__default["default"].get('checkoutId');
|
|
393
|
-
if (!
|
|
461
|
+
if (!i2.isNil(checkoutId))
|
|
394
462
|
return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
|
|
395
463
|
return rxjs.from(this.createCheckout(checkoutData));
|
|
396
464
|
};
|
|
397
465
|
CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
|
|
398
466
|
var _this = this;
|
|
399
|
-
return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.concatMap(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.concatMap(function (user) { return rxjs.of(user) || rxjs.throwError(function () { return new
|
|
467
|
+
return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.concatMap(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.concatMap(function (user) { return rxjs.of(user) || rxjs.throwError(function () { return new i2.NotFoundError('User is not found'); }); }));
|
|
400
468
|
};
|
|
401
469
|
CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
|
|
402
|
-
return rxjs.from(this.checkoutRepository.update(
|
|
470
|
+
return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
403
471
|
};
|
|
404
472
|
CheckoutService.prototype.updateCheckoutUser = function (checkout) {
|
|
405
|
-
return rxjs.from(this.checkoutRepository.update(
|
|
473
|
+
return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
406
474
|
};
|
|
407
475
|
CheckoutService.prototype.clearCheckoutFromSession = function () {
|
|
408
476
|
cookie__default["default"].remove('checkoutId');
|
|
409
477
|
return rxjs.of();
|
|
410
478
|
};
|
|
479
|
+
CheckoutService.prototype.checkCoupon = function (nickname) {
|
|
480
|
+
var _this = this;
|
|
481
|
+
return this.getCheckout().pipe(operators.concatMap(function (checkout) {
|
|
482
|
+
var _a;
|
|
483
|
+
return _this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email).pipe(operators.concatMap(function (coupon) {
|
|
484
|
+
var _a, _b;
|
|
485
|
+
return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email)
|
|
486
|
+
? rxjs.from(_this.orderRepository.find([{ user: { email: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email }, coupon: { id: coupon.id } }])).pipe(operators.concatMap(function (orders) {
|
|
487
|
+
if (orders.data.length >= (coupon.useLimit || 1))
|
|
488
|
+
return rxjs.throwError(function () { return new Error('Coupon is already applied'); });
|
|
489
|
+
return rxjs.of(coupon);
|
|
490
|
+
}))
|
|
491
|
+
: rxjs.of(coupon);
|
|
492
|
+
}));
|
|
493
|
+
}));
|
|
494
|
+
};
|
|
411
495
|
CheckoutService.prototype.createCheckout = function (checkoutData) {
|
|
412
496
|
return __awaiter(this, void 0, void 0, function () {
|
|
413
497
|
var checkout;
|
|
414
|
-
return __generator(this, function (
|
|
415
|
-
switch (
|
|
416
|
-
case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() },
|
|
498
|
+
return __generator(this, function (_c) {
|
|
499
|
+
switch (_c.label) {
|
|
500
|
+
case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i2.Checkout.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
|
|
417
501
|
case 1:
|
|
418
|
-
checkout =
|
|
502
|
+
checkout = _c.sent();
|
|
419
503
|
cookie__default["default"].set('checkoutId', checkout.id);
|
|
420
504
|
return [2 /*return*/, checkout];
|
|
421
505
|
}
|
|
@@ -424,18 +508,21 @@
|
|
|
424
508
|
};
|
|
425
509
|
return CheckoutService;
|
|
426
510
|
}());
|
|
427
|
-
CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: 'CheckoutRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
511
|
+
CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'OrderRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
428
512
|
CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
|
|
429
513
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
|
|
430
514
|
type: i0.Injectable
|
|
431
515
|
}], ctorParameters: function () {
|
|
432
|
-
return [{ type: undefined, decorators: [{
|
|
516
|
+
return [{ type: CouponService }, { type: undefined, decorators: [{
|
|
433
517
|
type: i0.Inject,
|
|
434
518
|
args: ['CheckoutRepository']
|
|
519
|
+
}] }, { type: undefined, decorators: [{
|
|
520
|
+
type: i0.Inject,
|
|
521
|
+
args: ['OrderRepository']
|
|
435
522
|
}] }, { type: undefined, decorators: [{
|
|
436
523
|
type: i0.Inject,
|
|
437
524
|
args: ['UserRepository']
|
|
438
|
-
}] }, { type:
|
|
525
|
+
}] }, { type: i2__namespace.Shops, decorators: [{
|
|
439
526
|
type: i0.Inject,
|
|
440
527
|
args: [DEFAULT_SHOP]
|
|
441
528
|
}] }];
|
|
@@ -448,7 +535,7 @@
|
|
|
448
535
|
this.checkoutService = checkoutService;
|
|
449
536
|
this.defaultShop = defaultShop;
|
|
450
537
|
this.cartSubject = new rxjs.Subject();
|
|
451
|
-
this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (
|
|
538
|
+
this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i2.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
|
|
452
539
|
var _a;
|
|
453
540
|
var items = [];
|
|
454
541
|
var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
|
|
@@ -466,7 +553,7 @@
|
|
|
466
553
|
var cart = {};
|
|
467
554
|
items === null || items === void 0 ? void 0 : items.forEach(function (item) {
|
|
468
555
|
var _a;
|
|
469
|
-
return (cart[item.sku] =
|
|
556
|
+
return (cart[item.sku] = i2.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) })));
|
|
470
557
|
});
|
|
471
558
|
return cart;
|
|
472
559
|
};
|
|
@@ -484,7 +571,7 @@
|
|
|
484
571
|
shop: checkout.shop || _this.defaultShop,
|
|
485
572
|
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
486
573
|
});
|
|
487
|
-
return
|
|
574
|
+
return i2.LineItem.toInstance({
|
|
488
575
|
id: id,
|
|
489
576
|
name: name,
|
|
490
577
|
brand: brand,
|
|
@@ -527,7 +614,7 @@
|
|
|
527
614
|
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
528
615
|
var _a;
|
|
529
616
|
var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
|
|
530
|
-
if (!
|
|
617
|
+
if (!i2.isNil(checkoutItem))
|
|
531
618
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
532
619
|
return checkout;
|
|
533
620
|
}), 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); }));
|
|
@@ -537,18 +624,24 @@
|
|
|
537
624
|
this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
|
|
538
625
|
return this.cartSubject;
|
|
539
626
|
};
|
|
627
|
+
/**
|
|
628
|
+
* @deprecated The method should not be used
|
|
629
|
+
*/
|
|
540
630
|
CartService.prototype.getDiscount = function (coupon) {
|
|
541
631
|
switch (coupon.type) {
|
|
542
|
-
case
|
|
632
|
+
case i2.CouponTypes.FINANCIAL:
|
|
543
633
|
return this.getFinancialDiscount(coupon);
|
|
544
|
-
case
|
|
634
|
+
case i2.CouponTypes.PRODUCT:
|
|
545
635
|
return function (subTotalPrice) { return subTotalPrice; };
|
|
546
|
-
case
|
|
636
|
+
case i2.CouponTypes.GIFTCARD:
|
|
547
637
|
return this.getFinancialDiscount(coupon);
|
|
548
|
-
case
|
|
638
|
+
case i2.CouponTypes.VOUCHER:
|
|
549
639
|
return function (subTotalPrice) { return subTotalPrice; };
|
|
550
640
|
}
|
|
551
641
|
};
|
|
642
|
+
/**
|
|
643
|
+
* @deprecated The method should not be used
|
|
644
|
+
*/
|
|
552
645
|
CartService.prototype.getVariantPriceDiscount = function (item, shop) {
|
|
553
646
|
return this.authService.getUser().pipe(operators.concatMap(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); }));
|
|
554
647
|
};
|
|
@@ -563,7 +656,7 @@
|
|
|
563
656
|
};
|
|
564
657
|
CartService.prototype.updateUserCart = function (user) {
|
|
565
658
|
var _this = this;
|
|
566
|
-
return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(
|
|
659
|
+
return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i2.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(i2.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); }));
|
|
567
660
|
};
|
|
568
661
|
CartService.prototype.clearCart = function () {
|
|
569
662
|
var _this = this;
|
|
@@ -578,11 +671,11 @@
|
|
|
578
671
|
};
|
|
579
672
|
CartService.prototype.getFinancialDiscount = function (coupon) {
|
|
580
673
|
return function (subTotalPrice) {
|
|
581
|
-
if (
|
|
674
|
+
if (i2.FinancialCoupon.isFinancialCoupon(coupon))
|
|
582
675
|
switch (coupon.subtype) {
|
|
583
|
-
case
|
|
676
|
+
case i2.CouponSubtypes.ABSOLUTE:
|
|
584
677
|
return subTotalPrice - coupon.discount * 100;
|
|
585
|
-
case
|
|
678
|
+
case i2.CouponSubtypes.PERCENTAGE:
|
|
586
679
|
return subTotalPrice * (1 - coupon.discount / 100);
|
|
587
680
|
}
|
|
588
681
|
};
|
|
@@ -594,7 +687,7 @@
|
|
|
594
687
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
|
|
595
688
|
type: i0.Injectable
|
|
596
689
|
}], ctorParameters: function () {
|
|
597
|
-
return [{ type: AuthService }, { type: CheckoutService }, { type:
|
|
690
|
+
return [{ type: AuthService }, { type: CheckoutService }, { type: i2__namespace.Shops, decorators: [{
|
|
598
691
|
type: i0.Inject,
|
|
599
692
|
args: [DEFAULT_SHOP]
|
|
600
693
|
}] }];
|
|
@@ -606,7 +699,7 @@
|
|
|
606
699
|
}
|
|
607
700
|
CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
|
|
608
701
|
var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
|
|
609
|
-
if (!
|
|
702
|
+
if (!i2.isNil(checkoutId))
|
|
610
703
|
return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
|
|
611
704
|
return rxjs.from(this.createCheckoutSubscription(checkoutData));
|
|
612
705
|
};
|
|
@@ -615,7 +708,7 @@
|
|
|
615
708
|
var checkout;
|
|
616
709
|
return __generator(this, function (_a) {
|
|
617
710
|
switch (_a.label) {
|
|
618
|
-
case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() },
|
|
711
|
+
case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i2.CheckoutSubscription.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()))];
|
|
619
712
|
case 1:
|
|
620
713
|
checkout = _a.sent();
|
|
621
714
|
cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
|
|
@@ -652,18 +745,18 @@
|
|
|
652
745
|
this.angularFirestore
|
|
653
746
|
.doc(this.orderRepository.collectionName + "/" + id)
|
|
654
747
|
.valueChanges()
|
|
655
|
-
.pipe(operators.map(function (doc) { return
|
|
748
|
+
.pipe(operators.map(function (doc) { return i2.Order.toInstance(doc); }))
|
|
656
749
|
.subscribe(function (doc) { return _this.orderSubject.next(doc); });
|
|
657
750
|
return this.orderSubject;
|
|
658
751
|
};
|
|
659
752
|
return OrderService;
|
|
660
753
|
}());
|
|
661
|
-
OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$
|
|
754
|
+
OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$1.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
662
755
|
OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
|
|
663
756
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
|
|
664
757
|
type: i0.Injectable
|
|
665
758
|
}], ctorParameters: function () {
|
|
666
|
-
return [{ type: i1__namespace$
|
|
759
|
+
return [{ type: i1__namespace$1.AngularFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
|
|
667
760
|
type: i0.Inject,
|
|
668
761
|
args: ['OrderRepository']
|
|
669
762
|
}] }];
|
|
@@ -689,21 +782,21 @@
|
|
|
689
782
|
{
|
|
690
783
|
provide: 'Authentication',
|
|
691
784
|
useFactory: function (authenticationService, userRepository) {
|
|
692
|
-
return new
|
|
785
|
+
return new i2.Authentication(authenticationService, userRepository);
|
|
693
786
|
},
|
|
694
787
|
deps: ['AuthenticationService', 'UserRepository'],
|
|
695
788
|
},
|
|
696
789
|
{
|
|
697
790
|
provide: 'AuthenticationService',
|
|
698
791
|
useFactory: function (angularFireAuth) {
|
|
699
|
-
return new
|
|
792
|
+
return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
700
793
|
},
|
|
701
794
|
deps: [i1.AngularFireAuth],
|
|
702
795
|
},
|
|
703
796
|
{
|
|
704
797
|
provide: 'SignOut',
|
|
705
798
|
useFactory: function (authenticationService) {
|
|
706
|
-
return new
|
|
799
|
+
return new i2.SignOut(authenticationService);
|
|
707
800
|
},
|
|
708
801
|
deps: ['AuthenticationService'],
|
|
709
802
|
},
|
|
@@ -716,21 +809,21 @@
|
|
|
716
809
|
{
|
|
717
810
|
provide: 'Authentication',
|
|
718
811
|
useFactory: function (authenticationService, userRepository) {
|
|
719
|
-
return new
|
|
812
|
+
return new i2.Authentication(authenticationService, userRepository);
|
|
720
813
|
},
|
|
721
814
|
deps: ['AuthenticationService', 'UserRepository'],
|
|
722
815
|
},
|
|
723
816
|
{
|
|
724
817
|
provide: 'AuthenticationService',
|
|
725
818
|
useFactory: function (angularFireAuth) {
|
|
726
|
-
return new
|
|
819
|
+
return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
727
820
|
},
|
|
728
821
|
deps: [i1.AngularFireAuth],
|
|
729
822
|
},
|
|
730
823
|
{
|
|
731
824
|
provide: 'SignOut',
|
|
732
825
|
useFactory: function (authenticationService) {
|
|
733
|
-
return new
|
|
826
|
+
return new i2.SignOut(authenticationService);
|
|
734
827
|
},
|
|
735
828
|
deps: ['AuthenticationService'],
|
|
736
829
|
},
|
|
@@ -758,156 +851,156 @@
|
|
|
758
851
|
{
|
|
759
852
|
provide: 'BeautyProfileRepository',
|
|
760
853
|
useFactory: function (firestore, userRepository) {
|
|
761
|
-
return new
|
|
854
|
+
return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
762
855
|
},
|
|
763
|
-
deps: [i1$
|
|
856
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
764
857
|
},
|
|
765
858
|
{
|
|
766
859
|
provide: 'Buy2WinRepository',
|
|
767
860
|
useFactory: function (firestore) {
|
|
768
|
-
return new
|
|
861
|
+
return new i2.Buy2WinFirestoreRepository(firestore.firestore);
|
|
769
862
|
},
|
|
770
|
-
deps: [i1$
|
|
863
|
+
deps: [i1$1.AngularFirestore],
|
|
771
864
|
},
|
|
772
865
|
{
|
|
773
866
|
provide: 'CategoryRepository',
|
|
774
867
|
useFactory: function (firestore) {
|
|
775
|
-
return new
|
|
868
|
+
return new i2.CategoryFirestoreRepository(firestore.firestore);
|
|
776
869
|
},
|
|
777
|
-
deps: [i1$
|
|
870
|
+
deps: [i1$1.AngularFirestore],
|
|
778
871
|
},
|
|
779
872
|
{
|
|
780
873
|
provide: 'CheckoutRepository',
|
|
781
874
|
useFactory: function (firestore) {
|
|
782
|
-
return new
|
|
875
|
+
return new i2.CheckoutFirestoreRepository(firestore.firestore);
|
|
783
876
|
},
|
|
784
|
-
deps: [i1$
|
|
877
|
+
deps: [i1$1.AngularFirestore],
|
|
785
878
|
},
|
|
786
879
|
{
|
|
787
880
|
provide: 'CheckoutSubscriptionRepository',
|
|
788
881
|
useFactory: function (firestore) {
|
|
789
|
-
return new
|
|
882
|
+
return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
790
883
|
},
|
|
791
|
-
deps: [i1$
|
|
884
|
+
deps: [i1$1.AngularFirestore],
|
|
792
885
|
},
|
|
793
886
|
{
|
|
794
887
|
provide: 'CouponRepository',
|
|
795
888
|
useFactory: function (firestore) {
|
|
796
|
-
return new
|
|
889
|
+
return new i2.CouponFirestoreRepository(firestore.firestore);
|
|
797
890
|
},
|
|
798
|
-
deps: [i1$
|
|
891
|
+
deps: [i1$1.AngularFirestore],
|
|
799
892
|
},
|
|
800
893
|
{
|
|
801
894
|
provide: 'EditionRepository',
|
|
802
895
|
useFactory: function (firestore, subscriptionRepository) {
|
|
803
|
-
return new
|
|
896
|
+
return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
804
897
|
},
|
|
805
|
-
deps: [i1$
|
|
898
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
806
899
|
},
|
|
807
900
|
{
|
|
808
901
|
provide: 'HomeRepository',
|
|
809
902
|
useFactory: function (firestore) {
|
|
810
|
-
return new
|
|
903
|
+
return new i2.HomeFirestoreRepository(firestore.firestore);
|
|
811
904
|
},
|
|
812
|
-
deps: [i1$
|
|
905
|
+
deps: [i1$1.AngularFirestore],
|
|
813
906
|
},
|
|
814
907
|
{
|
|
815
908
|
provide: 'LeadRepository',
|
|
816
909
|
useFactory: function (firestore) {
|
|
817
|
-
return new
|
|
910
|
+
return new i2.LeadFirestoreRepository(firestore.firestore);
|
|
818
911
|
},
|
|
819
|
-
deps: [i1$
|
|
912
|
+
deps: [i1$1.AngularFirestore],
|
|
820
913
|
},
|
|
821
914
|
{
|
|
822
915
|
provide: 'LegacyOrderRepository',
|
|
823
916
|
useFactory: function (firestore) {
|
|
824
|
-
return new
|
|
917
|
+
return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
|
|
825
918
|
},
|
|
826
|
-
deps: [i1$
|
|
919
|
+
deps: [i1$1.AngularFirestore],
|
|
827
920
|
},
|
|
828
921
|
{
|
|
829
922
|
provide: 'ShopMenuRepository',
|
|
830
923
|
useFactory: function (firestore) {
|
|
831
|
-
return new
|
|
924
|
+
return new i2.ShopMenuFirestoreRepository(firestore.firestore);
|
|
832
925
|
},
|
|
833
|
-
deps: [i1$
|
|
926
|
+
deps: [i1$1.AngularFirestore],
|
|
834
927
|
},
|
|
835
928
|
{
|
|
836
929
|
provide: 'OrderRepository',
|
|
837
930
|
useFactory: function (firestore) {
|
|
838
|
-
return new
|
|
931
|
+
return new i2.OrderFirestoreRepository(firestore.firestore);
|
|
839
932
|
},
|
|
840
|
-
deps: [i1$
|
|
933
|
+
deps: [i1$1.AngularFirestore],
|
|
841
934
|
},
|
|
842
935
|
{
|
|
843
936
|
provide: 'PaymentRepository',
|
|
844
937
|
useFactory: function (firestore) {
|
|
845
|
-
return new
|
|
938
|
+
return new i2.PaymentFirestoreRepository(firestore.firestore);
|
|
846
939
|
},
|
|
847
|
-
deps: [i1$
|
|
940
|
+
deps: [i1$1.AngularFirestore],
|
|
848
941
|
},
|
|
849
942
|
{
|
|
850
943
|
provide: 'ProductRepository',
|
|
851
944
|
useFactory: function (firestore) {
|
|
852
|
-
return new
|
|
945
|
+
return new i2.ProductFirestoreRepository(firestore.firestore);
|
|
853
946
|
},
|
|
854
|
-
deps: [i1$
|
|
947
|
+
deps: [i1$1.AngularFirestore],
|
|
855
948
|
},
|
|
856
949
|
{
|
|
857
950
|
provide: 'SubscriptionPaymentRepository',
|
|
858
951
|
useFactory: function (firestore, subscriptionRepository) {
|
|
859
|
-
return new
|
|
952
|
+
return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
860
953
|
},
|
|
861
|
-
deps: [i1$
|
|
954
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
862
955
|
},
|
|
863
956
|
{
|
|
864
957
|
provide: 'SubscriptionPlanRepository',
|
|
865
958
|
useFactory: function (firestore) {
|
|
866
|
-
return new
|
|
959
|
+
return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
867
960
|
},
|
|
868
|
-
deps: [i1$
|
|
961
|
+
deps: [i1$1.AngularFirestore],
|
|
869
962
|
},
|
|
870
963
|
{
|
|
871
964
|
provide: 'SubscriptionProductRepository',
|
|
872
965
|
useFactory: function (firestore) {
|
|
873
|
-
return new
|
|
966
|
+
return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
874
967
|
},
|
|
875
|
-
deps: [i1$
|
|
968
|
+
deps: [i1$1.AngularFirestore],
|
|
876
969
|
},
|
|
877
970
|
{
|
|
878
971
|
provide: 'SubscriptionRepository',
|
|
879
972
|
useFactory: function (firestore) {
|
|
880
|
-
return new
|
|
973
|
+
return new i2.SubscriptionFirestoreRepository(firestore.firestore);
|
|
881
974
|
},
|
|
882
|
-
deps: [i1$
|
|
975
|
+
deps: [i1$1.AngularFirestore],
|
|
883
976
|
},
|
|
884
977
|
{
|
|
885
978
|
provide: 'UserRepository',
|
|
886
979
|
useFactory: function (firestore) {
|
|
887
|
-
return new
|
|
980
|
+
return new i2.UserFirestoreRepository(firestore.firestore);
|
|
888
981
|
},
|
|
889
|
-
deps: [i1$
|
|
982
|
+
deps: [i1$1.AngularFirestore],
|
|
890
983
|
},
|
|
891
984
|
{
|
|
892
985
|
provide: 'UserAddressRepository',
|
|
893
986
|
useFactory: function (firestore, userRepository) {
|
|
894
|
-
return new
|
|
987
|
+
return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
895
988
|
},
|
|
896
|
-
deps: [i1$
|
|
989
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
897
990
|
},
|
|
898
991
|
{
|
|
899
992
|
provide: 'UserPaymentMethodRepository',
|
|
900
993
|
useFactory: function (firestore, userRepository) {
|
|
901
|
-
return new
|
|
994
|
+
return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
902
995
|
},
|
|
903
|
-
deps: [i1$
|
|
996
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
904
997
|
},
|
|
905
998
|
{
|
|
906
999
|
provide: 'VariantRepository',
|
|
907
1000
|
useFactory: function (firestore, productRepository) {
|
|
908
|
-
return new
|
|
1001
|
+
return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
909
1002
|
},
|
|
910
|
-
deps: [i1$
|
|
1003
|
+
deps: [i1$1.AngularFirestore, 'ProductRepository'],
|
|
911
1004
|
},
|
|
912
1005
|
], imports: [[fire.AngularFireModule]] });
|
|
913
1006
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
|
|
@@ -918,156 +1011,156 @@
|
|
|
918
1011
|
{
|
|
919
1012
|
provide: 'BeautyProfileRepository',
|
|
920
1013
|
useFactory: function (firestore, userRepository) {
|
|
921
|
-
return new
|
|
1014
|
+
return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
922
1015
|
},
|
|
923
|
-
deps: [i1$
|
|
1016
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
924
1017
|
},
|
|
925
1018
|
{
|
|
926
1019
|
provide: 'Buy2WinRepository',
|
|
927
1020
|
useFactory: function (firestore) {
|
|
928
|
-
return new
|
|
1021
|
+
return new i2.Buy2WinFirestoreRepository(firestore.firestore);
|
|
929
1022
|
},
|
|
930
|
-
deps: [i1$
|
|
1023
|
+
deps: [i1$1.AngularFirestore],
|
|
931
1024
|
},
|
|
932
1025
|
{
|
|
933
1026
|
provide: 'CategoryRepository',
|
|
934
1027
|
useFactory: function (firestore) {
|
|
935
|
-
return new
|
|
1028
|
+
return new i2.CategoryFirestoreRepository(firestore.firestore);
|
|
936
1029
|
},
|
|
937
|
-
deps: [i1$
|
|
1030
|
+
deps: [i1$1.AngularFirestore],
|
|
938
1031
|
},
|
|
939
1032
|
{
|
|
940
1033
|
provide: 'CheckoutRepository',
|
|
941
1034
|
useFactory: function (firestore) {
|
|
942
|
-
return new
|
|
1035
|
+
return new i2.CheckoutFirestoreRepository(firestore.firestore);
|
|
943
1036
|
},
|
|
944
|
-
deps: [i1$
|
|
1037
|
+
deps: [i1$1.AngularFirestore],
|
|
945
1038
|
},
|
|
946
1039
|
{
|
|
947
1040
|
provide: 'CheckoutSubscriptionRepository',
|
|
948
1041
|
useFactory: function (firestore) {
|
|
949
|
-
return new
|
|
1042
|
+
return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
950
1043
|
},
|
|
951
|
-
deps: [i1$
|
|
1044
|
+
deps: [i1$1.AngularFirestore],
|
|
952
1045
|
},
|
|
953
1046
|
{
|
|
954
1047
|
provide: 'CouponRepository',
|
|
955
1048
|
useFactory: function (firestore) {
|
|
956
|
-
return new
|
|
1049
|
+
return new i2.CouponFirestoreRepository(firestore.firestore);
|
|
957
1050
|
},
|
|
958
|
-
deps: [i1$
|
|
1051
|
+
deps: [i1$1.AngularFirestore],
|
|
959
1052
|
},
|
|
960
1053
|
{
|
|
961
1054
|
provide: 'EditionRepository',
|
|
962
1055
|
useFactory: function (firestore, subscriptionRepository) {
|
|
963
|
-
return new
|
|
1056
|
+
return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
964
1057
|
},
|
|
965
|
-
deps: [i1$
|
|
1058
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
966
1059
|
},
|
|
967
1060
|
{
|
|
968
1061
|
provide: 'HomeRepository',
|
|
969
1062
|
useFactory: function (firestore) {
|
|
970
|
-
return new
|
|
1063
|
+
return new i2.HomeFirestoreRepository(firestore.firestore);
|
|
971
1064
|
},
|
|
972
|
-
deps: [i1$
|
|
1065
|
+
deps: [i1$1.AngularFirestore],
|
|
973
1066
|
},
|
|
974
1067
|
{
|
|
975
1068
|
provide: 'LeadRepository',
|
|
976
1069
|
useFactory: function (firestore) {
|
|
977
|
-
return new
|
|
1070
|
+
return new i2.LeadFirestoreRepository(firestore.firestore);
|
|
978
1071
|
},
|
|
979
|
-
deps: [i1$
|
|
1072
|
+
deps: [i1$1.AngularFirestore],
|
|
980
1073
|
},
|
|
981
1074
|
{
|
|
982
1075
|
provide: 'LegacyOrderRepository',
|
|
983
1076
|
useFactory: function (firestore) {
|
|
984
|
-
return new
|
|
1077
|
+
return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
|
|
985
1078
|
},
|
|
986
|
-
deps: [i1$
|
|
1079
|
+
deps: [i1$1.AngularFirestore],
|
|
987
1080
|
},
|
|
988
1081
|
{
|
|
989
1082
|
provide: 'ShopMenuRepository',
|
|
990
1083
|
useFactory: function (firestore) {
|
|
991
|
-
return new
|
|
1084
|
+
return new i2.ShopMenuFirestoreRepository(firestore.firestore);
|
|
992
1085
|
},
|
|
993
|
-
deps: [i1$
|
|
1086
|
+
deps: [i1$1.AngularFirestore],
|
|
994
1087
|
},
|
|
995
1088
|
{
|
|
996
1089
|
provide: 'OrderRepository',
|
|
997
1090
|
useFactory: function (firestore) {
|
|
998
|
-
return new
|
|
1091
|
+
return new i2.OrderFirestoreRepository(firestore.firestore);
|
|
999
1092
|
},
|
|
1000
|
-
deps: [i1$
|
|
1093
|
+
deps: [i1$1.AngularFirestore],
|
|
1001
1094
|
},
|
|
1002
1095
|
{
|
|
1003
1096
|
provide: 'PaymentRepository',
|
|
1004
1097
|
useFactory: function (firestore) {
|
|
1005
|
-
return new
|
|
1098
|
+
return new i2.PaymentFirestoreRepository(firestore.firestore);
|
|
1006
1099
|
},
|
|
1007
|
-
deps: [i1$
|
|
1100
|
+
deps: [i1$1.AngularFirestore],
|
|
1008
1101
|
},
|
|
1009
1102
|
{
|
|
1010
1103
|
provide: 'ProductRepository',
|
|
1011
1104
|
useFactory: function (firestore) {
|
|
1012
|
-
return new
|
|
1105
|
+
return new i2.ProductFirestoreRepository(firestore.firestore);
|
|
1013
1106
|
},
|
|
1014
|
-
deps: [i1$
|
|
1107
|
+
deps: [i1$1.AngularFirestore],
|
|
1015
1108
|
},
|
|
1016
1109
|
{
|
|
1017
1110
|
provide: 'SubscriptionPaymentRepository',
|
|
1018
1111
|
useFactory: function (firestore, subscriptionRepository) {
|
|
1019
|
-
return new
|
|
1112
|
+
return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1020
1113
|
},
|
|
1021
|
-
deps: [i1$
|
|
1114
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1022
1115
|
},
|
|
1023
1116
|
{
|
|
1024
1117
|
provide: 'SubscriptionPlanRepository',
|
|
1025
1118
|
useFactory: function (firestore) {
|
|
1026
|
-
return new
|
|
1119
|
+
return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
1027
1120
|
},
|
|
1028
|
-
deps: [i1$
|
|
1121
|
+
deps: [i1$1.AngularFirestore],
|
|
1029
1122
|
},
|
|
1030
1123
|
{
|
|
1031
1124
|
provide: 'SubscriptionProductRepository',
|
|
1032
1125
|
useFactory: function (firestore) {
|
|
1033
|
-
return new
|
|
1126
|
+
return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
1034
1127
|
},
|
|
1035
|
-
deps: [i1$
|
|
1128
|
+
deps: [i1$1.AngularFirestore],
|
|
1036
1129
|
},
|
|
1037
1130
|
{
|
|
1038
1131
|
provide: 'SubscriptionRepository',
|
|
1039
1132
|
useFactory: function (firestore) {
|
|
1040
|
-
return new
|
|
1133
|
+
return new i2.SubscriptionFirestoreRepository(firestore.firestore);
|
|
1041
1134
|
},
|
|
1042
|
-
deps: [i1$
|
|
1135
|
+
deps: [i1$1.AngularFirestore],
|
|
1043
1136
|
},
|
|
1044
1137
|
{
|
|
1045
1138
|
provide: 'UserRepository',
|
|
1046
1139
|
useFactory: function (firestore) {
|
|
1047
|
-
return new
|
|
1140
|
+
return new i2.UserFirestoreRepository(firestore.firestore);
|
|
1048
1141
|
},
|
|
1049
|
-
deps: [i1$
|
|
1142
|
+
deps: [i1$1.AngularFirestore],
|
|
1050
1143
|
},
|
|
1051
1144
|
{
|
|
1052
1145
|
provide: 'UserAddressRepository',
|
|
1053
1146
|
useFactory: function (firestore, userRepository) {
|
|
1054
|
-
return new
|
|
1147
|
+
return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
1055
1148
|
},
|
|
1056
|
-
deps: [i1$
|
|
1149
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1057
1150
|
},
|
|
1058
1151
|
{
|
|
1059
1152
|
provide: 'UserPaymentMethodRepository',
|
|
1060
1153
|
useFactory: function (firestore, userRepository) {
|
|
1061
|
-
return new
|
|
1154
|
+
return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
1062
1155
|
},
|
|
1063
|
-
deps: [i1$
|
|
1156
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1064
1157
|
},
|
|
1065
1158
|
{
|
|
1066
1159
|
provide: 'VariantRepository',
|
|
1067
1160
|
useFactory: function (firestore, productRepository) {
|
|
1068
|
-
return new
|
|
1161
|
+
return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
1069
1162
|
},
|
|
1070
|
-
deps: [i1$
|
|
1163
|
+
deps: [i1$1.AngularFirestore, 'ProductRepository'],
|
|
1071
1164
|
},
|
|
1072
1165
|
],
|
|
1073
1166
|
}]
|
|
@@ -1079,19 +1172,19 @@
|
|
|
1079
1172
|
AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
|
|
1080
1173
|
return {
|
|
1081
1174
|
ngModule: AngularConnectModule,
|
|
1082
|
-
providers: __spreadArray(__spreadArray(__spreadArray([], __read((
|
|
1175
|
+
providers: __spreadArray(__spreadArray(__spreadArray([], __read((i2.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i2.isNil(options) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options }]))), __read((i2.isNil(options) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))),
|
|
1083
1176
|
};
|
|
1084
1177
|
};
|
|
1085
1178
|
return AngularConnectModule;
|
|
1086
1179
|
}());
|
|
1087
1180
|
AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1088
1181
|
AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
|
|
1089
|
-
AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, OrderService], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
|
|
1182
|
+
AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
|
|
1090
1183
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
|
|
1091
1184
|
type: i0.NgModule,
|
|
1092
1185
|
args: [{
|
|
1093
1186
|
imports: [fire.AngularFireModule, AngularFirestoreModule],
|
|
1094
|
-
providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, OrderService],
|
|
1187
|
+
providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService],
|
|
1095
1188
|
}]
|
|
1096
1189
|
}] });
|
|
1097
1190
|
|
|
@@ -1106,6 +1199,7 @@
|
|
|
1106
1199
|
exports.CartService = CartService;
|
|
1107
1200
|
exports.CheckoutService = CheckoutService;
|
|
1108
1201
|
exports.CheckoutSubscriptionService = CheckoutSubscriptionService;
|
|
1202
|
+
exports.CouponService = CouponService;
|
|
1109
1203
|
exports.OrderService = OrderService;
|
|
1110
1204
|
|
|
1111
1205
|
Object.defineProperty(exports, '__esModule', { value: true });
|